Merge remote-tracking branch 'upstream/master' into scalemode-sync-2023 #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{ matrix.os }} (${{ matrix.compiler }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Linux | |
os: ubuntu-latest | |
compiler: gcc | |
cpp-compiler: g++ | |
- name: Linux | |
os: ubuntu-latest | |
compiler: clang | |
cpp-compiler: clang++ | |
- name: Windows | |
os: windows-latest | |
compiler: cl | |
cpp-compiler: cl | |
cmake-args: -A Win32 | |
build-args: "/clp:NoSummary" | |
- name: macOS | |
os: macOS-latest | |
packages: yaml-cpp sdl sdl_gfx sdl_image sdl_mixer | |
compiler: clang | |
cpp-compiler: clang++ | |
app-bundle: openxcom.app # all other builds default to bin/ | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install packages (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get -yq --no-install-suggests --no-install-recommends install ccache ${{ matrix.packages }} | |
sudo apt-get -yq --no-install-suggests --no-install-recommends install libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libyaml-cpp-dev | |
- name: Install packages (Windows) | |
if: runner.os == 'Windows' && matrix.packages | |
run: | | |
choco install ${{ matrix.packages }} | |
- name: Install packages (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install ccache ${{ matrix.packages }} | |
- name: Setup Cache | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.ccache | |
key: ccache-${{ runner.os }}-${{ matrix.compiler }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup environment | |
shell: bash | |
run: | | |
echo "describe=$(git describe)" >> $GITHUB_ENV | |
if [ "${{ matrix.name }}" = "Linux" ]; then | |
echo "MAYBE_SUDO=sudo" >> $GITHUB_ENV | |
fi | |
echo "CMAKE_BUILD_PARALLEL_LEVEL=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 2`" >> $GITHUB_ENV | |
- name: Download dependencies (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
Invoke-WebRequest -Uri "https://openxcom.org/download/dev/openxcom-deps-win-vc2017.zip" -OutFile "openxcom-deps-win-vc2017-newest.zip" | |
Expand-Archive -Path "openxcom-deps-win-vc2017-newest.zip" | |
Move-Item -Path "openxcom-deps-win-vc2017-newest\deps\*" -Destination "deps" | |
- name: Generate project files | |
run: | | |
cmake -B ${{ matrix.build-dir || 'build' }} ${{ matrix.build-src-dir || '.' }} -DCMAKE_BUILD_TYPE=Release -DENABLE_WARNING=1 -DCHECK_CCACHE=1 ${{ matrix.cmake-args }} | |
env: | |
CC: ${{ matrix.compiler }} | |
CXX: ${{ matrix.cpp-compiler }} | |
- name: Compile source code | |
run: | | |
cmake --build ${{ matrix.build-dir || 'build' }} -v --config ${{ matrix.build-config || 'Release' }} -- ${{ matrix.build-args }} | |
# Note, this is bogus on MacOS, as it installs shaders et al twice. | |
# Windows installs under C:/Program Files (x86)/OpenXcom/bin (where the | |
# 'bin' is pretty redundant) and Linux installs under various dirs under | |
# /usr/local | |
- name: Make install | |
shell: bash | |
run: | | |
$MAYBE_SUDO cmake --build ${{ matrix.build-dir || 'build' }} -v --config ${{ matrix.build-config || 'Release' }} --target install | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openxcom_${{ matrix.name }}_${{ matrix.compiler }}-${{ env.describe }} | |
path: | | |
${{ matrix.build-dir || 'build' }}/${{ matrix.app-bundle || 'bin' }}/**/* | |
- name: ccache stats | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
run: ccache -s --max-size=390MB |