1+ name : CI/CD
2+
3+ on :
4+ - push
5+ - workflow_dispatch
6+
7+ jobs :
8+ build-runtime-linux :
9+ runs-on : ubuntu-latest
10+ container :
11+ image : debian:buster # use an older Debian version to support older glibc versions
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v3
15+ - name : Install ASPL installer dependencies
16+ run : |
17+ apt-get update
18+ apt-get install --quiet -y git jq curl unzip
19+ - name : Install ASPL
20+ run : |
21+ cd $GITHUB_WORKSPACE
22+ ./install_ci.sh
23+ - name : Install runtime dependencies
24+ run : |
25+ apt-get update
26+ apt-get install --quiet -y build-essential
27+ apt-get install --quiet -y libglfw3-dev libxi-dev libxcursor-dev # for the graphics module
28+ apt-get install --quiet -y gcc-arm-linux-gnueabi # for ARM32 cross-compilation
29+ apt-get install --quiet -y lib32z1 # for ARM32 cross-compilation
30+ - name : Build ASPL runtime templates
31+ run : |
32+ cd $GITHUB_WORKSPACE
33+ aspl -os linux -cc gcc build-minimal-template
34+ mv -f Template templates/linux/x86_64/minimal
35+ aspl -os linux -cc gcc build-full-template
36+ mv -f Template templates/linux/x86_64/full
37+ # aspl -os linux -arch arm32 -cc arm-linux-gnueabi-gcc build-minimal-template
38+ # mv -f Template templates/linux/arm32/minimal
39+ # aspl -os linux -arch arm32 -cc arm-linux-gnueabi-gcc build-full-template
40+ # mv -f Template templates/linux/arm32/full
41+ - name : Upload template artifact (Linux x86_64 minimal)
42+ uses : actions/upload-artifact@v3
43+ with :
44+ name : template_linux_x86_64_minimal
45+ path : templates/linux/x86_64/minimal/Template
46+ - name : Upload template artifact (Linux x86_64 full)
47+ uses : actions/upload-artifact@v3
48+ with :
49+ name : template_linux_x86_64_full
50+ path : templates/linux/x86_64/full/Template
51+ build-runtime-windows :
52+ runs-on : windows-latest
53+ steps :
54+ - name : Checkout
55+ uses : actions/checkout@v3
56+ - name : Install ASPL
57+ run : |
58+ cd $GITHUB_WORKSPACE
59+ .\install.bat
60+ shell : cmd
61+ - name : Build ASPL runtime templates
62+ run : |
63+ cd $GITHUB_WORKSPACE
64+ aspl -os windows -cc gcc build-minimal-template
65+ mv -f Template.exe templates/windows/x86_64/minimal
66+ aspl -os windows -cc gcc build-full-template
67+ mv -f Template.exe templates/windows/x86_64/full/cli
68+ shell : cmd
69+ - name : Upload template artifact (Windows x86_64 minimal)
70+ uses : actions/upload-artifact@v3
71+ with :
72+ name : template_windows_x86_64_minimal
73+ path : templates/windows/x86_64/minimal/Template.exe
74+ - name : Upload template artifact (Windows x86_64 full)
75+ uses : actions/upload-artifact@v3
76+ with :
77+ name : template_windows_x86_64_full
78+ path : templates/windows/x86_64/full/cli/Template.exe
79+ build-runtime-macos :
80+ runs-on : macos-13
81+ steps :
82+ - name : Checkout
83+ uses : actions/checkout@v3
84+ - name : Install ASPL
85+ run : |
86+ cd $GITHUB_WORKSPACE
87+ ./install_ci.sh
88+ - name : Install runtime dependencies
89+ run : |
90+ brew install glfw # for the graphics module
91+ - name : Build ASPL runtime templates
92+ run : |
93+ cd $GITHUB_WORKSPACE
94+ aspl -os macos -cc gcc build-minimal-template
95+ mv -f Template templates/macos/x86_64/minimal
96+ aspl -os macos -cc gcc build-full-template
97+ mv -f Template templates/macos/x86_64/full
98+ - name : Upload template artifact (macOS x86_64 minimal)
99+ uses : actions/upload-artifact@v3
100+ with :
101+ name : template_macos_x86_64_minimal
102+ path : templates/macos/x86_64/minimal/Template
103+ - name : Upload template artifact (macOS x86_64 full)
104+ uses : actions/upload-artifact@v3
105+ with :
106+ name : template_macos_x86_64_full
107+ path : templates/macos/x86_64/full/Template
108+ build-compiler :
109+ runs-on : ubuntu-latest
110+ container :
111+ image : debian:buster # use an older Debian version to support older glibc versions
112+ needs : [build-runtime-linux, build-runtime-windows, build-runtime-macos]
113+ steps :
114+ - name : Checkout
115+ uses : actions/checkout@v3
116+ - name : Install ASPL installer dependencies
117+ run : |
118+ apt-get update
119+ apt-get install --quiet -y git jq curl unzip xz-utils build-essential
120+ - name : Install ASPL
121+ run : |
122+ cd $GITHUB_WORKSPACE
123+ ./install_ci.sh
124+ # - name: Delete template (macOS x86_64)
125+ # run: |
126+ # rm templates/macos/x86_64/Template
127+ - name : Download template artifact (macOS x86_64 full)
128+ uses : actions/download-artifact@v3
129+ with :
130+ name : template_macos_x86_64_full
131+ path : templates/macos/x86_64/full
132+ - name : Setup Zig
133+ uses : goto-bus-stop/setup-zig@v2
134+ - name : Build ASPL compiler
135+ run : |
136+ cd $GITHUB_WORKSPACE
137+ cd cli
138+ ../aspl -prod -os linux -backend c -heapBased -useDynamicCTemplate -cc gcc -showcc compile . # use GCC as it tends to optimize better
139+ mv cli ../aspl_linux_x86_64
140+ # ../aspl -prod -os linux -arch arm32 -backend c -heapBased -useDynamicCTemplate compile .
141+ # mv cli ../aspl_linux_arm32
142+ ../aspl -prod -os windows -backend c -heapBased -useDynamicCTemplate -showcc compile .
143+ mv cli.exe ../aspl_windows_x86_64.exe
144+ ../aspl -prod -os macos -backend ail compile .
145+ mv cli ../aspl_macos_x86_64
146+ # TODO: Build for more platforms
147+ - name : Upload ASPL compiler artifact (Linux x86_64)
148+ uses : actions/upload-artifact@v3
149+ with :
150+ name : aspl_linux_x86_64
151+ path : aspl_linux_x86_64
152+ - name : Upload ASPL compiler artifact (Windows x86_64)
153+ uses : actions/upload-artifact@v3
154+ with :
155+ name : aspl_windows_x86_64
156+ path : aspl_windows_x86_64.exe
157+ - name : Upload ASPL compiler artifact (macOS x86_64)
158+ uses : actions/upload-artifact@v3
159+ with :
160+ name : aspl_macos_x86_64
161+ path : aspl_macos_x86_64
162+ publish :
163+ runs-on : ubuntu-latest
164+ needs : [build-runtime-linux, build-runtime-windows, build-runtime-macos, build-compiler]
165+ steps :
166+ - name : Delete template (Linux x86_64 minimal)
167+ run : |
168+ rm -rf templates/linux/x86_64/minimal/Template
169+ - name : Download template artifact (Linux x86_64 minimal)
170+ uses : actions/download-artifact@v3
171+ with :
172+ name : template_linux_x86_64_minimal
173+ path : templates/linux/x86_64/minimal
174+ - name : Delete template artifact (Linux x86_64 minimal)
175+ uses : geekyeggo/delete-artifact@v2
176+ with :
177+ name : template_linux_x86_64_minimal
178+ - name : Delete template (Linux x86_64 full)
179+ run : |
180+ rm -rf templates/linux/x86_64/full/Template
181+ - name : Download template artifact (Linux x86_64 full)
182+ uses : actions/download-artifact@v3
183+ with :
184+ name : template_linux_x86_64_full
185+ path : templates/linux/x86_64/full
186+ - name : Delete template artifact (Linux x86_64 full)
187+ uses : geekyeggo/delete-artifact@v2
188+ with :
189+ name : template_linux_x86_64_full
190+ - name : Delete template (Windows x86_64 minimal)
191+ run : |
192+ rm -rf templates/windows/x86_64/minimal/Template.exe
193+ - name : Download template artifact (Windows x86_64 minimal)
194+ uses : actions/download-artifact@v3
195+ with :
196+ name : template_windows_x86_64_minimal
197+ path : templates/windows/x86_64/minimal
198+ - name : Delete template artifact (Windows x86_64 minimal)
199+ uses : geekyeggo/delete-artifact@v2
200+ with :
201+ name : template_windows_x86_64_minimal
202+ - name : Delete template (Windows x86_64 full)
203+ run : |
204+ rm -rf templates/windows/x86_64/full/cli/Template.exe
205+ - name : Download template artifact (Windows x86_64 full)
206+ uses : actions/download-artifact@v3
207+ with :
208+ name : template_windows_x86_64_full
209+ path : templates/windows/x86_64/full/cli
210+ - name : Delete template artifact (Windows x86_64 full)
211+ uses : geekyeggo/delete-artifact@v2
212+ with :
213+ name : template_windows_x86_64_full
214+ - name : Delete template (macOS x86_64 minimal)
215+ run : |
216+ rm -rf templates/macos/x86_64/minimal/Template
217+ - name : Download template artifact (macOS x86_64 minimal)
218+ uses : actions/download-artifact@v3
219+ with :
220+ name : template_macos_x86_64_minimal
221+ path : templates/macos/x86_64/minimal
222+ - name : Delete template artifact (macOS x86_64 minimal)
223+ uses : geekyeggo/delete-artifact@v2
224+ with :
225+ name : template_macos_x86_64_minimal
226+ - name : Delete template (macOS x86_64 full)
227+ run : |
228+ rm -rf templates/macos/x86_64/full/Template
229+ - name : Download template artifact (macOS x86_64 full)
230+ uses : actions/download-artifact@v3
231+ with :
232+ name : template_macos_x86_64_full
233+ path : templates/macos/x86_64/full
234+ - name : Delete template artifact (macOS x86_64 full)
235+ uses : geekyeggo/delete-artifact@v2
236+ with :
237+ name : template_macos_x86_64_full
238+ - name : Download ASPL compiler artifact (Linux x86_64)
239+ uses : actions/download-artifact@v3
240+ with :
241+ name : aspl_linux_x86_64
242+ path : ./
243+ - name : Delete ASPL compiler artifact (Linux x86_64)
244+ uses : geekyeggo/delete-artifact@v2
245+ with :
246+ name : aspl_linux_x86_64
247+ - name : Download ASPL compiler artifact (Windows x86_64)
248+ uses : actions/download-artifact@v3
249+ with :
250+ name : aspl_windows_x86_64
251+ path : ./
252+ - name : Delete ASPL compiler artifact (Windows x86_64)
253+ uses : geekyeggo/delete-artifact@v2
254+ with :
255+ name : aspl_windows_x86_64
256+ - name : Download ASPL compiler artifact (macOS x86_64)
257+ uses : actions/download-artifact@v3
258+ with :
259+ name : aspl_macos_x86_64
260+ path : ./
261+ - name : Delete ASPL compiler artifact (macOS x86_64)
262+ uses : geekyeggo/delete-artifact@v2
263+ with :
264+ name : aspl_macos_x86_64
265+ - name : Zip templates
266+ run : |
267+ cd $GITHUB_WORKSPACE
268+ zip -r templates.zip templates -x '.gitignore' -x '*.md'
269+ - name : Release
270+ uses : softprops/action-gh-release@v1
271+ with :
272+ repository : aspl-lang/cd
273+ tag_name : SHA-${{ github.sha }}
274+ token : ${{ secrets.CDKEY }}
275+ files : |
276+ ${{ github.workspace }}/aspl_linux_x86_64
277+ ${{ github.workspace }}/aspl_windows_x86_64.exe
278+ ${{ github.workspace }}/aspl_macos_x86_64
279+ ${{ github.workspace }}/templates.zip
280+ # ${{ github.workspace }}/aspl_linux_arm32
281+ - name : Update metadata file
282+ run : |
283+ curl \
284+ -X PUT\
285+ -H "Authorization: token ${{ secrets.CDKEY }}"\
286+ -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"}}'\
287+ https://api.github.com/repos/aspl-lang/cd/contents/latest.txt
288+ ci :
289+ runs-on : ubuntu-latest
290+ needs : [publish]
291+ steps :
292+ - name : Checkout
293+ uses : actions/checkout@v3
294+ - name : Install ASPL
295+ run : |
296+ $GITHUB_WORKSPACE/install_ci.sh
297+ - name : Run tests
298+ run : |
299+ cd $GITHUB_WORKSPACE
300+ echo "Testing the C backend..."
301+ ./aspl -backend c -cc gcc -showcc test-all || exit $?
302+ echo "Testing the AIL backend..."
303+ ./aspl -backend ail -cc gcc -showcc test-all || exit $?
0 commit comments