Skip to content

Commit

Permalink
Refactor Rust build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pemistahl committed Feb 22, 2024
1 parent a90ecef commit e53058f
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions .github/workflows/rust-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit e53058f

Please sign in to comment.