-
Notifications
You must be signed in to change notification settings - Fork 11
196 lines (172 loc) · 6.5 KB
/
ci.yml
File metadata and controls
196 lines (172 loc) · 6.5 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: CI Run
concurrency:
group: pr-ci_${{ github.event.pull_request.number }}
cancel-in-progress: true
on:
push:
branches:
- '*'
tags-ignore:
- v*
pull_request:
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
permissions:
contents: read
pull-requests: read
actions: read
jobs:
check-for-pr:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- name: Check if PR exists for this branch (skip push if PR exists)
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_REF: ${{ github.ref_name }}
run: |
# On push events, base_ref is empty; skip if a PR already exists for this branch
if [ -z "${{ github.base_ref }}" ]; then
prs=$(gh pr list \
--repo "$GITHUB_REPOSITORY" \
--json headRefName \
--jq "[.[] | select(.headRefName == env.HEAD_REF)] | length")
if ((prs > 0)); then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
fi
check-formatting:
runs-on: ubuntu-22.04
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'zulu'
java-version: '21'
- name: Setup OS
run: |
sudo apt-get update
sudo apt-get install -y clang-format-11
# we need this to make sure we are actually using clang-format v. 11
sudo mv /usr/bin/clang-format /usr/bin/clang-format-14
sudo mv /usr/bin/clang-format-11 /usr/bin/clang-format
- name: Cache Gradle Wrapper Binaries
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.gradle/wrapper/dists
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
gradle-wrapper-${{ runner.os }}-
- name: Cache Gradle User Home
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.gradle/caches
key: gradle-caches-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-caches-${{ runner.os }}-
- name: Check
run: |
./gradlew spotlessCheck --no-daemon --parallel --build-cache --no-watch-fs
check-javadoc:
runs-on: ubuntu-22.04
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'zulu'
java-version: '21'
- name: Setup OS
run: |
sudo apt-get update
sudo apt-get install -y curl zip unzip binutils
- name: Cache Gradle Wrapper Binaries
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.gradle/wrapper/dists
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
gradle-wrapper-${{ runner.os }}-
- name: Cache Gradle User Home
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.gradle/caches
key: gradle-caches-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-caches-${{ runner.os }}-
- name: Validate Javadoc
run: |
# Note: javadoc task depends on copyReleaseLibs which requires building native libraries
# This ensures javadoc validation matches the exact conditions used during publishing
./gradlew :ddprof-lib:javadoc --no-daemon --parallel --build-cache --no-watch-fs
compute-configurations:
runs-on: ubuntu-latest
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
outputs:
configurations: ${{ steps.compute.outputs.configurations }}
steps:
- name: Debounce label events
if: github.event.action == 'labeled'
run: |
echo "Waiting 30s to allow adding multiple labels..."
sleep 30
- name: Compute test configurations from PR labels
id: compute
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Always include debug
configs='["debug"'
# For PRs, check labels; for push/workflow_dispatch, use debug only
if [ "${{ github.event_name }}" = "pull_request" ]; then
labels=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} --jq '.labels[].name' 2>/dev/null) || labels=""
if echo "$labels" | grep -Fq "test:release"; then
configs="$configs"',"release"'
fi
if echo "$labels" | grep -Fq "test:asan"; then
configs="$configs"',"asan"'
fi
if echo "$labels" | grep -Fq "test:tsan"; then
configs="$configs"',"tsan"'
fi
fi
configs="$configs]"
echo "configurations=$configs" >> $GITHUB_OUTPUT
echo "Test configurations: $configs"
test-matrix:
needs: [check-for-pr, check-formatting, compute-configurations]
if: needs.check-for-pr.outputs.skip != 'true'
uses: ./.github/workflows/test_workflow.yml
with:
configuration: ${{ needs.compute-configurations.outputs.configurations }}
summarize-tests:
needs: [test-matrix]
if: always() && !cancelled() && github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
actions: read
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Generate test summary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
.github/scripts/generate-test-summary.sh \
"${{ github.run_id }}" \
"test-summary.md"
- name: Post PR comment
uses: ./.github/actions/upsert-pr-comment
with:
body-file: test-summary.md
comment-id: ci-test-results