Skip to content

Add tests to Surface.get_(f)rect #2120

Add tests to Surface.get_(f)rect

Add tests to Surface.get_(f)rect #2120

Workflow file for this run

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
# use the most recent cython from github, but pin on a commit for CI
# stability. This is also needed to benefit from caching cython installs
LATEST_CYTHON_COMMIT: 2f3a781dcca092ce95fbfef2736b12b0d1ab50dd # cython 3.0.0
WHEELHOUSE_CYTHON: /tmp/wheelhouse/cython
steps:
- uses: actions/[email protected]
- name: Cache Cython
id: cache-cython
uses: actions/[email protected]
with:
path: ${{ env.WHEELHOUSE_CYTHON }}
key: wasm-ubuntu-cython-${{ env.LATEST_CYTHON_COMMIT }}-path-${{ env.WHEELHOUSE_CYTHON }}
# This builds the cython wheel and stores it in cache too
- name: Download and build cython on cache miss
if: steps.cache-cython.outputs.cache-hit != 'true'
run: |
mkdir -p $WHEELHOUSE_CYTHON
pip wheel --wheel-dir $WHEELHOUSE_CYTHON git+https://github.com/cython/cython.git@$LATEST_CYTHON_COMMIT
- name: Install latest cython and regen
run: |
pip install --no-index --find-links $WHEELHOUSE_CYTHON --pre cython
touch $(find | grep pxd$)
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@v3
with:
name: pygame-wasm-dist
path: ./dist/*