Skip to content

Commit

Permalink
build: only save CI cache on main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
qdeslandes committed Jan 31, 2025
1 parent 4ec5f07 commit 2de9577
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,23 @@ jobs:
steps:
- name: Checkout bpfilter
uses: actions/checkout@v2
- name: Setup the cache mechanism
uses: actions/cache@v4
if: ${{ matrix.host.arch }} == "x64"
- name: Restore the cached test results
uses: actions/cache/restore@v4
with:
path: build/output/tests
key: tests-results
- name: Configure the build
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
- name: Build
- name: Run unit tests
run: make -C $GITHUB_WORKSPACE/build -j `nproc` test
- name: Build
- name: Run end-to-end tests
run: make -C $GITHUB_WORKSPACE/build -j `nproc` e2e
- name: Cache the test results
uses: actions/cache/save@v4
if: matrix.host.arch == 'x64' && github.ref == 'refs/heads/main'
with:
path: build/output/tests
key: tests-results

benchmark:
needs: create-images
Expand All @@ -146,14 +151,19 @@ jobs:
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Configure the build
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DWITH_BENCHMARK=on
- name: Setup the cache mechanism
uses: actions/cache@v4
if: ${{ matrix.host.arch }} == "x64"
- name: Restore the cached benchmark results
uses: actions/cache/restore@v4
with:
path: build/output/benchmarks
key: benchmarks-results
- name: Build
run: make -C $GITHUB_WORKSPACE/build -j `nproc` benchmark
- name: Cache the benchmark results
uses: actions/cache/save@v4
if: matrix.host.arch == 'x64' && github.ref == 'refs/heads/main'
with:
path: build/output/benchmarks
key: benchmarks-results

doc:
needs: [ test, benchmark ]
Expand Down

0 comments on commit 2de9577

Please sign in to comment.