-
Notifications
You must be signed in to change notification settings - Fork 6
232 lines (204 loc) · 6.66 KB
/
ci-deptycheck.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
---
name: DepTyCheck
on:
push:
branches:
- main
- master
- 'debug-ci/**'
tags:
- '**'
pull_request:
branches:
- main
- master
schedule:
# We want to run in the beginning of the day, right after the `pack` collection is built at the end of the previous day.
- cron: '0 1 * * *'
permissions: read-all
concurrency:
group: ${{ github.workflow }}@${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
pack_dir_file: pack-dir.tar
# TODO to reduce duplication, e.g. by using https://docs.github.com/en/actions/using-workflows/reusing-workflows
jobs:
################
# Preparations #
################
prepare-pack:
name: Prepare `pack`
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
steps:
- uses: actions/checkout@v4
- run: pack update-db
- name: Switch to appropriate `pack` collection
run: pack switch "$( if [[ '${{ github.event_name }}' == 'schedule' ]]; then echo HEAD; else ./.pack-collection; fi )"
- run: ./.patch-chez-gc-handler idris2
- name: Tar the `pack` dir
run: .github/tar -cvf "${{ env.pack_dir_file }}" --exclude=".cache" "$PACK_DIR"
- name: Save state of `pack`
uses: actions/upload-artifact@v4
with:
name: pack-dir
path: ${{ env.pack_dir_file }}
thirdparties-build:
name: Build thirdparties
needs: prepare-pack
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
steps:
- uses: actions/checkout@v4
- name: Restore state of `pack`
uses: actions/download-artifact@v4
with:
name: pack-dir
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack install-deps deptycheck
- run: pack install summary-stat # for distr tests
# TODO to compute test dependencies when we have special mini-test libs
- name: Tar the `pack` dir
run: .github/tar -uvf "${{ env.pack_dir_file }}" --exclude=".cache" "$PACK_DIR"
- name: Save built thirdparties
uses: actions/upload-artifact@v4
with:
name: built-thirdparties
path: ${{ env.pack_dir_file }}
############################
# Build DepTyCheck library #
############################
deptycheck-build-lib:
name: Build the lib
needs:
- prepare-pack
- thirdparties-build
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
steps:
- uses: actions/checkout@v4
- name: Restore built thirdparties
uses: actions/download-artifact@v4
with:
name: built-thirdparties
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack build deptycheck
- run: pack install deptycheck
- name: Tar the `pack` dir
run: .github/tar -uvf "${{ env.pack_dir_file }}" --exclude=".cache" "$PACK_DIR"
- name: Tar built TTC files
run: find "$(pwd)" -name '*.tt[cm]' | .github/tar -uvf "${{ env.pack_dir_file }}" --files-from /dev/stdin
- name: Save built DepTyCheck
uses: actions/upload-artifact@v4
with:
name: built-deptycheck
path: ${{ env.pack_dir_file }}
#######$###################
# Build DepTyCheck's docs #
########$##################
deptycheck-build-docs:
name: Build the docs
runs-on: ubuntu-latest
container: sphinxdoc/sphinx:latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pip3 install -r docs/requirements.txt
- run: alias sh=bash
# - run: pack build docs # `pack` is unaccessible here, thus:
- run: cd docs && eval "$(grep prebuild docs.ipkg | sed 's/.*"\(.*\)"/\1/')"
###################
# Test DepTyCheck #
###################
get-test-sets:
name: Acquire test sets
needs:
- deptycheck-build-lib
runs-on: ubuntu-latest
outputs:
test-sets: ${{ steps.get-test-sets.outputs.test-sets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get test sets
id: get-test-sets
run: |
(
echo -n "test-sets=["
find tests/ -type f,l -name run | grep -v '/_' | \
sed -e 's|^tests/|"|' -e 's|\(.*\)distribution/\([^-]*\)-[^/]*/run|\1distribution/\2"|' -e 's|/[^/]*/run$|"|' | \
sort | uniq | awk 'ORS=", "' | head -c -2
echo "]"
) >> "$GITHUB_OUTPUT"
deptycheck-test:
name: Test the lib
needs:
- prepare-pack
- deptycheck-build-lib
- get-test-sets
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
strategy:
fail-fast: false # all test cases are more or less independent
matrix:
test_set: ${{ fromJSON(needs.get-test-sets.outputs.test-sets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore built DepTyCheck
uses: actions/download-artifact@v4
with:
name: built-deptycheck
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack test deptycheck "${{matrix.test_set}}"
#################
# Test examples #
#################
get-examples:
name: Acquire examples
needs:
- deptycheck-build-lib
runs-on: ubuntu-latest
outputs:
examples: ${{ steps.get-examples.outputs.examples }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get examples
id: get-examples
run: |
(
echo -n "examples=["
find examples/ -mindepth 1 -maxdepth 1 -type d | \
sed 's|^examples/|"|' | sed 's|$|"|' | \
sort | uniq | awk 'ORS=", "' | head -c -2
echo "]"
) >> "$GITHUB_OUTPUT"
examples-build:
name: Build and test examples
needs:
- prepare-pack
- deptycheck-build-lib
- get-examples
runs-on: ubuntu-latest
container: ghcr.io/stefan-hoeck/idris2-pack:latest
strategy:
fail-fast: false # all test cases are more or less independent
matrix:
example: ${{ fromJSON(needs.get-examples.outputs.examples) }}
steps:
- uses: actions/checkout@v4
- name: Restore built DepTyCheck
uses: actions/download-artifact@v4
with:
name: built-deptycheck
- name: Untar the `pack` dir
run: .github/tar -xvf "${{ env.pack_dir_file }}" --one-top-level=/ --touch
- run: pack build "${{matrix.example}}"
- run: pack test "${{matrix.example}}"