Skip to content

Dedupe no0 and nz0 EntityAxeKnight shared code #3602

Dedupe no0 and nz0 EntityAxeKnight shared code

Dedupe no0 and nz0 EntityAxeKnight shared code #3602

Workflow file for this run

name: Build C code
on:
push:
branches:
- master
paths:
- 'include/**'
- 'src/**'
- 'tools/sotn-assets/**'
- 'cmake/**'
- 'CMakeLists*'
pull_request:
paths:
- 'include/**'
- 'src/**'
- 'tools/sotn-assets/**'
- 'cmake/**'
- 'CMakeLists*'
workflow_dispatch:
jobs:
extract-assets:
# Building and testing cannot work if the repository owner is not Xeeynamo
# due to the missing secrets to clone the CI dependencies
if: github.repository == 'Xeeynamo/sotn-decomp'
runs-on: ubuntu-latest
steps:
- name: Clone main repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: false
- name: Get dependencies
uses: actions/cache@v4
id: get-dependencies
with:
path: 'disks/dependencies'
key: sotn-us-deps
- name: Setting up dependencies
working-directory: disks
run: cat dependencies/* | tar -zxf -
- name: Extract dependencies
run: make extract_disk
- name: Extract game assets
run: |
make update-dependencies
make -j extract
make -j extract_assets
- name: Export assets
uses: actions/upload-artifact@v4
with:
name: assets
path: assets
build-linux:
strategy:
matrix:
compiler: ["clang", "gcc"]
build_type: ["Debug", "RelWithDebInfo"]
sound_engine: ["lle", "custom"]
runs-on: ubuntu-24.04
needs: extract-assets
steps:
- name: Install requirements
run: sudo apt-get update && sudo apt-get install build-essential libsdl2-dev
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: false
- name: Get assets
uses: actions/download-artifact@v4
with:
name: assets
path: assets
- name: Build assets
run: make -j build_assets
- name: Build
run: |
export PC_FLAGS=""
if [[ "${{ matrix.sound_engine }}" == "lle" ]]; then
export PC_FLAGS="-DWANT_LIBSND_LLE=1"
fi
export CC=${{ matrix.compiler }}
cmake -B ${{github.workspace}}/pc ${PC_FLAGS} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }}
- name: Test
if: matrix.sound_engine == 'lle'
run: |
${{github.workspace}}/pc/Sound test
build-macos:
strategy:
matrix:
build_type: ["Debug", "RelWithDebInfo"]
runs-on: macos-latest
needs: extract-assets
steps:
- name: Install requirements
run: brew install SDL2
- name: Install Go
run: |
curl -L -o go.tar.gz https://go.dev/dl/go1.22.4.darwin-amd64.tar.gz
tar -C ~ -xzf go.tar.gz
rm go.tar.gz
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: false
- name: Get assets
uses: actions/download-artifact@v4
with:
name: assets
path: assets
- name: Build assets
run: make -j build_assets
- name: Build
run: |
cmake -B ${{github.workspace}}/pc -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }}
build-windows:
strategy:
matrix:
build_type: ["Debug", "RelWithDebInfo"]
runs-on: windows-latest
needs: extract-assets
steps:
- name: Install requirements
run: |
mkdir C:\temp-sdl2
powershell Invoke-WebRequest 'https:/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip' -OutFile C:\temp-sdl2\SDL2-devel-2.28.5-VC.zip
7z x C:\temp-sdl2\SDL2-devel-2.28.5-VC.zip -oC:\temp-sdl2
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: false
- name: Get assets
uses: actions/download-artifact@v4
with:
name: assets
path: assets
- uses: actions/setup-go@v5
with:
go-version: '^1.22.4'
- name: Build assets
run: |
cd tools/sotn-assets; go install; cd -
$SOTN_ASSETS = (Get-Command sotn-assets).Source
& make -j build_assets SOTNASSETS=$SOTN_ASSETS
- name: Build
run: |
cmake -B ${{github.workspace}}/pc -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSDL2_PATH=C:\temp-sdl2\SDL2-2.28.5
cmake --build ${{github.workspace}}/pc --config ${{ matrix.build_type }}