-
Notifications
You must be signed in to change notification settings - Fork 4
228 lines (206 loc) · 7.79 KB
/
pure.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
# This is a basic workflow to help you get started with Actions
name: CI
on:
push:
branches:
- master
paths:
- '**.sml'
- 'Holmakefile'
- '**.hs'
- '**.c'
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * Fri'
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
container: ubuntu:latest
timeout-minutes: 600
env:
HOLDIR: ${{ github.workspace }}/HOL
CAKEMLDIR: ${{ github.workspace }}/cakeml
LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
outputs:
hol_sha: ${{ steps.shas.outputs.HOL_SHA }}
cakeml_sha: ${{ steps.shas.outputs.CAKEML_SHA }}
hol_short_sha: ${{ steps.shas.outputs.HOL_SHORT_SHA }}
cakeml_short_sha: ${{ steps.shas.outputs.CAKEML_SHORT_SHA }}
steps:
- name: Update PATH
run: echo "$HOLDIR/bin" >> $GITHUB_PATH
- name: Get build-essentials
run: |
apt update
apt install -y git build-essential gcc libffi-dev wget mlton
- name: Checkout Poly/ML
uses: actions/checkout@v4
with:
repository: polyml/polyml
ref: fixes-5.9
path: polyml
- name: Build Poly/ML
run: |
cd polyml
./configure
make
make install
- name: Checkout HOL4
uses: actions/checkout@v4
with:
repository: HOL-Theorem-Prover/HOL
ref: master
path: HOL
- name: Checkout pure
uses: actions/checkout@v4
with:
path: pure
- name: Checkout CakeML
uses: actions/checkout@v4
with:
repository: CakeML/CakeML
path: cakeml
- name: Record HOL/CakeML checkouts
id: shas
run: |
cd $HOLDIR
echo "HOL_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "HOL_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
cd $CAKEMLDIR
echo "CAKEML_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "CAKEML_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build HOL4
run: |
cd $HOLDIR
poly < tools/smart-configure.sml
bin/build
- name: Build CakeML misc
run: cd $CAKEMLDIR/misc && Holmake
- name: Build CakeML semantics
run: cd $CAKEMLDIR/semantics && Holmake
- name: Build CakeML semantics/proofs
run: cd $CAKEMLDIR/semantics/proofs && Holmake
- name: Build CakeML semantics/alt_semantics
run: cd $CAKEMLDIR/semantics/alt_semantics && Holmake
- name: Build CakeML semantics/alt_semantics/proofs
run: cd $CAKEMLDIR/semantics/alt_semantics/proofs && Holmake
- name: Build CakeML basis/pure
run: cd $CAKEMLDIR/basis/pure && Holmake
- name: Build misc
run: cd pure/misc && Holmake
- name: Build language
run: cd pure/language && Holmake
- name: Build meta-theory
run: cd pure/meta-theory && Holmake
- name: Build compiler/backend
run: cd pure/compiler/backend && Holmake
- name: Build compiler/backend/languages
run: cd pure/compiler/backend/languages && Holmake
- name: Build compiler/backend/languages/semantics
run: cd pure/compiler/backend/languages/semantics && Holmake
- name: Build compiler/backend/languages/properties
run: cd pure/compiler/backend/languages/properties && Holmake
- name: Build typing
run: cd pure/typing && Holmake
- name: Build compiler/backend/passes
run: cd pure/compiler/backend/passes && Holmake
- name: Build compiler/backend/passes/proofs
run: cd pure/compiler/backend/passes/proofs && Holmake
- name: Build compiler/backend/languages/relations
run: cd pure/compiler/backend/languages/relations && Holmake
- name: Build compiler/parsing
run: cd pure/compiler/parsing && Holmake
- name: Build compiler
run: cd pure/compiler && Holmake
- name: Build CakeML compiler/backend/proofs
run: cd $CAKEMLDIR/compiler/backend/proofs && Holmake
- name: Build compiler/proofs
run: cd pure/compiler/proofs && Holmake
- name: Build compiler/binary
run: cd pure/compiler/binary && Holmake
- name: Save build artifact
uses: actions/upload-artifact@v4
with:
name: pure.S
path: pure/compiler/binary/pure.S
- name: Build examples
run: cd pure/examples && make check
- name: Check that benchmarks compile
run: |
apt install -y python3 python3-parse python3-matplotlib python3-pandas
cd pure/examples
git apply benchmark/benchmark.patch
touch lib/basis_ffi.c
cd benchmark && ./benchmark.py --mode compile
release:
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
container: ubuntu:latest
env:
COMMITS: ${{ github.workspace }}/commits.txt
steps:
- name: Install GitHub CLI
run: |
apt update && apt install -y curl
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
apt update && apt install -y gh
- name: Create release tag and release notes
run: |
echo "VERSION=v$(date +'%Y.%m.%d')" >> $GITHUB_ENV
echo "HOL checkout: HOL-Theorem-Prover/HOL@${{ needs.build.outputs.hol_sha }}" >> $COMMITS
echo "CakeML checkout: CakeML/CakeML@${{ needs.build.outputs.cakeml_sha }}" >> $COMMITS
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: pure.S
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ env.VERSION }} --repo cakeml/pure --latest --notes-file $COMMITS pure.S
rm -f pure.S $COMMITS
notify:
needs: build
runs-on: ubuntu-latest
container: ubuntu:latest
if: ${{ always() }}
steps:
- name: Get curl
run: apt update && apt install -y curl
- name: Notify CakeML Discord
run: >
curl --silent --show-error --request POST
--header "Content-type: application/json;charset=utf-8"
--data '{"embeds": [{
"title": "PureCake CI #${{ github.run_number }}: ${{ needs.build.result }}",
"description": "${{ env.DESCRIPTION }}",
"url": "https://github.com/CakeML/pure/actions/runs/${{ github.run_id }}",
"color": ${{ needs.build.result == 'success' && 8311585 || 13632027 }},
"fields": [
{"name": "HOL commit", "inline": true,
"value": "[${{ needs.build.outputs.hol_short_sha }}](https://github.com/HOL-Theorem-Prover/HOL/commit/${{ needs.build.outputs.hol_sha }})"},
{"name": "CakeML commit", "inline": true,
"value": "[${{ needs.build.outputs.cakeml_short_sha }}](https://github.com/CakeML/cakeml/commit/${{ needs.build.outputs.cakeml_sha }})"}]
}]}'
${{ secrets.DISCORD_WEBHOOK }}
env:
DESCRIPTION: |-
${{
github.event_name == 'workflow_dispatch' &&
format('Manually triggered by {0}', github.event.sender.login)
|| github.event_name == 'pull_request' &&
format('[Pull request #{0}](https://github.com/CakeML/pure/pull/{0})', github.event.number)
|| github.event_name == 'push' &&
format('Push by {0}', github.event.pusher.username || github.event.pusher.name)
|| github.event_name == 'schedule' &&
'Weekly scheduled run'
|| 'Unknown trigger'
}}