Skip to content

Commit

Permalink
CI: Use Cargo cache for GitHub Actions (#669)
Browse files Browse the repository at this point in the history
* use cargo cache for GitHub Actions CI

* slightly improve rust.yml

* add cargo-udeps run to GHA CI

* fix cargo-udeps CI run

* setup cache for miri CI run

* setup cache for coverage job

* use cargo cache for docs CI run

* add cargo cache to clippy CI job
  • Loading branch information
Robbepop authored Feb 12, 2023
1 parent 183acba commit 67253b2
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 2 deletions.
110 changes: 108 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ jobs:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Add extra targets
# Workaround for https://github.com/actions-rs/toolchain/issues/165
run: |
Expand All @@ -32,7 +44,7 @@ jobs:
with:
command: build
args: --workspace --all-features
- name: Build wasmi itself as no_std
- name: Build (no_std)
uses: actions-rs/cargo@v1
with:
command: build
Expand All @@ -41,7 +53,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --no-default-features --target wasm32-unknown-unknown --exclude wasmi_cli --exclude wasmi_wasi
args: --workspace --lib --no-default-features --target wasm32-unknown-unknown --exclude wasmi_cli --exclude wasmi_wasi

test:
name: Test
Expand All @@ -58,6 +70,18 @@ jobs:
profile: minimal
toolchain: stable
override: true
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Test (default features)
Expand Down Expand Up @@ -102,6 +126,18 @@ jobs:
toolchain: stable
override: true
components: rust-docs, rust-src
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/cargo@v1
env:
RUSTDOCFLAGS: '-D warnings'
Expand All @@ -124,6 +160,40 @@ jobs:
command: audit
args: ''

udeps:
name: uDeps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-udeps-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-udeps-
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Install cargo-udeps
run: |
# Note: We use `|| true` because cargo install returns an error
# if cargo-udeps was already installed on the CI runner.
cargo install --locked cargo-udeps || true
- uses: actions-rs/cargo@v1
with:
command: udeps
args: --all-targets

miri:
name: Miri
runs-on: ubuntu-latest
Expand All @@ -135,6 +205,18 @@ jobs:
toolchain: nightly
override: true
components: miri
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-miri-
- name: Clippy (--lib)
uses: actions-rs/cargo@v1
with:
Expand All @@ -157,6 +239,18 @@ jobs:
toolchain: nightly
override: true
components: clippy
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Clippy (default features)
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -191,6 +285,18 @@ jobs:
with:
toolchain: stable
override: true
- name: Set up Cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-coverage-
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Run cargo-tarpaulin (default features)
Expand Down
4 changes: 4 additions & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ rand = "0.8.2"
default = ["std"]
# Use `no-default-features` for a `no_std` build.
std = ["num-traits/std", "downcast-rs/std"]

[package.metadata.cargo-udeps.ignore]
# cargo-udeps cannot detect that libm is used for no_std targets only.
normal = ["libm"]

0 comments on commit 67253b2

Please sign in to comment.