Add WebAssembly build to Github Workflow

This commit is contained in:
Renato Rotenberg
2025-01-29 10:59:54 -03:00
parent c1b11da985
commit 8e3d9ba454
+13 -3
View File
@@ -15,6 +15,8 @@ jobs:
os: ubuntu-latest os: ubuntu-latest
- identifier: macos - identifier: macos
os: macos-latest os: macos-latest
- identifier: web
os: ubuntu-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout project - name: Checkout project
@@ -26,25 +28,33 @@ jobs:
python-version: '3.10' python-version: '3.10'
- name: (Windows) Set up MinGW - name: (Windows) Set up MinGW
if: ${{ startsWith(matrix.identifier, 'windows') }} if: ${{ matrix.identifier }} == 'windows'
uses: egor-tensin/setup-mingw@v2 uses: egor-tensin/setup-mingw@v2
- name: (Windows) Prepare cross compilation - name: (Windows) Prepare cross compilation
if: ${{ startsWith(matrix.identifier, 'windows') }} if: ${{ matrix.identifier }} == 'windows'
shell: sh shell: sh
run: | run: |
echo "OS=Windows_NT" >> $GITHUB_ENV echo "OS=Windows_NT" >> $GITHUB_ENV
- name: (Linux) Install dependencies - name: (Linux) Install dependencies
if: ${{ startsWith(matrix.identifier, 'linux') }} if: ${{ matrix.identifier }} == 'linux'
run: | run: |
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
sudo apt-get update -y -qq sudo apt-get update -y -qq
sudo apt-get install libsdl2-dev libglew-dev sudo apt-get install libsdl2-dev libglew-dev
- name: (Web) Set up Emscripten
if: ${{ matrix.identifier }} == 'web'
uses: mymindstorm/setup-emsdk@v14
- name: Build shared library - name: Build shared library
run: | run: |
if [[ "${{ matrix.identifier }}" == "web" ]]; then
emmake make lib -j $(nproc) CC=emcc
else
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
fi
- name: (Linux) Build test executable - name: (Linux) Build test executable
if: ${{ startsWith(matrix.identifier, 'linux') }} if: ${{ startsWith(matrix.identifier, 'linux') }}