From 3b6cd9aac08f1e7588f208cb5ce98c55bc5a669e Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Sun, 24 Dec 2023 15:30:17 +0100 Subject: [PATCH] Add GitHub Actions workflow. --- .github/workflows/main.yml | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..537519acf --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,98 @@ +name: main + +on: [ push, pull_request, workflow_dispatch ] + +jobs: + cmake: + strategy: + matrix: + os: [ ubuntu-latest ] + profile: [ "Debug", "Release" ] + + runs-on: ${{ matrix.os }} + + steps: + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v1 + id: cpu-cores + + - uses: actions/checkout@v4 + + - name: "Install Dependencies" + run: | + sudo apt-get -qq update + sudo apt-get -qq install --no-install-recommends \ + gettext \ + libasound2-dev \ + libbullet-dev \ + libgnutls28-dev \ + libopenxr-dev \ + libqscintilla2-qt5-dev \ + libsdl2-dev \ + libvorbis-dev \ + libvulkan-dev \ + libwayland-dev \ + libxcursor-dev \ + libxkbcommon-dev \ + libxrandr-dev \ + qtbase5-dev + + # Disabled due to warnings that break the debug build with -Werror + # libode-dev + # libavcodec-dev libavformat-dev libavutil-dev libswscale-dev + + - name: "Configure: ${{ matrix.profile }}" + run: | + cmake -B build_${{ matrix.profile }} -DCMAKE_BUILD_TYPE=${{ matrix.profile }} + + - name: "Build: ${{ matrix.profile }}" + run: | + cmake --build build_${{ matrix.profile }} --parallel ${{ steps.cpu-cores.outputs.count }} + + wasm: + strategy: + # Concurrent builds currently broken: + # https://github.com/mymindstorm/setup-emsdk/issues/20 + matrix: + emsdk: [ "2.0.12" ] #, "3.1.8", "3.1.51" ] + profile: [ "rel" ] #, "dbg" ] + + runs-on: ubuntu-latest + + steps: + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v1 + id: cpu-cores + + - uses: actions/checkout@v4 + + - uses: mymindstorm/setup-emsdk@v13 + with: + version: ${{ matrix.emsdk }} + actions-cache-folder: "emsdk-cache-${{ matrix.emsdk }}" + + - name: Verify emscripten + run: emcc -v + + - name: Build dependencies + working-directory: engine + run: | + make -j ${{ steps.cpu-cores.outputs.count }} makelibs FTE_TARGET=web + + - name: Build wasm + working-directory: engine + run: | + # Currently fails to build + sed -r -i '/define Q3(CLIENT|SERVER)/d' common/config_fteqw.h + + make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=web web-${{ matrix.profile }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: fteqw-web-${{ matrix.profile }}-em${{ matrix.emsdk }} + path: | + engine/*/ftewebgl.js + engine/*/ftewebgl.html + engine/*/ftewebgl.wasm + compression-level: 9