Skip to content

Commit f789e97

Browse files
committed
workflows: use ccache to speed up code coverage
ccache requires the build paths, e.g., for include directories to be identical in order to reuse the cache between the two builds. Setting the CCACHE_BASEDIR environment variable to the respective build directory does not seem to have any effect and does not reuse the cache. Signed-off-by: Peter Colberg <peter.colberg@intel.com> (cherry picked from commit 17d8f6b)
1 parent 82410a3 commit f789e97

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

.github/workflows/coverage.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33

44
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
55

6-
name: delta coverage checks
6+
name: code coverage
77

88
permissions:
9-
# Grant read permissions to repository in case it is not a forked public
10-
# repository, but a private repository that was created manually.
11-
contents: read
12-
139
# Grant read permissions to private container images.
1410
packages: read
1511

@@ -32,43 +28,46 @@ on:
3228

3329
jobs:
3430
build:
35-
runs-on: ubuntu-20.04
31+
runs-on: ubuntu-22.04
3632

3733
container:
38-
image: ghcr.io/intel/fpga-runtime-for-opencl/ubuntu-20.04-dev:main
39-
40-
env:
41-
TMP_DIR: /home/build
34+
image: ghcr.io/intel/fpga-runtime-for-opencl/ubuntu-22.04-dev:main
4235

4336
steps:
4437
- name: checkout main branch
4538
uses: actions/checkout@v3
4639
with:
4740
ref: ${{ github.base_ref }}
48-
49-
- name: create build directories
50-
run: mkdir "$TMP_DIR/child_build" "$TMP_DIR/parent_build"
41+
42+
- name: create build directory
43+
run: mkdir build
5144

5245
- name: create parent build files
53-
run: cd "$TMP_DIR/parent_build" && cmake -G Ninja "$GITHUB_WORKSPACE" -DCMAKE_BUILD_TYPE=Debug -DACL_CODE_COVERAGE=ON
46+
run: cd build && cmake -G Ninja "$GITHUB_WORKSPACE" -DCMAKE_BUILD_TYPE=Debug -DACL_CODE_COVERAGE=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
5447

5548
- name: build parent runtime
56-
run: cd "$TMP_DIR/parent_build" && ninja -v -k0
49+
run: cd build && ninja -v -k0
5750

5851
- name: parent runtime coverage scan
59-
run: cd "$TMP_DIR/parent_build" && ctest -T Test -T Coverage
52+
run: cd build && ctest -T Test -T Coverage
53+
54+
- name: save build directory for later comparison
55+
run: mv -t "$RUNNER_TEMP" build
6056

6157
- name: checkout current branch
6258
uses: actions/checkout@v3
6359

60+
- name: create build directory
61+
run: mkdir build
62+
6463
- name: create child build files
65-
run: cd "$TMP_DIR/child_build" && cmake -G Ninja "$GITHUB_WORKSPACE" -DCMAKE_BUILD_TYPE=Debug -DACL_CODE_COVERAGE=ON
64+
run: cd build && cmake -G Ninja "$GITHUB_WORKSPACE" -DCMAKE_BUILD_TYPE=Debug -DACL_CODE_COVERAGE=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
6665

6766
- name: build child runtime
68-
run: cd "$TMP_DIR/child_build" && ninja -v -k0
67+
run: cd build && ninja -v -k0
6968

7069
- name: child runtime coverage scan
71-
run: cd "$TMP_DIR/child_build" && ctest -T Test -T Coverage
70+
run: cd build && ctest -T Test -T Coverage
7271

7372
- name: coverage status
74-
run: ./scripts/coverage_diff.py "$TMP_DIR/child_build" "$TMP_DIR/parent_build"
73+
run: ./scripts/coverage_diff.py build "$RUNNER_TEMP"/build

0 commit comments

Comments
 (0)