-
Notifications
You must be signed in to change notification settings - Fork 3
279 lines (250 loc) · 8.98 KB
/
Copy pathnightly.yml
File metadata and controls
279 lines (250 loc) · 8.98 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
277
278
279
name: Nightly build
on:
schedule:
# Run at 00:00 UTC every day
- cron: '0 0 * * *'
workflow_dispatch:
# Allow manual trigger from Actions tab
permissions:
contents: write
jobs:
tag-and-build:
name: Tag nightly and build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact: basic-linux
archive: basic-linux.tar.gz
outdir: linux
bin: basic
build_gfx: true
- os: macos-latest
artifact: basic-macos
archive: basic-macos.tar.gz
outdir: mac
bin: basic
build_gfx: true
- os: windows-latest
artifact: basic-windows
archive: basic-windows.zip
outdir: windows
bin: basic.exe
build_gfx: true
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Update nightly tag
if: runner.os == 'Linux'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f nightly
git push -f origin nightly
- name: Install raylib (Linux)
if: runner.os == 'Linux' && matrix.build_gfx
run: |
set -e
sudo apt-get update
if sudo apt-get install -y libraylib-dev; then
echo "Installed libraylib-dev from apt"
else
echo "libraylib-dev not available; building raylib from source"
sudo apt-get install -y build-essential cmake git pkg-config \
libasound2-dev libx11-dev libxrandr-dev libxi-dev \
libxinerama-dev libxcursor-dev libgl1-mesa-dev libglu1-mesa-dev
git clone --depth 1 https://github.com/raysan5/raylib.git /tmp/raylib
cmake -S /tmp/raylib -B /tmp/raylib/build -DBUILD_SHARED_LIBS=ON
cmake --build /tmp/raylib/build --config Release
sudo cmake --install /tmp/raylib/build
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/raylib.conf
sudo ldconfig
fi
- name: Install raylib (macOS)
if: runner.os == 'macOS' && matrix.build_gfx
run: |
set -e
export HOMEBREW_NO_AUTO_UPDATE=1
brew install raylib
- name: Build (Unix)
if: runner.os != 'Windows'
run: |
make
if [ "${{ matrix.build_gfx }}" = "true" ]; then
make basic-gfx
fi
- name: Run trek demo (piped)
if: runner.os != 'Windows'
run: |
set -e
sh tests/trek_test.sh >/dev/null
- name: Run tests (Unix)
if: runner.os != 'Windows'
run: |
set -e
for t in tests/*.bas; do
case "$(basename "$t")" in
codes-replaced.bas|locate.bas|get_input_loop.bas|get_while_test.bas|kbuffer.bas|border_option_test.bas|gfx_title_test.bas)
echo "Skipping interactive/GET/GFX-only test $t"
continue
;;
meta_include_dup_line.bas|meta_include_dup_label.bas|meta_include_circular_a.bas|meta_include_circular_b.bas)
echo "Skipping expected-fail meta test $t"
continue
;;
esac
echo "Running $t"
./basic -petscii "$t" >/dev/null
done
- name: Setup MSYS2 (Windows, for raylib)
if: runner.os == 'Windows' && matrix.build_gfx
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-make
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-raylib
- name: Build (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
set -e
mingw32-make
if [ "${{ matrix.build_gfx }}" = "true" ]; then
mingw32-make basic-gfx
fi
- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
set -e
for t in tests/*.bas; do
case "$(basename "$t")" in
codes-replaced.bas|locate.bas|get_input_loop.bas|get_while_test.bas|kbuffer.bas|border_option_test.bas|gfx_title_test.bas)
echo "Skipping interactive/GET/GFX-only test $t"
continue
;;
meta_include_dup_line.bas|meta_include_dup_label.bas|meta_include_circular_a.bas|meta_include_circular_b.bas)
echo "Skipping expected-fail meta test $t"
continue
;;
esac
echo "Running $t"
./basic.exe -petscii "$t" >/dev/null
done
- name: Package artifact (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p out/${{ matrix.outdir }}
cp ${{ matrix.bin }} out/${{ matrix.outdir }}/basic
if [ "${{ matrix.build_gfx }}" = "true" ] && [ -f basic-gfx ]; then
cp basic-gfx out/${{ matrix.outdir }}/basic-gfx
fi
cp -r examples out/${{ matrix.outdir }}/
cd out
tar czf ${{ matrix.archive }} ${{ matrix.outdir }}
- name: Package artifact (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
mkdir -p out/${{ matrix.outdir }}
cp ${{ matrix.bin }} out/${{ matrix.outdir }}/basic.exe
if [ "${{ matrix.build_gfx }}" = "true" ] && [ -f basic-gfx.exe ]; then
cp basic-gfx.exe out/${{ matrix.outdir }}/basic-gfx.exe
# Bundle raylib and its dependencies so basic-gfx.exe runs without MSYS2
for dll in libraylib.dll glfw3.dll; do
[ -f /mingw64/bin/$dll ] && cp /mingw64/bin/$dll out/${{ matrix.outdir }}/
done
fi
cp -r examples out/${{ matrix.outdir }}/
cd out
powershell -Command "Compress-Archive -Path '${{ matrix.outdir }}' -DestinationPath '${{ matrix.archive }}'"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: out/${{ matrix.archive }}
wasm:
name: Web / WASM build + browser test
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 1
- name: Install Emscripten (emsdk)
run: |
sudo apt-get update
sudo apt-get install -y python3 git
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$GITHUB_WORKSPACE/emsdk"
cd "$GITHUB_WORKSPACE/emsdk"
./emsdk install latest
./emsdk activate latest
- name: Build WASM
run: |
source "$GITHUB_WORKSPACE/emsdk/emsdk_env.sh"
emcc --version
make basic-wasm basic-wasm-modular basic-wasm-canvas
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Playwright
run: |
pip install -r tests/requirements-wasm.txt
python -m playwright install chromium --with-deps
- name: Run WASM browser smoke tests
run: |
python3 tests/wasm_browser_test.py
python3 tests/wasm_browser_canvas_test.py
python3 tests/wasm_tutorial_embed_test.py
- name: Package WASM artifact
run: |
mkdir -p out/wasm
cp web/basic.js web/basic.wasm web/index.html out/wasm/
cp web/basic-modular.js web/basic-modular.wasm out/wasm/
cp web/tutorial-embed.js web/tutorial-example.html web/vfs-helpers.js out/wasm/
cp web/basic-canvas.js web/basic-canvas.wasm web/canvas.html out/wasm/
cp web/README.md out/wasm/
cd out
tar czf cbm-basic-wasm.tar.gz wasm
- name: Upload WASM artifact
uses: actions/upload-artifact@v4
with:
name: cbm-basic-wasm
path: out/cbm-basic-wasm.tar.gz
release:
name: Publish nightly release
needs: [tag-and-build, wasm]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Delete existing nightly release
run: |
gh release delete nightly --yes 2>/dev/null || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create nightly release
uses: softprops/action-gh-release@v1
with:
tag_name: nightly
name: Nightly
body: |
Bleeding-edge build from `main`. Updated automatically every night.
**Use stable [releases](https://github.com/${{ github.repository }}/releases) for production.**
draft: false
files: dist/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}