-
Notifications
You must be signed in to change notification settings - Fork 6
274 lines (266 loc) · 9.08 KB
/
main.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
name: CI
on:
push:
branches:
- master
pull_request: {}
jobs:
macos:
runs-on: macos-12
# NB: https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
strategy:
matrix:
tsv:
- target: cpp_stl
subtarget: _98
implementation: clang14
- target: cpp_stl
subtarget: _11
implementation: clang14
env:
TARGET: ${{matrix.tsv.target}}
SUBTARGET: ${{matrix.tsv.subtarget}}
IMPL: ${{matrix.tsv.implementation}}
steps:
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: prepare
run: |
git clone https://github.com/kaitai-io/kaitai_struct_tests tests
ln -s ../compiled tests/compiled
./prepare-$TARGET
# Ideally, we'd like to get URL for GH Action down to job ID level,
# and for that we could use Tiryoh/[email protected]. However,
# as of v0.1.2, it's a Docker-based action, so it won't run on anything
# but Linux. The way forward is to rewrite it to be JavaScript-based
# (see https://github.com/Tiryoh/gha-jobid-action/issues/10), but until
# this is resolved, we have no GH_JOB_ID, and we approximate GH_HTML_URL
# down to RUN_ID level.
- name: run
env:
GH_JOB_ID: unknown
run: |
export GH_HTML_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "GH_HTML_URL=$GH_HTML_URL"
cd tests
./ci-$TARGET$SUBTARGET
- name: publish
env:
BOT_SSH_KEY: ${{secrets.BOT_SSH_KEY}}
run: |
./push_artifacts/git_config_kaitai_bot
./push_artifacts/publish \
-o kaitai-io \
-r ci_artifacts \
-m "Build results of ${GITHUB_REF#refs/heads/*} kaitai-io/ci_targets@$GITHUB_SHA" \
-b "${TARGET}${SUBTARGET}"/"$IMPL-macos-x86_64" \
-- --exclude=.git --exclude=.travis.yml tests/test_out
linux:
runs-on: ubuntu-latest
strategy:
matrix:
tsv:
- target: csharp
implementation: netcore2.2.103
dotnet: 2.2.103
- target: csharp
implementation: netcore3.0.100
dotnet: 3.0.100
env:
TARGET: ${{matrix.tsv.target}}
SUBTARGET: ${{matrix.tsv.subtarget}}
IMPL: ${{matrix.tsv.implementation}}
steps:
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{matrix.tsv.dotnet}}
if: matrix.tsv.dotnet
- uses: nuget/setup-nuget@v1
with:
nuget-version: '5.x'
if: matrix.tsv.dotnet
- name: GitHub Actions job_id parser
uses: Tiryoh/[email protected]
id: job_info
with:
github_token: ${{github.token}}
job_name: ${{ format('{0} ({1}, {2}, {3})', github.job, matrix.tsv.target, matrix.tsv.variety, matrix.tsv.dotnet) }}
- name: prepare
run: |
git clone https://github.com/kaitai-io/kaitai_struct_tests tests
ln -s ../compiled tests/compiled
./prepare-$TARGET
- name: run
env:
GH_JOB_ID: ${{steps.job_info.outputs.job_id}}
GH_HTML_URL: ${{steps.job_info.outputs.html_url}}
run: |
cd tests
./ci-$TARGET
cd ..
- name: publish
env:
BOT_SSH_KEY: ${{secrets.BOT_SSH_KEY}}
run: |
./push_artifacts/git_config_kaitai_bot
./push_artifacts/publish \
-o kaitai-io \
-r ci_artifacts \
-m "Build results of ${GITHUB_REF#refs/heads/*} kaitai-io/ci_targets@$GITHUB_SHA" \
-b "${TARGET}${SUBTARGET}"/"$IMPL-linux-x86_64" \
-- --exclude=.git --exclude=.travis.yml tests/test_out
docker:
runs-on: ubuntu-latest
strategy:
matrix:
tsv:
- target: cpp_stl
subtarget: _98
implementation: clang3.4
- target: cpp_stl
subtarget: _11
implementation: clang3.4
- target: cpp_stl
subtarget: _98
implementation: clang11
- target: cpp_stl
subtarget: _11
implementation: clang11
- target: cpp_stl
subtarget: _98
implementation: gcc4.8
- target: cpp_stl
subtarget: _11
implementation: gcc4.8
- target: cpp_stl
subtarget: _98
implementation: gcc11
# - target: cpp_stl
# subtarget: _11
# implementation: gcc11
- target: construct
implementation: python2.7
- target: construct
implementation: python3.4
- target: construct
implementation: python3.11
- target: graphviz
implementation: 8
- target: go
implementation: 1.19
- target: java
implementation: zulu7
- target: java
implementation: temurin8
- target: java
implementation: temurin11
- target: java
implementation: temurin17
- target: javascript
implementation: nodejs4
- target: javascript
implementation: nodejs8
- target: javascript
implementation: nodejs10
- target: javascript
implementation: nodejs12
- target: javascript
implementation: nodejs18
- target: lua
implementation: 5.3
- target: nim
implementation: 1.6.0
- target: perl
implementation: 5.24
- target: perl
implementation: 5.38
- target: php
implementation: 7.1
- target: php
implementation: 8.2
- target: python
implementation: 2.7
- target: python
implementation: 3.4
- target: python
implementation: 3.11
- target: ruby
implementation: 1.9
- target: ruby
implementation: 2.3
- target: ruby
implementation: 3.2
env:
TARGET: ${{matrix.tsv.target}}
SUBTARGET: ${{matrix.tsv.subtarget}}
IMPL: ${{matrix.tsv.implementation}}
steps:
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: docker pull
run: |
docker pull ghcr.io/kaitai-io/kaitai-"$TARGET"-"$IMPL"-linux-x86_64
- name: download tests
run: |
git clone https://github.com/kaitai-io/kaitai_struct_tests tests
cp -r compiled tests/compiled
- name: download runtime
run: |
mkdir -p runtime
git clone https://github.com/kaitai-io/kaitai_struct_${{matrix.tsv.target}}_runtime runtime/${{matrix.tsv.target}}
if: matrix.tsv.target != 'construct' && matrix.tsv.target != 'graphviz'
# Two different job_id parsers: for 3 values (with subtarget being non-empty) and for 2 values (with subtarget being empty)
- name: job_id parser 3
uses: Tiryoh/[email protected]
id: job_info3
with:
github_token: ${{github.token}}
job_name: ${{ format('{0} ({1}, {2}, {3})', github.job, matrix.tsv.target, matrix.tsv.subtarget, matrix.tsv.implementation) }}
if: matrix.tsv.subtarget != ''
- name: job_id parser 2
uses: Tiryoh/[email protected]
id: job_info2
with:
github_token: ${{github.token}}
job_name: ${{ format('{0} ({1}, {2})', github.job, matrix.tsv.target, matrix.tsv.implementation) }}
if: matrix.tsv.subtarget == ''
- name: run tests
env:
GH_JOB_ID: ${{steps.job_info3.outputs.job_id || steps.job_info2.outputs.job_id}}
GH_HTML_URL: ${{steps.job_info3.outputs.html_url || steps.job_info2.outputs.html_url}}
run: |
cd tests
./docker-ci -t "$TARGET" -u "$SUBTARGET" -i "$IMPL"
# - name: publish as artifact
# uses: actions/upload-artifact@v3
# with:
# name: test-${{matrix.tsv.target}}${{matrix.tsv.subtarget}}-${{matrix.tsv.implementation}}
# path: tests/test_out
- name: publish
env:
BOT_SSH_KEY: ${{secrets.BOT_SSH_KEY}}
run: |
./push_artifacts/git_config_kaitai_bot
./push_artifacts/publish \
-o kaitai-io \
-r ci_artifacts \
-m "Build results of ${GITHUB_REF#refs/heads/*} kaitai-io/ci_targets@$GITHUB_SHA" \
-b "${TARGET}${SUBTARGET}"/"$IMPL-linux-x86_64" \
-- --exclude=.git --exclude=.travis.yml tests/test_out