From 0b35729ded2cd048ad54663e494f1a231801c95d Mon Sep 17 00:00:00 2001 From: Jett Chen Date: Sat, 27 Jul 2024 12:32:31 +0800 Subject: [PATCH] attempt: update gh action --- .github/workflows/build-apple.yml | 134 +++++++++++++++--------------- .github/workflows/build-rust.yml | 119 +++++++++++++------------- Dockerfile | 2 +- 3 files changed, 130 insertions(+), 125 deletions(-) diff --git a/.github/workflows/build-apple.yml b/.github/workflows/build-apple.yml index 84cc03a8..c3cd7a07 100644 --- a/.github/workflows/build-apple.yml +++ b/.github/workflows/build-apple.yml @@ -1,11 +1,11 @@ name: Build Apple Apps on: push: - branches: - - main + branches: + - main pull_request: branches: - - "*" + - "*" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -17,69 +17,71 @@ jobs: fail-fast: false matrix: include: - - scheme: App - destination: generic/platform=iOS - platform: iOS - sdk-name: iphoneos - rust-targets: - - aarch64-apple-ios - - scheme: App - destination: platform=iOS Simulator,OS=18.0,name=iPhone 15 Pro - platform: iOS Simulator - sdk-name: iphonesimulator - rust-targets: - - aarch64-apple-ios-sim - - x86_64-apple-ios - - scheme: App - destination: platform=macOS - platform: macOS - sdk-name: macos - rust-targets: - - x86_64-apple-darwin - - aarch64-apple-darwin + - scheme: App + destination: generic/platform=iOS + platform: iOS + sdk-name: iphoneos + rust-targets: + - aarch64-apple-ios + - scheme: App + destination: platform=iOS Simulator,OS=18.0,name=iPhone 15 Pro + platform: iOS Simulator + sdk-name: iphonesimulator + rust-targets: + - aarch64-apple-ios-sim + - x86_64-apple-ios + - scheme: App + destination: platform=macOS + platform: macOS + sdk-name: macos + rust-targets: + - x86_64-apple-darwin + - aarch64-apple-darwin env: DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ssh-key: ${{ secrets.DEPLOY_KEY }} - submodules: recursive - - name: Import Certificate - uses: ./.github/actions/import-cert - with: - certificate: ${{ secrets.DEVELOPER_CERT }} - password: ${{ secrets.DEVELOPER_CERT_PASSWORD }} - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ join(matrix.rust-targets, ', ') }} - - name: Build - id: build - uses: ./.github/actions/build-for-testing - with: - scheme: ${{ matrix.scheme }} - destination: ${{ matrix.destination }} - app-store-key: ${{ secrets.APPSTORE_KEY }} - app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }} - app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }} - - name: Run Unit Tests - if: ${{ matrix.xcode-unit-test != '' }} - continue-on-error: true - uses: ./.github/actions/test-without-building - with: - scheme: ${{ matrix.scheme }} - destination: ${{ matrix.destination }} - test-plan: ${{ matrix.xcode-unit-test }} - artifact-prefix: unit-tests-${{ matrix.sdk-name }} - check-name: Xcode Unit Tests (${{ matrix.platform }}) - - name: Run UI Tests - if: ${{ matrix.xcode-ui-test != '' }} - continue-on-error: true - uses: ./.github/actions/test-without-building - with: - scheme: ${{ matrix.scheme }} - destination: ${{ matrix.destination }} - test-plan: ${{ matrix.xcode-ui-test }} - artifact-prefix: ui-tests-${{ matrix.sdk-name }} - check-name: Xcode UI Tests (${{ matrix.platform }}) + - name: Checkout + uses: actions/checkout@v3 + with: + ssh-key: ${{ secrets.DEPLOY_KEY }} + submodules: recursive + - name: Import Certificate + uses: ./.github/actions/import-cert + with: + certificate: ${{ secrets.DEVELOPER_CERT }} + password: ${{ secrets.DEVELOPER_CERT_PASSWORD }} + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ join(matrix.rust-targets, ', ') }} + - name: Install Protoc + uses: arduino/setup-protoc@v3 + - name: Build + id: build + uses: ./.github/actions/build-for-testing + with: + scheme: ${{ matrix.scheme }} + destination: ${{ matrix.destination }} + app-store-key: ${{ secrets.APPSTORE_KEY }} + app-store-key-id: ${{ secrets.APPSTORE_KEY_ID }} + app-store-key-issuer-id: ${{ secrets.APPSTORE_KEY_ISSUER_ID }} + - name: Run Unit Tests + if: ${{ matrix.xcode-unit-test != '' }} + continue-on-error: true + uses: ./.github/actions/test-without-building + with: + scheme: ${{ matrix.scheme }} + destination: ${{ matrix.destination }} + test-plan: ${{ matrix.xcode-unit-test }} + artifact-prefix: unit-tests-${{ matrix.sdk-name }} + check-name: Xcode Unit Tests (${{ matrix.platform }}) + - name: Run UI Tests + if: ${{ matrix.xcode-ui-test != '' }} + continue-on-error: true + uses: ./.github/actions/test-without-building + with: + scheme: ${{ matrix.scheme }} + destination: ${{ matrix.destination }} + test-plan: ${{ matrix.xcode-ui-test }} + artifact-prefix: ui-tests-${{ matrix.sdk-name }} + check-name: Xcode UI Tests (${{ matrix.platform }}) diff --git a/.github/workflows/build-rust.yml b/.github/workflows/build-rust.yml index 76ce9f2b..728d0cf4 100644 --- a/.github/workflows/build-rust.yml +++ b/.github/workflows/build-rust.yml @@ -2,10 +2,10 @@ name: Build Rust Crate on: push: branches: - - main + - main pull_request: branches: - - "*" + - "*" jobs: build: name: Build Crate (${{ matrix.platform }}) @@ -13,33 +13,33 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-latest - platform: Linux - packages: - - gcc-aarch64-linux-gnu - test-targets: - - x86_64-unknown-linux-gnu - targets: - - aarch64-unknown-linux-gnu - - os: macos-12 - platform: macOS (Intel) - test-targets: - - x86_64-apple-darwin - targets: - - x86_64-apple-ios - - os: macos-14 - platform: macOS - test-targets: - - aarch64-apple-darwin - targets: - - aarch64-apple-ios - - aarch64-apple-ios-sim - - os: windows-2022 - platform: Windows - test-targets: - - x86_64-pc-windows-msvc - targets: - - aarch64-pc-windows-msvc + - os: ubuntu-latest + platform: Linux + packages: + - gcc-aarch64-linux-gnu + test-targets: + - x86_64-unknown-linux-gnu + targets: + - aarch64-unknown-linux-gnu + - os: macos-12 + platform: macOS (Intel) + test-targets: + - x86_64-apple-darwin + targets: + - x86_64-apple-ios + - os: macos-14 + platform: macOS + test-targets: + - aarch64-apple-darwin + targets: + - aarch64-apple-ios + - aarch64-apple-ios-sim + - os: windows-2022 + platform: Windows + test-targets: + - x86_64-pc-windows-msvc + targets: + - aarch64-pc-windows-msvc runs-on: ${{ matrix.os }} env: DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer @@ -47,32 +47,35 @@ jobs: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc RUST_BACKTRACE: short steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ssh-key: ${{ secrets.DEPLOY_KEY }} - submodules: recursive - - name: Install Packages - if: matrix.os == 'ubuntu-latest' - shell: bash - run: | - sudo apt-get update - sudo apt-get install -y ${{ join(matrix.packages, ' ') }} - - name: Install Windows Deps - if: matrix.os == 'windows-2022' - shell: bash - run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - components: rustfmt - targets: ${{ join(matrix.targets, ', ') }} - - name: Setup Rust Cache - uses: Swatinem/rust-cache@v2 - - name: Build - shell: bash - run: cargo build --verbose --workspace --all-features --target ${{ join(matrix.targets, ' --target ') }} --target ${{ join(matrix.test-targets, ' --target ') }} - - name: Test - shell: bash - run: cargo test --verbose --workspace --all-features --target ${{ join(matrix.test-targets, ' --target ') }} + - name: Checkout + uses: actions/checkout@v3 + with: + ssh-key: ${{ secrets.DEPLOY_KEY }} + submodules: recursive + - name: Install Packages + if: matrix.os == 'ubuntu-latest' + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y ${{ join(matrix.packages, ' ') }} + - name: Install Windows Deps + if: matrix.os == 'windows-2022' + shell: bash + run: echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: rustfmt + targets: ${{ join(matrix.targets, ', ') }} + - name: Install Protobuf Compiler + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-12' || matrix.os == 'macos-14' + uses: arduino/setup-protoc@v3 + - name: Setup Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Build + shell: bash + run: cargo build --verbose --workspace --all-features --target ${{ join(matrix.targets, ' --target ') }} --target ${{ join(matrix.test-targets, ' --target ') }} + - name: Test + shell: bash + run: cargo test --verbose --workspace --all-features --target ${{ join(matrix.test-targets, ' --target ') }} diff --git a/Dockerfile b/Dockerfile index 8e17812b..404179b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN set -eux && \ curl --proto '=https' --tlsv1.2 -sSf https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor --output $KEYRINGS/llvm.gpg && \ echo "deb [signed-by=$KEYRINGS/llvm.gpg] http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" > /etc/apt/sources.list.d/llvm.list && \ apt-get update && \ - apt-get install --no-install-recommends -y clang-$LLVM_VERSION llvm-$LLVM_VERSION lld-$LLVM_VERSION build-essential sqlite3 libsqlite3-dev musl musl-tools musl-dev && \ + apt-get install --no-install-recommends -y clang-$LLVM_VERSION llvm-$LLVM_VERSION lld-$LLVM_VERSION build-essential sqlite3 libsqlite3-dev musl musl-tools musl-dev protobuf-compiler libprotobuf-dev && \ ln -s clang-$LLVM_VERSION /usr/bin/clang && \ ln -s clang /usr/bin/clang++ && \ ln -s lld-$LLVM_VERSION /usr/bin/ld.lld && \