Skip to content

Commit

Permalink
WiP: Update CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Aug 30, 2024
1 parent 8fbc8ba commit 1031c61
Showing 1 changed file with 83 additions and 22 deletions.
105 changes: 83 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,50 +49,111 @@ jobs:
run: |
cmake --build build_${{ matrix.profile }} --parallel ${{ steps.cpu-cores.outputs.count }}
wasm:
make:
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
include:
- name: web
fte_target: web
target_clients: "gl-rel"
os: ubuntu-latest
- name: linux64
fte_target: linux64
target_clients: "gl-rel vk-rel"
target_other: "sv-rel qtv-rel qcc-rel"
os: ubuntu-latest
packages: "libasound2-dev libgl-dev libxcursor-dev libxi-dev libxrandr-dev libxss-dev"
- name: win32
fte_target: win32
target_clients: "gl-rel vk-rel"
target_other: "sv-rel qcc-rel"
os: ubuntu-latest
packages: "binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686"
- name: win64
fte_target: win64
target_clients: "gl-rel vk-rel"
target_other: "sv-rel qcc-rel"
os: ubuntu-latest
packages: "binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64"
- name: macos-arm64
fte_target: SDL2
target_clients: "gl-rel"
target_other: "sv-rel qcc-rel"
args: "ARCH=arm STRIPFLAGS="
packages: "sdl2"
os: macos-latest

name: make-${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

- uses: actions/checkout@v4

- uses: mymindstorm/setup-emsdk@v13
- name: Extract versions
run: grep 'VER=' engine/Makefile | tee makelibs_versions

- uses: actions/cache@v4
id: cache
with:
path: engine/libs-*
key: ${{ runner.os }}-${{ matrix.fte_target }}-${{ hashFiles('makelibs_versions') }}

- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ matrix.emsdk }}
actions-cache-folder: "emsdk-cache-${{ matrix.emsdk }}"
version: "2.0.12"
actions-cache-folder: "emsdk-cache-2.0.12"
cache-key: "emsdk-2.0.12"
if: matrix.fte_target == 'web'

- name: Verify emscripten
run: emcc -v
if: matrix.fte_target == 'web'

- name: Install dependencies (linux)
run: sudo apt-get -qq update && sudo apt-get -qq install --no-install-recommends ${{ matrix.packages }}
if: matrix.packages != '' && matrix.os == 'ubuntu-latest'

- name: Install dependencies (macos)
run: brew install ${{ matrix.packages }}
if: matrix.packages != '' && matrix.os == 'macos-latest'

- name: Build dependencies
working-directory: engine
run: |
make -j ${{ steps.cpu-cores.outputs.count }} makelibs FTE_TARGET=web
run: make FTE_TARGET=${{ matrix.fte_target }} makelibs ${{ matrix.args }}
if: steps.cache.outputs.cache-hit != 'true'

- name: Build wasm
- uses: ammaraskar/[email protected]

- name: Build ${{ matrix.name }}
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=${{ matrix.fte_target }} ${{ matrix.target_clients }} ${{ matrix.args }} LINK_EZHUD=1
if [ -n "${{ matrix.target_other }}" ]; then
make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=${{ matrix.fte_target }} ${{ matrix.target_other }} ${{ matrix.args }}
fi
make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=web web-${{ matrix.profile }}
- name: Attach macOS docs
run: |
cat <<EOF > engine/release/fte_macos.txt
To allow executables to run issue:
chmod +x fteqw-glsdl2
xattr -d com.apple.quarantine fteqw-glsdl2
If you don't have SDL2 installed, run:
brew install sdl2
EOF
if: matrix.os == 'macos-latest'

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: fteqw-web-${{ matrix.profile }}-em${{ matrix.emsdk }}
name: fteqw-${{ matrix.name }}
path: |
engine/*/ftewebgl.js
engine/*/ftewebgl.html
engine/*/ftewebgl.wasm
engine/release/fte*
!engine/release/*.db
compression-level: 9

0 comments on commit 1031c61

Please sign in to comment.