Use one machine, store and restore caches #28
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: C3 CI Pipeline | |
| on: [push] | |
| jobs: | |
| noble: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/dairlab/docker-dair/noble-dair-base:v1.42 | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| options: --cpus 4 | |
| steps: | |
| - run: echo "π The job was automatically triggered by a ${{ github.event_name }} event." | |
| - run: echo "π§ This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
| - run: echo "π The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
| - name: Check out repository code | |
| uses: actions/checkout@v4 | |
| - run: echo "π‘ The ${{ github.repository }} repository has been cloned to the runner." | |
| - run: echo "π₯οΈ The workflow is now ready to test your code on the runner." | |
| - name: Install required dependencies | |
| run: apt update && apt install -y clang-format lcov | |
| - name: Checking code formatting ... | |
| run: ./tools/scripts/check_format.sh | |
| - name: Setting correct clang version | |
| run: export CC=clang-15 && export CXX=clang++-15 | |
| - name: Restore build cache | |
| id: c3-build-cache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.cache/bazel | |
| key: c3-noble-bazel-build-cache-${{ github.ref }} | |
| restore-keys: | | |
| c3-noble-bazel-build-cache-${{ github.base_ref }} | |
| - name: Build | |
| run: bazel build | |
| --local_resources=ram=24000 | |
| --local_resources=cpu=4 | |
| --jobs=4 | |
| //... | |
| - name: Test | |
| run: bazel test | |
| --local_resources=ram=24000 | |
| --local_resources=cpu=4 | |
| --jobs=4 | |
| --test_output=all | |
| //... | |
| - name: Test Summary | |
| uses: test-summary/action@v2 | |
| with: | |
| paths: "bazel-testlogs/**/*.xml" | |
| if: always() | |
| - name: Save build cache | |
| id: c3-build-cache-save | |
| if: always() && steps.c3-build-cache-restore.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| key: ${{ steps.c3-build-cache-restore.outputs.cache-primary-key }} | |
| path: ~/.cache/bazel | |
| - name: Restore coverage cache | |
| id: c3-cov-cache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.cache/bazel | |
| key: c3-noble-bazel-cov-cache-${{ github.ref }} | |
| restore-keys: | | |
| c3-noble-bazel-cov-cache-${{ github.base_ref }} | |
| - name: Generate Coverage | |
| run: bazel coverage | |
| --combined_report=lcov | |
| --local_resources=ram=24000 | |
| --local_resources=cpu=4 | |
| --jobs=4 | |
| //... | |
| - name: Report code coverage | |
| uses: zgosalvez/[email protected] | |
| with: | |
| coverage-files: bazel-out/_coverage/_coverage_report.dat | |
| minimum-coverage: 90 | |
| artifact-name: noble-code-coverage-report | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| update-comment: true | |
| - name: Save coverage cache | |
| id: c3-cov-cache-save | |
| if: always() && steps.c3-cov-cache-restore.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| key: ${{ steps.c3-cov-cache-restore.outputs.cache-primary-key }} | |
| path: ~/.cache/bazel | |
| - run: echo "π This job's status is ${{ job.status }}." |