diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 764be6a..5004a9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,12 +7,16 @@ name: Build on: push: + branches: + - '**' # only run on branches pull_request: release: types: [created] env: BUILD_TYPE: Release + EM_VERSION: 2.0.4 # Emscripten version + EM_CACHE_FOLDER: 'emsdk-cache' # Cache for Emscripten libs jobs: @@ -34,6 +38,13 @@ jobs: cmake-args: -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/32blit-sdk/32blit.toolchain apt-packages: gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3-setuptools + - os: ubuntu-20.04 + name: Emscripten + release-suffix: WEB + cmake-args: -D32BLIT_DIR=$GITHUB_WORKSPACE/32blit-sdk + cmake-prefix: emcmake + apt-packages: python3-setuptools + - os: macos-latest name: macOS release-suffix: MACOS @@ -85,6 +96,26 @@ jobs: run: | python -m pip install 32blit + # Emscripten SDK setup + - name: Setup Emscripten cache + if: matrix.name == 'Emscripten' + id: cache-system-libraries + uses: actions/cache@v2 + with: + path: ${{env.EM_CACHE_FOLDER}} + key: ${{env.EM_VERSION}}-${{runner.os}} + + - name: Setup Emscripten + if: matrix.name == 'Emscripten' + uses: mymindstorm/setup-emsdk@v7 + with: + version: ${{env.EM_VERSION}} + actions-cache-folder: ${{env.EM_CACHE_FOLDER}} + + - name: Pre-build Emscripten ports + if: matrix.name == 'Emscripten' + run: embuilder.py build sdl2 sdl2-image-jpg sdl2-net + # Set up the cmake build environment - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/main/build @@ -93,7 +124,7 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/main/build - run: cmake $GITHUB_WORKSPACE/main -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}} + run: ${{matrix.cmake-prefix}} cmake $GITHUB_WORKSPACE/main -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}} # And then run the build itself - name: Build