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): Avoid writing to cache in workflows triggered by the merge queue #2341

Merged
merged 19 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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: 24 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ 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@v3
- uses: actions/cache/restore@v3
id: restore-cache
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
with:
path: |
~/.cargo/bin/
Expand All @@ -106,6 +107,12 @@ jobs:
run: |
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features plonk_bn254_wasm

- uses: actions/cache/save@v3
if: ${{ github.event_name != 'merge_group' }} # Don't create cache entries for the merge queue.
with:
path: ${{ steps.restore-cache.inputs.path }}
phated marked this conversation as resolved.
Show resolved Hide resolved
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down Expand Up @@ -161,7 +168,8 @@ jobs:
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- uses: actions/cache@v3
- uses: actions/cache/restore@v3
id: restore-cache
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -189,6 +197,12 @@ jobs:
cargo install cross --force --git https://github.com/cross-rs/cross
cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features plonk_bn254_wasm

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

- name: Package artifacts
run: |
mkdir dist
Expand Down Expand Up @@ -237,7 +251,8 @@ jobs:
with:
ref: ${{ inputs.tag || env.GITHUB_REF }}

- uses: actions/cache@v3
- uses: actions/cache/restore@v3
id: restore-cache
with:
path: |
~/.cargo/bin/
Expand All @@ -264,6 +279,12 @@ jobs:
run: |
cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features plonk_bn254_wasm

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

- name: Package artifacts
run: |
mkdir dist
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
name: barretenberg

- name: Restore nix store cache
id: nix-store-cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
id: restore-cache
with:
path: /tmp/nix-cache
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
key: ${{ runner.os }}-flake-${{ hashFiles('*.lock') }}

# Based on https://github.com/marigold-dev/deku/blob/b5016f0cf4bf6ac48db9111b70dd7fb49b969dfd/.github/workflows/build.yml#L26
- name: Copy cache into nix store
if: steps.nix-store-cache.outputs.cache-hit == 'true'
if: steps.restore-cache.outputs.cache-hit == 'true'
# We don't check the signature because we're the one that created the cache
run: |
for narinfo in /tmp/nix-cache/*.narinfo; do
Expand All @@ -61,3 +61,10 @@ jobs:
if: steps.nix-store-cache.outputs.cache-hit != 'true'
run: |
nix copy --to "file:///tmp/nix-cache?compression=zstd&parallel-compression=true" .#native-cargo-artifacts

- 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() && github.event_name != 'merge_group' }}
with:
path: ${{ steps.restore-cache.inputs.path }}
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 8 additions & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
- name: Checkout Noir repo
uses: actions/checkout@v3

- uses: actions/cache@v3
- uses: actions/cache/restore@v3
id: restore-cache
with:
path: |
~/.cargo/bin/
Expand All @@ -79,6 +80,12 @@ jobs:
run: |
cargo build --package nargo_cli --release --no-default-features --features plonk_bn254_wasm

- uses: actions/cache/save@v3
if: ${{ github.event_name != 'merge_group' }} # Don't create cache entries for the merge queue.
with:
path: ${{ steps.restore-cache.inputs.path }}
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: Package artifacts
run: |
mkdir dist
Expand Down