-
-
Notifications
You must be signed in to change notification settings - Fork 385
Expand file tree
/
Copy pathbasic_webserver_build_release.yml
More file actions
276 lines (223 loc) · 9.14 KB
/
Copy pathbasic_webserver_build_release.yml
File metadata and controls
276 lines (223 loc) · 9.14 KB
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
on:
pull_request:
workflow_dispatch:
# this cancels workflows currently in progress if you start a new one
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Do not add permissions here! Configure them at the job level!
permissions: {}
env:
# use .tar.gz for quick testing
ARCHIVE_FORMAT: .tar.gz
RELEASE_TAG: 0.13.0
jobs:
fetch-releases:
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
# get latest nightly releases
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
- name: Save roc_nightly archives
uses: actions/upload-artifact@v4
with:
path: roc_nightly-*
build-linux-x86_64-files:
runs-on: [ubuntu-22.04]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v4
- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v4
- name: build basic-webserver with legacy linker
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
run: ./ci/build_basic_webserver.sh linux_x86_64
- name: Save .rh, .rm and .a file
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-files
path: |
basic-webserver/platform/metadata_linux-x64.rm
basic-webserver/platform/linux-x64.rh
basic-webserver/platform/linux-x64.a
build-linux-arm64-files:
runs-on: [self-hosted, Linux, ARM64]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v4
- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v4
- name: build basic-webserver
env:
CARGO_BUILD_TARGET: aarch64-unknown-linux-musl
run: ./ci/build_basic_webserver.sh linux_arm64
- name: Save .a file
uses: actions/upload-artifact@v4
with:
name: linux-arm64-files
path: |
basic-webserver/platform/linux-arm64.a
build-macos-x86_64-files:
runs-on: [macos-13] # I expect the generated files to work on macOS 13 and up
needs: [fetch-releases]
steps:
- uses: actions/checkout@v4
- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v4
- run: ./ci/build_basic_webserver.sh macos_x86_64
- name: Save .a files
uses: actions/upload-artifact@v4
with:
name: macos-x86_64-files
path: |
basic-webserver/platform/macos-x64.a
build-macos-apple-silicon-files:
name: build apple silicon .a file
runs-on: [self-hosted, macOS, ARM64]
needs: [fetch-releases]
steps:
- uses: actions/checkout@v4
- name: Download the previously uploaded roc_nightly archives
uses: actions/download-artifact@v4
- run: ./ci/build_basic_webserver.sh macos_apple_silicon
- name: Save macos-arm64.a file
uses: actions/upload-artifact@v4
with:
name: macos-apple-silicon-files
path: |
basic-webserver/platform/macos-arm64.a
create-release-archive:
needs:
[
build-linux-x86_64-files,
build-linux-arm64-files,
build-macos-x86_64-files,
build-macos-apple-silicon-files,
]
name: create release archive
runs-on: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: remove all folders except the ci folder
run: ls | grep -v ci | xargs rm -rf
- name: Download the previously uploaded files
uses: actions/download-artifact@v4
- name: mv roc nightly and simplify name
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
- name: decompress the tar
run: tar -xzvf roc_nightly.tar.gz
- name: delete tar
run: rm roc_nightly.tar.gz
- name: rename nightly folder
run: mv roc_nightly* roc_nightly
- run: |
git clone https://github.com/roc-lang/basic-webserver.git
cd basic-webserver
git checkout ${{ env.RELEASE_TAG }}
cd ..
- run: cp macos-apple-silicon-files/* ./basic-webserver/platform
- run: cp linux-x86_64-files/* ./basic-webserver/platform
- run: cp linux-arm64-files/* ./basic-webserver/platform
- run: cp macos-x86_64-files/* ./basic-webserver/platform
- run: ./roc_nightly/roc build --bundle=${{ env.ARCHIVE_FORMAT }} ./basic-webserver/platform/main.roc
- run: echo "TAR_FILENAME=$(ls -d basic-webserver/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
- name: Upload platform archive
uses: actions/upload-artifact@v4
with:
name: basic-webserver-platform
path: |
${{ env.TAR_FILENAME }}
- name: build basic-webserver docs
env:
ROC_DOCS_URL_ROOT: /basic-webserver/${{ env.RELEASE_TAG }}
run: |
./roc_nightly/roc docs ./basic-webserver/platform/main.roc
tar -czvf docs.tar.gz generated-docs/
- name: Upload docs archive
uses: actions/upload-artifact@v4
with:
name: release-assets-docs
path: |
docs.tar.gz
test-release:
needs: [create-release-archive]
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, macos-15]
runs-on: ${{ matrix.os }}
steps:
- name: Download the previously uploaded files
uses: actions/download-artifact@v4
- name: Set OS-specific variables
id: vars
run: |
if [[ "${{ matrix.os }}" =~ ^ubuntu-.*-arm$ ]]; then
echo "os_pattern=linux_arm64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.os }}" =~ ^ubuntu- ]]; then
echo "os_pattern=linux_x86_64" >> $GITHUB_OUTPUT
elif [ "${{ matrix.os }}" = "macos-13" ]; then
echo "os_pattern=macos_x86_64" >> $GITHUB_OUTPUT
else
echo "os_pattern=macos_apple_silicon" >> $GITHUB_OUTPUT
fi
- name: mv roc nightly and simplify name
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "${{ steps.vars.outputs.os_pattern }}") ./roc_nightly.tar.gz
- name: decompress the tar
run: tar -xzvf roc_nightly.tar.gz
- name: delete tar
run: rm roc_nightly.tar.gz
- name: rename nightly folder
run: mv roc_nightly* roc_nightly
- if: contains(env.ARCHIVE_FORMAT, 'gz')
run: |
cd basic-webserver-platform && ls | grep "tar" | xargs tar -xzf
- if: contains(env.ARCHIVE_FORMAT, 'br')
run: |
cd basic-webserver-platform && ls | grep "tar" | xargs brotli -d
ls | grep "tar$" | xargs tar -xf
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt install -y expect ncat ripgrep
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
brew install expect # for tests
brew install nmap # includes ncat server for tcp tests
brew install ripgrep # for ci/check_all_exposed_funs_tested.roc
- name: prepare testing
run: |
mv roc_nightly basic-webserver-platform/.
cd basic-webserver-platform
mkdir platform
# move all files to platform dir
find . -maxdepth 1 -type f -exec mv {} platform/ \;
# move all dirs (except roc_nightly) to platform dir
find . -maxdepth 1 -type d ! -name 'platform' ! -name 'roc_nightly' -exec mv {} platform/ \;
mkdir temp-basic-webserver
cd temp-basic-webserver
git clone https://github.com/roc-lang/basic-webserver.git
cd basic-webserver
git checkout ${{ env.RELEASE_TAG }}
cp -r examples ../..
cp -r tests ../..
cp -r ci ../..
# LICENSE is necessary for command test
cp -r LICENSE ../..
- name: Remove things that dont work on musl
if: startsWith(matrix.os, 'ubuntu-')
run: |
rm basic-webserver-platform/examples/file-accessed-modified-created-time.roc
sed -i.bak -e '/time_accessed!,$/d' -e '/time_modified!,$/d' -e '/time_created!,$/d' -e '/^time_accessed!/,/^$/d' -e '/^time_modified!/,/^$/d' -e '/^time_created!/,/^$/d' -e '/^import Utc exposing \[Utc\]$/d' basic-webserver-platform/platform/File.roc
rm basic-webserver-platform/platform/File.roc.bak
- name: run tests
run: |
# no need to build platform anymore
cd basic-webserver-platform
# This one does not work on musl
rm ci/expect_scripts/file-accessed-modified-created-time.exp
NO_BUILD=1 ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh