Skip to content

Commit

Permalink
pre-build wasm binaries in first CI step
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Nov 13, 2024
1 parent 90cfe5d commit 4cc2b99
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,35 @@ env:
RUSTDOCFLAGS: -D warnings

jobs:
# this job pre-build using `just build` and copies the .wasm files to /dist/ before running other jobs
# all other jobs depend on this one
pre-build:
name: Pre-Build wasm binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: extractions/setup-just@v2

# binstall is faster than cargo install
- name: Install binstall
uses: taiki-e/install-action@cargo-binstall

- name: Install cargo-component
run: echo yes | cargo binstall cargo-component

- name: install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- run: just build
- run: cp target/wasm32-unknown-unknown/release/*.wasm assets/

check:
name: Check
runs-on: ubuntu-latest
needs: pre-build
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand All @@ -25,6 +51,7 @@ jobs:
check_wasm:
name: Check wasm32
runs-on: ubuntu-latest
needs: pre-build
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand All @@ -40,6 +67,7 @@ jobs:

test:
name: Test Suite
needs: pre-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -57,6 +85,7 @@ jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
needs: pre-build
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand All @@ -72,6 +101,7 @@ jobs:

clippy:
name: Clippy
needs: pre-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -89,6 +119,7 @@ jobs:
trunk:
name: trunk
runs-on: ubuntu-latest
needs: pre-build
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand All @@ -104,6 +135,7 @@ jobs:

build:
runs-on: ${{ matrix.os }}
needs: pre-build
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -136,17 +168,6 @@ jobs:
- name: Building ${{ matrix.TARGET }}
run: echo "${{ matrix.TARGET }}"

# Use Just commands
- uses: extractions/setup-just@v2

# binstall is faster than cargo install
- name: Install binstall
uses: taiki-e/install-action@cargo-binstall

# We'l need cargo-component to build WIT Components in the Just commands
- name: Install cargo-component
run: echo yes | cargo binstall cargo-component

- name: install Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -175,7 +196,6 @@ jobs:
- name: Build (Just + Cross)
run: |
just build
cross build --verbose --release --target=${{ matrix.TARGET }}
- name: Rename
Expand Down

0 comments on commit 4cc2b99

Please sign in to comment.