Merge pull request #3078 from pygame-community/ankith26-scale-by-arg #4367
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |