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

build: only save CI cache on main branch #202

Merged
merged 1 commit into from
Jan 31, 2025
Merged
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
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