161 lines
5.4 KiB
YAML
161 lines
5.4 KiB
YAML
name: Build
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
Build:
|
|
name: ${{ matrix.platform.name }}
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: ${{ matrix.platform.shell }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- { name: Windows (MSVC), os: windows-2019, shell: sh, cmake: '-DPerl_ROOT=C:/Strawberry/perl/bin/ -DSDLMIXER_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0, artifact: 'SDL3_mixer-VC-x64' }
|
|
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0, artifact: 'SDL3_mixer-mingw64',
|
|
cmake: '-DSDLMIXER_VENDORED=OFF -G "Ninja Multi-Config"' }
|
|
- { name: Linux, os: ubuntu-20.04, shell: sh, cmake: '-DSDLMIXER_VENDORED=ON -GNinja', shared: 1, static: 0, artifact: 'SDL3_mixer-linux-x64' }
|
|
- { name: 'Linux (static)', os: ubuntu-20.04, shell: sh, cmake: '-DSDLMIXER_VENDORED=ON -DBUILD_SHARED_LIBS=OFF -GNinja', shared: 0, static: 1, artifact: 'SDL3_mixer-static-linux-x64' }
|
|
- { name: Macos, os: macos-latest, shell: sh, cmake: '-DSDLMIXER_VENDORED=ON -GNinja', shared: 1, static: 0, artifact: 'SDL3_mixer-macos' }
|
|
|
|
|
|
steps:
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
if: ${{ matrix.platform.msvc }}
|
|
with:
|
|
arch: x64
|
|
- name: Set up MSYS2
|
|
if: ${{ matrix.platform.shell == 'msys2 {0}' }}
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: ${{ matrix.platform.msystem }}
|
|
install: >-
|
|
${{ matrix.platform.msys-env }}-cmake
|
|
${{ matrix.platform.msys-env }}-gcc
|
|
${{ matrix.platform.msys-env }}-flac
|
|
${{ matrix.platform.msys-env }}-fluidsynth
|
|
${{ matrix.platform.msys-env }}-libgme
|
|
${{ matrix.platform.msys-env }}-libvorbis
|
|
${{ matrix.platform.msys-env }}-libxmp
|
|
${{ matrix.platform.msys-env }}-mpg123
|
|
${{ matrix.platform.msys-env }}-opusfile
|
|
${{ matrix.platform.msys-env }}-wavpack
|
|
${{ matrix.platform.msys-env }}-ninja
|
|
${{ matrix.platform.msys-env }}-perl
|
|
${{ matrix.platform.msys-env }}-pkg-config
|
|
- name: Set up Ninja
|
|
uses: aseprite/get-ninja@main
|
|
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
|
|
- name: Set up SDL
|
|
id: sdl
|
|
uses: libsdl-org/setup-sdl@main
|
|
with:
|
|
cmake-generator: Ninja
|
|
version: 3-head
|
|
sdl-test: true
|
|
shell: ${{ matrix.platform.shell }}
|
|
- name: Set up Macos dependencies
|
|
if: ${{ runner.os == 'macOS' }}
|
|
run: |
|
|
brew install \
|
|
libtool \
|
|
ninja \
|
|
flac \
|
|
fluidsynth \
|
|
game-music-emu \
|
|
libvorbis \
|
|
libxmp \
|
|
mpg123 \
|
|
opusfile \
|
|
wavpack \
|
|
${NULL+}
|
|
- name: Set up Linux dependencies
|
|
if: ${{ runner.os == 'Linux' }}
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get -y install \
|
|
cmake \
|
|
libasound2-dev \
|
|
libflac-dev \
|
|
libfluidsynth-dev \
|
|
libgme-dev \
|
|
libmpg123-dev \
|
|
libopusfile-dev \
|
|
libvorbis-dev \
|
|
libxmp-dev \
|
|
libwavpack-dev \
|
|
ninja-build \
|
|
pkg-config \
|
|
${NULL+}
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Check that versioning is consistent
|
|
# We only need to run this once: arbitrarily use the Linux build
|
|
if: ${{ runner.os == 'Linux' }}
|
|
run: ./build-scripts/test-versioning.sh
|
|
|
|
- name: Set up yasm for mpg123
|
|
if: ${{ matrix.platform.msvc }}
|
|
shell: pwsh
|
|
run: |
|
|
.github/fetch_yasm.ps1
|
|
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
|
|
|
|
- name: Configure (CMake)
|
|
run: |
|
|
set -- \
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DSDLMIXER_FLAC=ON \
|
|
-DSDLMIXER_FLAC_LIBFLAC=ON \
|
|
-DSDLMIXER_GME=ON \
|
|
-DSDLMIXER_MOD_XMP=ON \
|
|
-DSDLMIXER_MP3_MPG123=ON \
|
|
-DSDLMIXER_OPUS=ON \
|
|
-DSDLMIXER_VORBIS=VORBISFILE \
|
|
-DSDLMIXER_STRICT=ON \
|
|
-DSDLMIXER_WERROR=ON \
|
|
-DSDLMIXER_INSTALL_MAN=ON \
|
|
-DCMAKE_INSTALL_PREFIX=prefix_cmake \
|
|
${NULL+}
|
|
|
|
cmake -B build \
|
|
"$@" \
|
|
${{ matrix.platform.cmake }}
|
|
- name: Build (CMake)
|
|
id: build
|
|
run: |
|
|
cmake --build build/ --config Release --parallel --verbose
|
|
- name: Install (CMake)
|
|
run: |
|
|
set -eu
|
|
rm -fr prefix_cmake
|
|
cmake --install build/ --config Release
|
|
echo "SDL3_mixer_ROOT=$(pwd)/prefix_cmake" >> $GITHUB_ENV
|
|
( cd prefix_cmake; find . ) | LC_ALL=C sort -u
|
|
- name: Package (CPack)
|
|
if: ${{ always() && steps.build.outcome == 'success' }}
|
|
run: |
|
|
cmake --build build/ --target package
|
|
|
|
- name: Verify CMake configuration files
|
|
run: |
|
|
cmake -S cmake/test -B cmake_config_build \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DTEST_SHARED=${{ matrix.platform.shared }} \
|
|
-DTEST_STATIC=${{ matrix.platform.static }}
|
|
cmake --build cmake_config_build --verbose --config Release
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: ${{ always() && steps.build.outcome == 'success' }}
|
|
with:
|
|
if-no-files-found: error
|
|
name: ${{ matrix.platform.artifact }}
|
|
path: build/dist/SDL3_mixer*
|