forked from freeorion/freeorion
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (117 loc) · 3.97 KB
/
build-ubuntu.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
113
114
115
116
117
118
119
name: "Ubuntu"
on:
push:
paths-ignore:
- 'msvc*/**'
- 'check/**'
- 'doc/**'
- 'packaging/**'
- 'snap/**'
- '*.md'
- 'check/**'
- 'default/**'
- 'test-scripting/**'
pull_request:
paths-ignore:
- 'msvc*/**'
- 'check/**'
- 'doc/**'
- 'packaging/**'
- 'snap/**'
- '*.md'
- 'check/**'
- 'default/**'
- 'test-scripting/**'
jobs:
build-ubuntu:
name: ${{ matrix.os }} Build FreeOrion GG=${{ matrix.client-gg }} Godot=${{ matrix.client-godot }} compiler ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
client-gg: ['ON']
client-godot: ['ON']
compiler: [gcc, clang]
include:
- os: ubuntu-20.04
client-gg: 'ON'
client-godot: 'OFF'
compiler: clang
env:
CACHE_NAME: linux
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: actions/cache@v3
id: build-ubuntu-install-cache-id
with:
path: ${{ runner.temp }}/cache-build-linux-install
key: build-${{ matrix.os }}-install-cache-key-v1.0
- uses: airvzxf/[email protected]
with:
script: '${{ matrix.os }}-install-build.sh'
is_cached: ${{ steps.build-ubuntu-install-cache-id.outputs.cache-hit }}
cache: ${{ runner.temp }}/cache-build-linux-install
snapshot: '/'
exclude: '/boot /data /dev /mnt /proc /run /sys'
- name: Prepare ccache timestamp
id: build-ubuntu-ccache-timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}")
- name: Cache files with ccache
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/ccache
key: build-${{ matrix.os }}-${{ matrix.compiler }}-ccache-${{ steps.build-ubuntu-ccache-timestamp.outputs.timestamp }}
restore-keys: |
build-${{ matrix.os }}-${{ matrix.compiler }}-ccache-
- name: Show ccache statistics before build
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
ccache --show-stats || true
- name: Build directory
run: mkdir build
- name: Configure for gcc
if: ${{ matrix.compiler == 'gcc' }}
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
cd build
cmake -DBUILD_TESTING=ON -DBUILD_CLIENT_GG=${{ matrix.client-gg }} -DBUILD_CLIENT_GODOT=${{ matrix.client-godot }} ..
- name: Configure for clang
if: ${{ matrix.compiler == 'clang' }}
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
CXXFLAGS: '-I/usr/include/SDL2 -I/usr/include/x86_64-linux-gnu/SDL2/ -I/usr/include/x86_64-linux-gnu/'
CFLAGS: '-I/usr/include/SDL2 -I/usr/include/x86_64-linux-gnu/SDL2/ -I/usr/include/x86_64-linux-gnu/'
CC: clang
CXX: clang++
run: |
cd build
cmake -DBUILD_TESTING=ON -DBUILD_CLIENT_GG=${{ matrix.client-gg }} -DBUILD_CLIENT_GODOT=${{ matrix.client-godot }} ..
- name: Build
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
CMAKE_BUILD_PARALLEL_LEVEL: 2
run: |
cd build
cmake --build .
- name: Show ccache statistics after build
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
ccache --show-stats || true
- name: Run C++ unit tests
env:
FO_TEST_HOSTLESS_GAMES: 1
run: |
cd build
cmake --build . --config Release --target unittest
- name: Run Godot unit tests
if: matrix.client-godot == 'ON'
run: |
cp `which godot3-server` build/
./build/godot3-server --disable-render-loop --verbose -s --path godot addons/gut/gut_cmdln.gd -gdir=res://test/ -ginclude_subdirs -gexit