forked from OpenXcom/OpenXcom
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (95 loc) · 3.97 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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