-
Notifications
You must be signed in to change notification settings - Fork 14
289 lines (256 loc) · 8.25 KB
/
ci.yml
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
name: CI
on:
push:
branches:
- main
- release*
tags:
- '*'
pull_request:
env:
# Error on documentation warnings
SPHINXOPTS: "-W --keep-going"
# This will be empty on events that aren't pull requests.
ACTUAL_GITHUB_SHA_ON_PULL_REQUEST: "${{ github.event.pull_request.head.sha }}"
# TODO(#12, #113): Upgrade to Clang 15, LLVM 15.
#
# See also the matrix of the build job.
#
# NOTE[Clang+LLVM]: If the Clang version outstrips the LLVM version, the tests
# will error - we use Clang to compile test programs, and cclyzer++ must be
# able to read the bitcode it outputs. We currently only run tests with the
# most recent (matching) Clang/LLVM combination.
LLVM_MAJOR_VERSION: "14"
CLANG_VERSION: "14"
UBUNTU_VERSION: "22.04"
UBUNTU_NAME: "jammy"
jobs:
doc:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "doc/"
- uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/build/html
build:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- clang_version: "12"
llvm_version: "10"
ubuntu_version: "20.04"
ubuntu_name: "focal"
- clang_version: "12"
llvm_version: "11"
ubuntu_version: "20.04"
ubuntu_name: "focal"
- clang_version: "12"
llvm_version: "12"
ubuntu_version: "20.04"
ubuntu_name: "focal"
- clang_version: "15"
llvm_version: "13"
ubuntu_version: "22.04"
ubuntu_name: "jammy"
- clang_version: "14"
llvm_version: "14"
ubuntu_version: "22.04"
ubuntu_name: "jammy"
- clang_version: "15"
llvm_version: "15"
ubuntu_version: "22.04"
ubuntu_name: "jammy"
# - clang_version: "16"
# llvm_version: "16"
# ubuntu_version: "22.04"
# ubuntu_name: "jammy"
env:
LLVM_MAJOR_VERSION: ${{ matrix.llvm_version }}
CLANG_VERSION: ${{ matrix.llvm_version }}
UBUNTU_VERSION: ${{ matrix.ubuntu_version }}
UBUNTU_NAME: ${{ matrix.ubuntu_name }}
steps:
- uses: actions/checkout@v3
- name: Login to Packages Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build dev image
run: |
./scripts/gha-docker-build "dev" "cclyzerpp-dev"
- name: Build
continue-on-error: ${{ matrix.llvm_version == 16 }}
run: |
# The `pull_request` event creates a merge commit, which means that
# `GITHUB_SHA` is not want we want: we need to do some additional
# sleuthing for these events to get the right commit.
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake \
-DLLVM_MAJOR_VERSION=${LLVM_MAJOR_VERSION} \
-G Ninja \
-B build \
-S .
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake --build build -j $(nproc)
- name: Upload build log
uses: actions/upload-artifact@v3
if: failure()
with:
name: "cmake-logs"
path: "build/CMakeFiles/*.log"
if-no-files-found: error
- name: Run tests
# See NOTE[Clang+LLVM]
if: ${{ env.LLVM_MAJOR_VERSION == 14 }}
run: |
# See previous comment
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm -v $(pwd):/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
pytest -x -n=$(nproc)
- name: Package
continue-on-error: ${{ matrix.llvm_version == 16 }}
run: |
# See above comment
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake --build build -j $(nproc) --target deb
- name: Build dist image
continue-on-error: ${{ matrix.llvm_version == 16 }}
run: |
./scripts/gha-docker-build "dist" "cclyzerpp-dist"
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Build dev image
run: |
./scripts/gha-docker-build "dev" "cclyzerpp-dev"
- name: Lint
run: |
# See comment above
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCLANG_VERSION=${CLANG_VERSION} \
-DLLVM_MAJOR_VERSION=${LLVM_MAJOR_VERSION} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-G Ninja \
-S . \
-B build
docker run \
--rm \
--env CLANG_VERSION=${CLANG_VERSION} \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
bash scripts/lint.sh
release:
runs-on: ubuntu-22.04
# Build on version tags or release branches
if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release') }}
# Only push Docker images on actual releases
env:
PUSH: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- name: Login to Packages Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push dev image
run: |
./scripts/gha-docker-build "dev" "cclyzerpp-dev"
# TODO(lb): Reduce duplication with build job
- name: Build
run: |
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake -DLLVM_MAJOR_VERSION=${LLVM_MAJOR_VERSION} -G Ninja -B build -S .
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake --build build -j $(nproc)
- name: Package
run: |
# See above comment
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm \
--mount type=bind,src=$PWD,target=/work \
--workdir /work \
"ghcr.io/galoisinc/cclyzerpp-dev:${ref}" \
cmake --build build -j $(nproc) --target deb
- name: Build and push dist image
run: |
./scripts/gha-docker-build "dist" "cclyzerpp-dist"
- uses: ncipollo/release-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
artifacts: "build/*.deb"
body: "See [doc/changelog.rst](https://github.com/GaloisInc/cclyzerpp/blob/main/doc/changelog.rst)."
draft: true
token: ${{ secrets.GITHUB_TOKEN }}