-
Notifications
You must be signed in to change notification settings - Fork 2
322 lines (320 loc) · 12.3 KB
/
ci_cd.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: CI/CD
on:
- push
- workflow_dispatch
jobs:
build-runtime-linux:
runs-on: ubuntu-latest
container:
image: debian:buster # use an older Debian version to support older glibc versions
steps:
- name: Install Git
run: |
apt-get update
apt-get install --quiet -y git
- name: Checkout
uses: actions/checkout@v3
- name: Install ASPL installer dependencies
run: |
apt-get update
apt-get install --quiet -y sudo jq curl unzip
- name: Install ASPL
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd $GITHUB_WORKSPACE
chown -R $(whoami) . # TODO: Why is this needed?
./install.sh
- name: Install runtime dependencies
run: |
apt-get update
apt-get install --quiet -y build-essential
apt-get install --quiet -y libglfw3-dev libxi-dev libxcursor-dev # for the graphics module
apt-get install --quiet -y gcc-arm-linux-gnueabi # for ARM32 cross-compilation
apt-get install --quiet -y lib32z1 # for ARM32 cross-compilation
- name: Build ASPL runtime templates
run: |
cd $GITHUB_WORKSPACE
aspl -os linux -cc gcc build-minimal-template
mv -f Template templates/linux/x86_64/minimal
aspl -os linux -cc gcc build-full-template
mv -f Template templates/linux/x86_64/full
# aspl -os linux -arch arm32 -cc arm-linux-gnueabi-gcc build-minimal-template
# mv -f Template templates/linux/arm32/minimal
# aspl -os linux -arch arm32 -cc arm-linux-gnueabi-gcc build-full-template
# mv -f Template templates/linux/arm32/full
- name: Upload template artifact (Linux x86_64 minimal)
uses: actions/upload-artifact@v3
with:
name: template_linux_x86_64_minimal
path: templates/linux/x86_64/minimal/Template
- name: Upload template artifact (Linux x86_64 full)
uses: actions/upload-artifact@v3
with:
name: template_linux_x86_64_full
path: templates/linux/x86_64/full/Template
build-runtime-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install ASPL
run: |
cd $GITHUB_WORKSPACE
.\install.bat
shell: cmd
- name: Build ASPL runtime templates
run: |
cd $GITHUB_WORKSPACE
aspl -os windows -cc gcc build-minimal-template
mv -f Template.exe templates/windows/x86_64/minimal
aspl -os windows -cc gcc build-full-template
mv -f Template.exe templates/windows/x86_64/full/cli
shell: cmd
- name: Upload template artifact (Windows x86_64 minimal)
uses: actions/upload-artifact@v3
with:
name: template_windows_x86_64_minimal
path: templates/windows/x86_64/minimal/Template.exe
- name: Upload template artifact (Windows x86_64 full)
uses: actions/upload-artifact@v3
with:
name: template_windows_x86_64_full
path: templates/windows/x86_64/full/cli/Template.exe
build-runtime-macos:
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install ASPL
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd $GITHUB_WORKSPACE
./install.sh
- name: Install runtime dependencies
run: |
brew install glfw # for the graphics module
- name: Build ASPL runtime templates
run: |
cd $GITHUB_WORKSPACE
aspl -os macos -cc gcc build-minimal-template
mv -f Template templates/macos/x86_64/minimal
aspl -os macos -cc gcc build-full-template
mv -f Template templates/macos/x86_64/full
- name: Upload template artifact (macOS x86_64 minimal)
uses: actions/upload-artifact@v3
with:
name: template_macos_x86_64_minimal
path: templates/macos/x86_64/minimal/Template
- name: Upload template artifact (macOS x86_64 full)
uses: actions/upload-artifact@v3
with:
name: template_macos_x86_64_full
path: templates/macos/x86_64/full/Template
build-compiler:
runs-on: ubuntu-latest
container:
image: debian:buster # use an older Debian version to support older glibc versions
needs: [build-runtime-linux, build-runtime-windows, build-runtime-macos]
steps:
- name: Install Git
run: |
apt-get update
apt-get install --quiet -y git
- name: Checkout
uses: actions/checkout@v3
- name: Install ASPL installer dependencies
run: |
apt-get update
apt-get install --quiet -y sudo jq curl unzip xz-utils build-essential
- name: Install ASPL
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd $GITHUB_WORKSPACE
chown -R $(whoami) . # TODO: Why is this needed?
./install.sh
# - name: Delete template (macOS x86_64)
# run: |
# rm templates/macos/x86_64/Template
- name: Download template artifact (macOS x86_64 full)
uses: actions/download-artifact@v3
with:
name: template_macos_x86_64_full
path: templates/macos/x86_64/full
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
- name: Build ASPL compiler
run: |
cd $GITHUB_WORKSPACE
cd cli
../aspl -prod -os linux -backend c -heapBased -useDynamicCTemplate -cc gcc -showcc compile . # use GCC as it tends to optimize better
mv cli ../aspl_linux_x86_64
# ../aspl -prod -os linux -arch arm32 -backend c -heapBased -useDynamicCTemplate compile .
# mv cli ../aspl_linux_arm32
../aspl -prod -os windows -backend c -heapBased -useDynamicCTemplate -showcc compile .
mv cli.exe ../aspl_windows_x86_64.exe
../aspl -prod -os macos -backend ail compile .
mv cli ../aspl_macos_x86_64
# TODO: Build for more platforms
- name: Upload ASPL compiler artifact (Linux x86_64)
uses: actions/upload-artifact@v3
with:
name: aspl_linux_x86_64
path: aspl_linux_x86_64
- name: Upload ASPL compiler artifact (Windows x86_64)
uses: actions/upload-artifact@v3
with:
name: aspl_windows_x86_64
path: aspl_windows_x86_64.exe
- name: Upload ASPL compiler artifact (macOS x86_64)
uses: actions/upload-artifact@v3
with:
name: aspl_macos_x86_64
path: aspl_macos_x86_64
publish:
runs-on: ubuntu-latest
needs: [build-runtime-linux, build-runtime-windows, build-runtime-macos, build-compiler]
steps:
- name: Delete template (Linux x86_64 minimal)
run: |
rm -rf templates/linux/x86_64/minimal/Template
- name: Download template artifact (Linux x86_64 minimal)
uses: actions/download-artifact@v3
with:
name: template_linux_x86_64_minimal
path: templates/linux/x86_64/minimal
- name: Delete template artifact (Linux x86_64 minimal)
uses: geekyeggo/delete-artifact@v2
with:
name: template_linux_x86_64_minimal
- name: Delete template (Linux x86_64 full)
run: |
rm -rf templates/linux/x86_64/full/Template
- name: Download template artifact (Linux x86_64 full)
uses: actions/download-artifact@v3
with:
name: template_linux_x86_64_full
path: templates/linux/x86_64/full
- name: Delete template artifact (Linux x86_64 full)
uses: geekyeggo/delete-artifact@v2
with:
name: template_linux_x86_64_full
- name: Delete template (Windows x86_64 minimal)
run: |
rm -rf templates/windows/x86_64/minimal/Template.exe
- name: Download template artifact (Windows x86_64 minimal)
uses: actions/download-artifact@v3
with:
name: template_windows_x86_64_minimal
path: templates/windows/x86_64/minimal
- name: Delete template artifact (Windows x86_64 minimal)
uses: geekyeggo/delete-artifact@v2
with:
name: template_windows_x86_64_minimal
- name: Delete template (Windows x86_64 full)
run: |
rm -rf templates/windows/x86_64/full/cli/Template.exe
- name: Download template artifact (Windows x86_64 full)
uses: actions/download-artifact@v3
with:
name: template_windows_x86_64_full
path: templates/windows/x86_64/full/cli
- name: Delete template artifact (Windows x86_64 full)
uses: geekyeggo/delete-artifact@v2
with:
name: template_windows_x86_64_full
- name: Delete template (macOS x86_64 minimal)
run: |
rm -rf templates/macos/x86_64/minimal/Template
- name: Download template artifact (macOS x86_64 minimal)
uses: actions/download-artifact@v3
with:
name: template_macos_x86_64_minimal
path: templates/macos/x86_64/minimal
- name: Delete template artifact (macOS x86_64 minimal)
uses: geekyeggo/delete-artifact@v2
with:
name: template_macos_x86_64_minimal
- name: Delete template (macOS x86_64 full)
run: |
rm -rf templates/macos/x86_64/full/Template
- name: Download template artifact (macOS x86_64 full)
uses: actions/download-artifact@v3
with:
name: template_macos_x86_64_full
path: templates/macos/x86_64/full
- name: Delete template artifact (macOS x86_64 full)
uses: geekyeggo/delete-artifact@v2
with:
name: template_macos_x86_64_full
- name: Download ASPL compiler artifact (Linux x86_64)
uses: actions/download-artifact@v3
with:
name: aspl_linux_x86_64
path: ./
- name: Delete ASPL compiler artifact (Linux x86_64)
uses: geekyeggo/delete-artifact@v2
with:
name: aspl_linux_x86_64
- name: Download ASPL compiler artifact (Windows x86_64)
uses: actions/download-artifact@v3
with:
name: aspl_windows_x86_64
path: ./
- name: Delete ASPL compiler artifact (Windows x86_64)
uses: geekyeggo/delete-artifact@v2
with:
name: aspl_windows_x86_64
- name: Download ASPL compiler artifact (macOS x86_64)
uses: actions/download-artifact@v3
with:
name: aspl_macos_x86_64
path: ./
- name: Delete ASPL compiler artifact (macOS x86_64)
uses: geekyeggo/delete-artifact@v2
with:
name: aspl_macos_x86_64
- name: Zip templates
run: |
cd $GITHUB_WORKSPACE
zip -r templates.zip templates -x '.gitignore' -x '*.md'
- name: Release
uses: softprops/action-gh-release@v1
with:
repository: aspl-lang/cd
tag_name: SHA-${{ github.sha }}
token: ${{ secrets.CDKEY }}
files: |
${{ github.workspace }}/aspl_linux_x86_64
${{ github.workspace }}/aspl_windows_x86_64.exe
${{ github.workspace }}/aspl_macos_x86_64
${{ github.workspace }}/templates.zip
# ${{ github.workspace }}/aspl_linux_arm32
- name: Update metadata file
run: |
curl \
-X PUT\
-H "Authorization: token ${{ secrets.CDKEY }}"\
-d '{"message": "Update latest.txt", "content": "'$(echo ${{ github.sha }} | base64)'", "sha": "'$(curl -s -H "Authorization: token ${{ secrets.CDKEY }}" https://api.github.com/repos/aspl-lang/cd/contents/latest.txt | jq -r .sha)'", "committer": {"name": "github-actions[bot]", "email": "github-actions[bot]@users.noreply.github.com"}}'\
https://api.github.com/repos/aspl-lang/cd/contents/latest.txt
ci:
runs-on: ubuntu-latest
needs: [publish]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install ASPL
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd $GITHUB_WORKSPACE
./install.sh
- name: Run tests
run: |
cd $GITHUB_WORKSPACE
echo "Testing the C backend..."
./aspl -backend c -cc gcc -showcc test-all || exit $?
echo "Testing the AIL backend..."
./aspl -backend ail -cc gcc -showcc test-all || exit $?