Skip to content

Commit

Permalink
ci: Limit when CI cache is written (#1202)
Browse files Browse the repository at this point in the history
Caches saved from PRs count against the 10GB cache limit after which old
cache entries are evicted, but they rarely get re-used as they're only
available for further commits on the same PR.

We hit this limit all the time:
https://github.com/svix/svix-webhooks/actions/caches

![Screenshot 2024-02-12 at 15-56-49 Workflow runs ·
svix_svix-webhooks](https://github.com/svix/svix-webhooks/assets/158304798/00e7e6fe-f833-4ec3-82e5-2de122d37b1f)


https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
  • Loading branch information
svix-gabriel authored Feb 12, 2024
2 parents 8b1beca + 2137b65 commit fc5b0ad
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/bridge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: "bridge -> target"
# only save the cache on the main branch
# cf https://github.com/Swatinem/rust-cache/issues/95
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: rustfmt
run: cargo fmt -- --check
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/other-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter@v4
uses: super-linter/super-linter@v6.0.0
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_CHECKOV: false
VALIDATE_PYTHON: false
VALIDATE_JAVASCRIPT_ES: false
VALIDATE_JAVASCRIPT_STANDARD: false
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/rust-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ jobs:
toolchain: ${{ matrix.rust }}
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
with:
working-directory: rust
workspaces: "rust -> target"
# only save the cache on the main branch
# cf https://github.com/Swatinem/rust-cache/issues/95
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/rust-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ jobs:
with:
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
with:
workspaces: "rust -> target"
# only restore cache for faster publishing, don't save back results
save-if: false

- name: Publish
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: "server -> target"
# only save the cache on the main branch
# cf https://github.com/Swatinem/rust-cache/issues/95
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: rustfmt
run: cargo fmt -- --check
Expand Down

0 comments on commit fc5b0ad

Please sign in to comment.