-
Notifications
You must be signed in to change notification settings - Fork 38
244 lines (244 loc) · 8 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
name: CI
on:
push:
branches: [ master, dev ]
pull_request:
branches:
- '**'
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
tidy:
name: Enforce Tidyness
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq rename python3-sphinx
- run: ./ci/test_tidy.sh
test-macos-tidy:
name: Test Tidy Enforcement on macOS
runs-on: macos-11
steps:
- uses: actions/checkout@v4
with:
# sometimes checkout action doesn't result in clean directory?
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.ref }}
submodules: 'recursive'
- run: git status --ignored
- run: brew install coreutils findutils gnu-sed gawk grep rename sphinx-doc
# adapted from https://stackoverflow.com/a/42878119
- run: brew link sphinx-doc --force
# updates PATH to use Homebrew-installed tools first
# see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
- run: echo "/usr/local/bin:$PATH" > $GITHUB_PATH
- run: echo $PATH
- run: ./ci/test_tidy.sh
test:
name: Tests
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
cxx: [clang++, g++]
test-set:
- test-native-regular
- test-native-fulldebug
- test-native-opt
- test-examples
- test-demos
# - test-cookiecutter
env:
CXX: ${{ matrix.cxx }}
TEST_SET: ${{ matrix.test-set }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- name: Set up clang
uses: egor-tensin/setup-clang@v1
with:
version: 15
- run: sudo apt-get update -qq
- run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb
- run: git fetch origin master:refs/remotes/origin/master
- run: make install-test-dependencies
- run: ${CXX} --version
- run: |
source third-party/emsdk/emsdk_env.sh
make ${TEST_SET} CXX=${CXX}
test-web:
name: Web Tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb
- run: make install-test-dependencies
- name: Run headless test
uses: GabrielBB/xvfb-action@v1
with:
run: make test-web
test-coverage:
name: Measure Test Coverage
runs-on: ubuntu-22.04
steps:
- name: Set up clang
uses: egor-tensin/setup-clang@v1
with:
version: 15
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- run: sudo apt-get update -qq
- run: sudo apt-get install cmake build-essential python3-virtualenv python3-pip nodejs tar gzip clang llvm-dev libclang-dev
- run: git fetch origin master:refs/remotes/origin/master
- run: make install-test-dependencies
- run: export CXX=clang++ && make install-coverage-dependencies
- run: export CXX=clang++ && make coverage
- run: curl -s https://codecov.io/bash | bash
# adapted from https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action
build-container:
name: Build Docker Image
runs-on: ubuntu-22.04
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Log in to GitHub Container Registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=raw,value=ACTIONS_BUILD_${{ github.run_number }}
- name: Push to GHCR
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
test-documentation:
name: Test Documentation Build
runs-on: ubuntu-22.04
needs: build-container
container:
image: ghcr.io/devosoft/empirical:ACTIONS_BUILD_${{ github.run_number }}
# github actions requires root to access mounted volumes
options: --user root
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- run: doxygen
- run: cd doc && python make_md.py
- run: cd doc && make html | ./headtail.sh
- run: cd doc && make coverage
- run: ls doc/ && ls doc/_build
- run: cd doc && python parse_documentation_coverage.py _build/doc-coverage.json >> doc-coverage.json
- uses: actions/upload-artifact@v2
with:
name: doc-coverage
path: doc/doc-coverage.json
- uses: actions/upload-artifact@v2
with:
name: documentation-html
path: doc/_build/html
deploy-to-gh-pages:
name: Deploy Documentation to GitHub Pages
runs-on: ubuntu-22.04
needs: test-documentation
# if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: documentation-html
path: doc/_build/html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/_build/html
deploy-documentation-coverage:
name: Deploy Documentation Coverage
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/master'
needs: test-documentation
steps:
- uses: actions/download-artifact@v2
with:
name: doc-coverage
path: data
- uses: sylvanld/action-storage@v1
with:
src: data/doc-coverage.json
dst: data/doc-coverage.json
deploy-container:
name: Deploy to DockerHub and ghcr.io
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
if: github.ref == 'refs/heads/master'
needs:
- tidy
- test
- test-web
- test-coverage
- test-documentation
- test-macos-tidy
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
push: true
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: devosoft/empirical
tag_with_ref: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to ghcr.io
uses: docker/build-push-action@v1
with:
context: .
push: true
repository: ghcr.io/devosoft/empirical
tag_with_ref: true