Skip to content

Commit

Permalink
Cache CI output only when pushing to main. (#80)
Browse files Browse the repository at this point in the history
## Content

Cache CI output only when pushing to main. We don't want to pollute
cache with builds of experimental / untrusted code. This also speeds up
CI.

## Pre-submit checklist

- Branch
    - [x] Tests are provided (if possible)
    - [x] Commit sequence broadly makes sense
    - [x] Key commits have useful messages
- PR
    - [x] No clippy warnings in the CI
    - [x] Self-reviewed the diff
    - [x] Useful pull request description
    - [x] Reviewer requested
- Documentation
    - [x] Update README file (if relevant)
    - [x] Update documentation website (if relevant)

## Issue(s)

TODO
  • Loading branch information
tolikzinovyev authored Dec 5, 2024
1 parent fd72f37 commit 254d56b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches: ["main"]
pull_request:

env:
push_main: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,6 +58,7 @@ jobs:
run: cargo doc --no-deps --verbose

- name: Cache Cargo registry
if: ${{ env.push_main == true }}
uses: actions/cache@v3
with:
path: ~/.cargo/registry
Expand All @@ -63,6 +67,7 @@ jobs:
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
if: ${{ env.push_main == true }}
uses: actions/cache@v3
with:
path: target
Expand Down

0 comments on commit 254d56b

Please sign in to comment.