Skip to content

Commit 1475f9d

Browse files
committed
CI ccache
1 parent 5854adf commit 1475f9d

1 file changed

Lines changed: 124 additions & 120 deletions

File tree

.github/workflows/tests.yml

Lines changed: 124 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -5,114 +5,111 @@ on: [ push, pull_request ]
55
permissions:
66
contents: read # to fetch code (actions/checkout)
77

8-
# env:
9-
# CCACHE_DIR: "${{ github.workspace }}/.ccache"
10-
118
concurrency:
129
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1310
cancel-in-progress: true
1411

1512
jobs:
16-
coverage:
17-
name: Release + Coverage ${{ matrix.runs-on }}
18-
runs-on: ${{ matrix.runs-on }}
19-
strategy:
20-
fail-fast: false
21-
matrix:
22-
runs-on: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
23-
steps:
24-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25-
- uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
26-
with:
27-
pixi-version: v0.76.2
28-
cache: true
29-
cache-key: coverage-v3-
30-
environments: coverage
31-
log-level: vvv
32-
# - name: Prepare compiler cache
33-
# id: prep-ccache
34-
# shell: bash
35-
# run: |
36-
# mkdir -p "${CCACHE_DIR}"
37-
# echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
38-
# NOW=$(date -u +"%F-%T")
39-
# echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
40-
# - name: Setup compiler cache
41-
# uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
42-
# id: cache-ccache
43-
# with:
44-
# path: ${{ steps.prep-ccache.outputs.dir }}
45-
# key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
46-
# restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
47-
- name: Determine number of workers
48-
run: |
49-
if [[ "$RUNNER_OS" == "Linux" ]]; then
50-
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
51-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
52-
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
53-
fi
54-
shell: bash
55-
- name: Run tests
56-
run: pixi run --environment=coverage tests $NUM_WORKERS
57-
- name: Generate coverage report
58-
run: pixi run --skip-deps coverage
59-
- name: Upload HTML coverage report
60-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
61-
with:
62-
name: cov-html-${{ matrix.runs-on }}
63-
path: .pixi/envs/coverage/share/xsf/cov/coverage_report/**
64-
# - name: Ccache performance
65-
# shell: bash -l {0}
66-
# run: pixi run ccache -s
13+
# coverage:
14+
# name: Release + Coverage ${{ matrix.runs-on }}
15+
# runs-on: ${{ matrix.runs-on }}
16+
# strategy:
17+
# fail-fast: false
18+
# matrix:
19+
# runs-on: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
20+
# steps:
21+
# - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22+
# - uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
23+
# with:
24+
# pixi-version: v0.76.2
25+
# cache: true
26+
# cache-key: coverage-v3-
27+
# environments: coverage
28+
# log-level: vvv
29+
# # - name: Prepare compiler cache
30+
# # id: prep-ccache
31+
# # shell: bash
32+
# # run: |
33+
# # mkdir -p "${CCACHE_DIR}"
34+
# # echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
35+
# # NOW=$(date -u +"%F-%T")
36+
# # echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
37+
# # - name: Setup compiler cache
38+
# # uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
39+
# # id: cache-ccache
40+
# # with:
41+
# # path: ${{ steps.prep-ccache.outputs.dir }}
42+
# # key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
43+
# # restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
44+
# - name: Determine number of workers
45+
# run: |
46+
# if [[ "$RUNNER_OS" == "Linux" ]]; then
47+
# echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
48+
# elif [[ "$RUNNER_OS" == "macOS" ]]; then
49+
# echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
50+
# fi
51+
# shell: bash
52+
# - name: Run tests
53+
# run: pixi run --environment=coverage tests $NUM_WORKERS
54+
# - name: Generate coverage report
55+
# run: pixi run --skip-deps coverage
56+
# - name: Upload HTML coverage report
57+
# uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
58+
# with:
59+
# name: cov-html-${{ matrix.runs-on }}
60+
# path: .pixi/envs/coverage/share/xsf/cov/coverage_report/**
61+
# # - name: Ccache performance
62+
# # shell: bash -l {0}
63+
# # run: pixi run ccache -s
6764

68-
tests-release:
69-
# for platforms without coverage support
70-
name: Release
71-
runs-on: ${{ matrix.runs-on }}
72-
strategy:
73-
fail-fast: false
74-
matrix:
75-
runs-on: [windows-latest]
76-
environment: [tests-release]
77-
steps:
78-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
79-
- uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
80-
with:
81-
pixi-version: v0.76.2
82-
cache: true
83-
cache-key: release-v3-
84-
environments: ${{ matrix.environment }}
85-
log-level: vvv
86-
# - name: Prepare compiler cache
87-
# id: prep-ccache
88-
# shell: bash
89-
# run: |
90-
# mkdir -p "${CCACHE_DIR}"
91-
# echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
92-
# NOW=$(date -u +"%F-%T")
93-
# echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
94-
# - name: Setup compiler cache
95-
# uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
96-
# id: cache-ccache
97-
# with:
98-
# path: ${{ steps.prep-ccache.outputs.dir }}
99-
# key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
100-
# restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
101-
- name: Determine number of workers
102-
run: |
103-
if [[ "$RUNNER_OS" == "Linux" ]]; then
104-
echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
105-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
106-
echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
107-
elif [[ "$RUNNER_OS" == "Windows" ]]; then
108-
echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
109-
fi
110-
shell: bash
111-
- name: Run tests
112-
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
113-
# - name: Ccache performance
114-
# shell: bash -l {0}
115-
# run: pixi run ccache -s
65+
# tests-release:
66+
# # for platforms without coverage support
67+
# name: Release
68+
# runs-on: ${{ matrix.runs-on }}
69+
# strategy:
70+
# fail-fast: false
71+
# matrix:
72+
# runs-on: [windows-latest]
73+
# environment: [tests-release]
74+
# steps:
75+
# - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
76+
# - uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
77+
# with:
78+
# pixi-version: v0.76.2
79+
# cache: true
80+
# cache-key: release-v3-
81+
# environments: ${{ matrix.environment }}
82+
# log-level: vvv
83+
# # - name: Prepare compiler cache
84+
# # id: prep-ccache
85+
# # shell: bash
86+
# # run: |
87+
# # mkdir -p "${CCACHE_DIR}"
88+
# # echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
89+
# # NOW=$(date -u +"%F-%T")
90+
# # echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
91+
# # - name: Setup compiler cache
92+
# # uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
93+
# # id: cache-ccache
94+
# # with:
95+
# # path: ${{ steps.prep-ccache.outputs.dir }}
96+
# # key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-${{ steps.prep-ccache.outputs.timestamp }}
97+
# # restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-release-
98+
# - name: Determine number of workers
99+
# run: |
100+
# if [[ "$RUNNER_OS" == "Linux" ]]; then
101+
# echo "NUM_WORKERS=$(nproc)" >> $GITHUB_ENV
102+
# elif [[ "$RUNNER_OS" == "macOS" ]]; then
103+
# echo "NUM_WORKERS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
104+
# elif [[ "$RUNNER_OS" == "Windows" ]]; then
105+
# echo "NUM_WORKERS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
106+
# fi
107+
# shell: bash
108+
# - name: Run tests
109+
# run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
110+
# # - name: Ccache performance
111+
# # shell: bash -l {0}
112+
# # run: pixi run ccache -s
116113

117114
tests-debug:
118115
name: Debug ${{ matrix.runs-on }}
@@ -122,30 +119,40 @@ jobs:
122119
matrix:
123120
runs-on: [ubuntu-latest, ubuntu-24.04-arm]
124121
environment: [tests-debug]
122+
env:
123+
CCACHE_DIR: ${{ github.workspace }}/packages/tests-debug/.ccache
125124
steps:
126125
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
126+
- name: Prepare compiler cache
127+
id: prep-ccache
128+
shell: bash
129+
run: |
130+
mkdir -p "${CCACHE_DIR}"
131+
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
132+
NOW=$(date -u +"%F-%T")
133+
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
134+
- name: Setup compiler cache
135+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
136+
id: cache-ccache
137+
with:
138+
path: ${{ steps.prep-ccache.outputs.dir }}
139+
key: v5-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-${{ steps.prep-ccache.outputs.timestamp }}
140+
restore-keys: v5-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-
141+
- name: Reset ccache stats
142+
shell: bash
143+
run: |
144+
# Restoring the cache also restored the stats from the previous run
145+
pixi exec ccache --zero-stats
127146
- uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
128147
with:
129148
pixi-version: v0.76.2
130149
cache: true
131150
cache-key: tests-debug-v3-
132151
environments: ${{ matrix.environment }}
133152
log-level: vvv
134-
# - name: Prepare compiler cache
135-
# id: prep-ccache
136-
# shell: bash
137-
# run: |
138-
# mkdir -p "${CCACHE_DIR}"
139-
# echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
140-
# NOW=$(date -u +"%F-%T")
141-
# echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
142-
# - name: Setup compiler cache
143-
# uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
144-
# id: cache-ccache
145-
# with:
146-
# path: ${{ steps.prep-ccache.outputs.dir }}
147-
# key: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-${{ steps.prep-ccache.outputs.timestamp }}
148-
# restore-keys: v4-${{ github.workflow }}-ccache-${{ matrix.runs-on }}-debug-
153+
- name: Ccache performance
154+
shell: bash
155+
run: pixi exec ccache -s
149156
- name: Determine number of workers
150157
run: |
151158
if [[ "$RUNNER_OS" == "Linux" ]]; then
@@ -158,6 +165,3 @@ jobs:
158165
shell: bash
159166
- name: Run tests
160167
run: pixi run --environment=${{ matrix.environment }} tests $NUM_WORKERS
161-
# - name: Ccache performance
162-
# shell: bash -l {0}
163-
# run: pixi run ccache -s

0 commit comments

Comments
 (0)