-
Notifications
You must be signed in to change notification settings - Fork 242
181 lines (154 loc) · 5.24 KB
/
analysis.yml
File metadata and controls
181 lines (154 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Analysis
on:
push:
branches:
- main
pull_request:
branches:
- main
- 'release/**'
- 'develop/**'
paths-ignore:
- "docs/**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CTEST_OUTPUT_ON_FAILURE: 1
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_MAXSIZE: 1.25G
CCACHE_KEY_SUFFIX: r2
ACTS_LOG_FAILURE_THRESHOLD: WARNING
# NOTE this only builds core unittests to reduce the output size. if we
# found a way to have Github actions not fail regularly with this job
# all unit tests should be reactivated.
jobs:
build_debug:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2404:85
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/dependencies
with:
compiler: g++
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
env_file: .env
- name: Save PR metadata
if: github.event_name == 'pull_request'
run: |
# Shallow clone: parent commits aren't available via git,
# but GitHub provides the SHAs through the event context.
printf '{"pr_number":"%s","pr_sha":"%s","base_sha":"%s","merge_sha":"%s"}\n' \
"${{ github.event.number }}" \
"${{ github.event.pull_request.head.sha }}" \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.sha }}" \
> PR_metadata.json
cat PR_metadata.json
- name: Persist PR metadata
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: PR_metadata
path: PR_metadata.json
- name: Cache build
uses: actions/cache@v5
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-${{ github.sha }}
restore-keys: |
ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-
- name: Configure
run: >
ccache -z &&
CI/dependencies/run.sh .env
cmake -B build -S . --preset=github-ci-coverage
- name: Build
run: cmake --build build
- name: ccache stats
run: ccache -s
- name: Unit tests
run: >
CI/dependencies/run.sh .env
ctest --test-dir build -j$(nproc)
- name: Remove .o files
run: >
du -sh build
&& find build -name *.o -delete
&& du -sh build
- name: Coverage
run: |
uv run --no-project CI/test_coverage.py build --filter
- uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-build
path: |
build/compile_commands.json
build/coverage/cov.xml
- uses: actions/upload-artifact@v7
if: always()
id: artifact-upload-step
with:
name: coverage-html
path: build/coverage/html
- name: Coverage display
run: |
base_link='https://acts-herald.app.cern.ch/view/${{ github.repository }}/${{ steps.artifact-upload-step.outputs.artifact-id }}'
link="$base_link/index.html"
echo "🛡️ Code coverage available at: $link"
echo "**🛡️ Code coverage available [here]($link)**" >> $GITHUB_STEP_SUMMARY
clang_tidy:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2404_clang22:85
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Mark workspace as safe
run: git config --global --add safe.directory /__w/acts/acts
- name: Fetch base branch
if: github.event_name == 'pull_request'
run: git fetch origin "${{ github.base_ref }}"
- uses: astral-sh/setup-uv@v7
- name: Install clang-tidy
run: |
apt-get update && apt-get install -y clang-tidy-22
ln -sf /usr/bin/clang-tidy-22 /usr/bin/clang-tidy
ln -sf /usr/bin/clang++-22 /usr/bin/clang++
ln -sf /usr/bin/clang-22 /usr/bin/clang
- name: Install dependencies
uses: ./.github/actions/dependencies
with:
compiler: clang++
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
env_file: .env
- name: Configure
run: >
ccache -z &&
CI/dependencies/run.sh .env
cmake -B build -S .
--preset=gitlab-ci-clangtidy
- name: Run codegen
run: cmake --build build --target ActsCodegen
- name: Analyze (PR - changed files only)
if: github.event_name == 'pull_request'
run: >
uv run CI/clang_tidy/run_clang_tidy_pr.py
analyze build fixes.yml --base-ref "origin/${{ github.base_ref }}"
- name: Analyze (push - all files)
if: github.event_name == 'push'
run: >
uv run CI/clang_tidy/run_clang_tidy_pr.py
analyze build fixes.yml --all
- name: Upload fixes
if: always()
uses: actions/upload-artifact@v7
with:
name: clang-tidy-fixes
path: fixes.yml
- name: Annotate
run: >
uv run CI/clang_tidy/run_clang_tidy_pr.py
annotate fixes.yml