Use mozilla-actions/sccache-action for caching builds #795
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
name: Test | |
env: | |
CACHE_GENERATION: 0 | |
jobs: | |
test: | |
strategy: | |
matrix: | |
platform: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2022, macos-12, macos-13, macos-14] | |
runs-on: ${{ matrix.platform }} | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup update --no-self-update stable && rustup default stable | |
shell: bash | |
- name: Add wasm32-wasi Rust target | |
run: rustup target add wasm32-wasi | |
- name: Add wasm32-unknown-unknown Rust target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
key: ${{ matrix.platform }}-cargo-v${{ env.CACHE_GENERATION }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Install rustfmt | |
run: rustup component add rustfmt | |
shell: bash | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
shell: bash | |
- name: test | |
run: make ci | |
shell: bash | |
- name: adapter | |
run: cargo build --release -p viceroy-component-adapter --target wasm32-unknown-unknown | |
# Run the trap test in an isolated job. It needs different cargo features than the usual build, so | |
# it entails rebuilding the whole workspace if we combine them in a single job. This way, we | |
# achieve some parallelism via Actions jobs. | |
trap-test: | |
strategy: | |
matrix: | |
platform: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2022, macos-12, macos-13, macos-14] | |
runs-on: ${{ matrix.platform }} | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup update --no-self-update stable && rustup default stable | |
shell: bash | |
- name: Add wasm32-wasi Rust target | |
run: rustup target add wasm32-wasi | |
- name: Add wasm32-unknown-unknown Rust target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
key: ${{ matrix.platform }}-cargo-trap-v${{ env.CACHE_GENERATION }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: trap-test | |
run: make trap-test-ci | |
shell: bash | |
package-check: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup update stable && rustup default stable | |
shell: bash | |
- name: Check crates can be published | |
run: make package-check | |
shell: bash |