Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): switch to using Swatinem/rust-cache action #2671

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
name: cargo clippy
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/

strategy:
fail-fast: false
Expand All @@ -36,29 +29,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Restore cargo cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable # We do not use MSRV so we can benefit from newer lints
targets: ${{ matrix.target }}
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Run `cargo clippy`
run: cargo clippy --workspace --locked --release

- name: Run `cargo fmt`
run: cargo fmt --all --check

- uses: actions/cache/save@v3
# Write a cache entry even if the tests fail but don't create any for the merge queue.
if: ${{ always() && steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
50 changes: 12 additions & 38 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
runs-on: macos-latest
env:
CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
Expand All @@ -52,28 +46,21 @@ jobs:
echo "SDKROOT=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-platform-version)" >> $GITHUB_ENV

- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build environment and Compile
run: |
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"

- uses: actions/cache/save@v3
# Don't create cache entries for the merge queue.
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down Expand Up @@ -111,12 +98,6 @@ jobs:
runs-on: ubuntu-22.04
env:
CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
fail-fast: false
matrix:
Expand All @@ -128,17 +109,17 @@ jobs:
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Install Cross
uses: taiki-e/install-action@v2
with:
Expand All @@ -147,13 +128,6 @@ jobs:
- name: Build Nargo
run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }}"

- uses: actions/cache/save@v3
# Don't create cache entries for the merge queue.
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down
27 changes: 6 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/

strategy:
fail-fast: false
Expand All @@ -37,24 +30,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Restore nix store cache
uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Run tests
run: cargo test --workspace --locked --release

- uses: actions/cache/save@v3
# Write a cache entry even if the tests fail but don't create any for the merge queue.
if: ${{ always() && steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}
26 changes: 6 additions & 20 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ concurrency:
jobs:
build-nargo:
runs-on: ubuntu-22.04
env:
CACHED_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]
Expand All @@ -29,25 +22,18 @@ jobs:
- name: Checkout Noir repo
uses: actions/checkout@v4

- uses: actions/cache/restore@v3
id: cache
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/[email protected]

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true
save-if: ${{ github.event_name != 'merge_group' }}

- name: Build Nargo
run: cargo build --package nargo_cli --release

- uses: actions/cache/save@v3
# Don't create cache entries for the merge queue.
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }}
with:
path: ${{ env.CACHED_PATHS }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ACIR Supported OPCODES:
- Sha256
- Blake2s
- Schnorr signature verification
- MerkleMembership
- Pedersen
- HashToField

Expand Down