-
-
Notifications
You must be signed in to change notification settings - Fork 154
74 lines (64 loc) · 2.23 KB
/
build-emsdk.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
name: Build WASM (Emscripten)
# Run CI only on changes to main branch, or any PR to main. Do not run CI on
# any other branch. Also, skip any non-source changes from running on CI
on:
push:
branches: main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '.gitignore'
- '*.rst'
- '*.md'
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-emsdk.yml'
pull_request:
branches: main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '.gitignore'
- '*.rst'
- '*.md'
- '.github/workflows/*.yml'
# re-include current file to not be excluded
- '!.github/workflows/build-emsdk.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-emsdk
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
env:
# pin SDK version to the latest, update manually
SDK_VERSION: 3.1.32.0
SDK_ARCHIVE: python3.11-wasm-sdk-Ubuntu-22.04.tar.lz4
SDKROOT: /opt/python-wasm-sdk
steps:
- uses: actions/[email protected]
- name: Regen with latest cython (using system python3)
run: |
pip3 install cython==3.0.10
python3 setup.py cython_only
- name: Install python-wasm-sdk
run: |
sudo apt-get install lz4
echo https://github.com/pygame-web/python-wasm-sdk/releases/download/$SDK_VERSION/$SDK_ARCHIVE
curl -sL --retry 5 https://github.com/pygame-web/python-wasm-sdk/releases/download/$SDK_VERSION/$SDK_ARCHIVE | tar xvP --use-compress-program=lz4
# do not let SDL1 interfere
rm -rf /opt/python-wasm-sdk/emsdk/upstream/emscripten/cache/sysroot/include/SDL
working-directory: /opt
- name: Build WASM with emsdk
run: |
${SDKROOT}/python3-wasm setup.py build -j$(nproc)
- name: Generate libpygame.a static binaries archive
run: |
mkdir -p dist
SYS_PYTHON=python3 /opt/python-wasm-sdk/emsdk/upstream/emscripten/emar rcs dist/libpygame.a $(find build/temp.wasm32-*/ | grep o$)
# Upload the generated files under github actions assets section
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: pygame-wasm-dist
path: ./dist/*