From e53058fc526f530825537ba61554117429c9bbc1 Mon Sep 17 00:00:00 2001 From: "Peter M. Stahl" Date: Thu, 22 Feb 2024 22:57:46 +0100 Subject: [PATCH] Refactor Rust build workflow --- .github/workflows/rust-build.yml | 65 +++++++++++++++++--------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/.github/workflows/rust-build.yml b/.github/workflows/rust-build.yml index ce5a225..2b39ab1 100644 --- a/.github/workflows/rust-build.yml +++ b/.github/workflows/rust-build.yml @@ -48,45 +48,34 @@ jobs: include: - os: ubuntu-latest name: Linux 64-Bit - target: x86_64-unknown-linux-musl + x86_64-target: x86_64-unknown-linux-musl + aarch64-target: aarch64-unknown-linux-musl - os: macos-latest name: MacOS 64-Bit - target: x86_64-apple-darwin + x86_64-target: x86_64-apple-darwin + aarch64-target: aarch64-apple-darwin env: MACOSX_DEPLOYMENT_TARGET: 10.7 - os: windows-latest name: Windows 64-Bit - target: x86_64-pc-windows-msvc + x86_64-target: x86_64-pc-windows-msvc + aarch64-target: aarch64-pc-windows-msvc steps: - name: Check out repository uses: actions/checkout@v4 - - name: Add rustup target - run: rustup target add ${{ matrix.target }} + - name: Add rustup targets + run: | + rustup target add ${{ matrix.x86_64-target }} + rustup target add ${{ matrix.aarch64-target }} - - name: Install apt packages + - name: Install MUSL tools for Linux if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get install musl-tools libssl-dev - # needed to fix file corruption of cache - # https://github.com/actions/cache/issues/403 - - name: Install GNU tar - if: ${{ matrix.os == 'macos-latest' }} - run: | - brew install gnu-tar - echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH - - - name: Install wasm-pack - if: ${{ matrix.os == 'macos-latest' }} - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Enable Safari web driver - if: ${{ matrix.os == 'macos-latest' }} - run: sudo safaridriver --enable - - name: Store or retrieve cargo caches uses: actions/cache@v4 with: @@ -98,26 +87,42 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Build target in debug mode - run: cargo build --target ${{ matrix.target }} --locked + - name: Build targets in debug mode + run: | + cargo build --target ${{ matrix.x86_64-target }} --locked + cargo build --target ${{ matrix.aarch64-target }} --locked + + - name: Test targets in debug mode + run: | + cargo test --target ${{ matrix.x86_64-target }} + cargo test --target ${{ matrix.aarch64-target }} + + wasm-build: + name: WASM Build + needs: rust-build + + runs-on: macos-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: Test default target in debug mode - run: cargo test --target ${{ matrix.target }} + - name: Enable Safari web driver + run: sudo safaridriver --enable - name: Run WASM integration tests on NodeJS - if: ${{ matrix.os == 'macos-latest' }} run: wasm-pack test --node -- --no-default-features - name: Run WASM integration tests in Chrome - if: ${{ matrix.os == 'macos-latest' }} run: wasm-pack test --headless --chrome -- --no-default-features - name: Run WASM integration tests in Firefox - if: ${{ matrix.os == 'macos-latest' }} run: wasm-pack test --headless --firefox -- --no-default-features - name: Run WASM integration tests in Safari - if: ${{ matrix.os == 'macos-latest' }} run: wasm-pack test --headless --safari -- --no-default-features coverage-report: