ddnet/.github/workflows/build.yaml
heinrich5991 aa594795db Work around CMake 3.20.0 bug, fix packaging on CI
CMake 3.20.0 ignores the next CLI parameter after --parallel. Fix that by
moving it to the end of the command line.

https://gitlab.kitware.com/cmake/cmake/-/issues/21966
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5936

It is meant to be fixed in CMake 3.20.1.
2021-04-07 18:07:44 +02:00

130 lines
4.3 KiB
YAML

name: Build
on:
push:
branches-ignore:
- staging.tmp
- trying.tmp
- staging-squash-merge.tmp
pull_request:
jobs:
build-cmake:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest, ubuntu-16.04]
include:
- os: ubuntu-latest
cmake-args: -G "Unix Makefiles"
build-args: --parallel
package-file: DDNet-*-linux_x86_64.tar.xz
fancy: true
env:
CFLAGS: -Wdeclaration-after-statement -Werror
CXXFLAGS: -Werror
- os: ubuntu-16.04
cmake-path: /usr/bin/
cmake-args: -G "Unix Makefiles"
package-file: DDNet-*-linux_x86_64.tar.xz
fancy: false
env:
CFLAGS: -Wdeclaration-after-statement -Werror
CXXFLAGS: -Werror
- os: macOS-latest
cmake-args: -G "Unix Makefiles"
build-args: --parallel
package-file: DDNet-*-osx.dmg
fancy: false
env:
CFLAGS: -Wdeclaration-after-statement -Werror
CXXFLAGS: -Werror
- os: windows-latest
cmake-args: -G "Visual Studio 16 2019" -A x64
package-file: DDNet-*-win64.zip
fancy: false
env:
CFLAGS: /WX
CXXFLAGS: /WX
LDFLAGS: /WX
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install pkg-config cmake libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev -y
- name: Prepare Linux (fancy)
if: contains(matrix.os, 'ubuntu') && matrix.fancy
run: |
sudo apt-get install libmariadbclient-dev libwebsockets-dev -y
- name: Prepare MacOS
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config sdl2
brew upgrade freetype
sudo rm -rf /Library/Developer/CommandLineTools
- name: Build in debug mode
env: ${{ matrix.env }}
run: |
mkdir debug
cd debug
${{ matrix.cmake-path }}cmake --version
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
${{ matrix.cmake-path }}cmake --build . --config Debug --target everything ${{ matrix.build-args }}
- name: Test debug
run: |
cd debug
${{ matrix.cmake-path }}cmake --build . --config Debug --target run_tests ${{ matrix.build-args }}
./DDNet-Server shutdown
- name: Build in release mode
env: ${{ matrix.env }}
run: |
mkdir release
cd release
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -Werror=dev -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
${{ matrix.cmake-path }}cmake --build . --config Release --target everything ${{ matrix.build-args }}
- name: Test release
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release --target run_tests ${{ matrix.build-args }}
./DDNet-Server shutdown
- name: Build in release mode with debug info and all features on
if: matrix.fancy
env: ${{ matrix.env }}
run: |
mkdir fancy
cd fancy
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DANTIBOT=ON -DMYSQL=ON -DWEBSOCKETS=ON ..
${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target everything ${{ matrix.build-args }}
- name: Test fancy
if: matrix.fancy
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target run_tests ${{ matrix.build-args }}
./DDNet-Server shutdown
- name: Package
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release --target package_default ${{ matrix.build-args }}
mkdir artifacts
mv ${{ matrix.package-file }} artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: ddnet-${{ matrix.os }}
path: release/artifacts