-
Notifications
You must be signed in to change notification settings - Fork 136
176 lines (166 loc) · 6.56 KB
/
main.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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+CMake), os: windows-latest, shell: sh, cmake: '-DSDL2TTF_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0 }
- { name: Windows (mingw32+autotools), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, shared: 1, static: 1 }
- { name: Windows (mingw64+CMake), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0,
cmake: '-DSDL2TTF_VENDORED=OFF -G "Ninja Multi-Config"' }
- { name: Linux (autotools), os: ubuntu-20.04, shell: sh, shared: 1, static: 1 }
- { name: Linux (CMake), os: ubuntu-20.04, shell: sh, cmake: '-DSDL2TTF_VENDORED=ON -GNinja', shared: 1, static: 0 }
- { name: 'Linux (CMake, static)', os: ubuntu-20.04, shell: sh, cmake: '-GNinja -DBUILD_SHARED_LIBS=OFF', shared: 0, static: 1 }
- { name: Macos (autotools), os: macos-latest, shell: sh, shared: 1, static: 1}
- { name: Macos (CMake), os: macos-latest, shell: sh, cmake: '-DSDL2TTF_VENDORED=ON -GNinja', shared: 1, static: 0 }
steps:
- 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 }}-SDL2
${{ matrix.platform.msys-env }}-autotools
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-gcc
${{ matrix.platform.msys-env }}-freetype
${{ matrix.platform.msys-env }}-harfbuzz
${{ matrix.platform.msys-env }}-ninja
${{ matrix.platform.msys-env }}-pkg-config
${{ matrix.platform.msys-env }}-zlib
- name: Setup Macos dependencies
if: runner.os == 'macOS'
run: |
brew install \
autoconf \
automake \
freetype \
harfbuzz \
libtool \
ninja \
pkg-config \
sdl2 \
${NULL+}
- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get -y install \
autoconf \
automake \
cmake \
file \
fonts-dejavu-core \
libfreetype-dev \
libharfbuzz-dev \
libsdl2-dev \
libtool \
ninja-build \
pkg-config \
${NULL+}
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSVC dependencies
if: "matrix.platform.msvc"
shell: pwsh
run: |
.github/fetch_sdl_vc.ps1
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/SDL2-devel-VC" >> $Env:GITHUB_ENV
- name: Setup Ninja for MSVC
if: "matrix.platform.msvc"
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- uses: ilammy/msvc-dev-cmd@v1
if: "matrix.platform.msvc"
with:
arch: x64
- name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux/CMake build
if: "runner.os == 'Linux' && matrix.platform.cmake"
run: ./test-versioning.sh
- name: Configure (CMake)
if: "matrix.platform.cmake"
run: |
cmake -B build-cmake \
-DBUILD_SHARED_LIBS=ON \
-DSDL2TTF_HARFBUZZ=ON \
-DSDL2TTF_SAMPLES=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix_cmake \
${{ matrix.platform.cmake }}
- name: Build (CMake)
if: "matrix.platform.cmake"
run: |
cmake --build build-cmake --config Release --verbose
- name: Install (CMake)
if: "matrix.platform.cmake"
run: |
set -eu
rm -rf prefix_cmake
cmake --install build-cmake/ --config Release --verbose
echo "SDL2_ttf_DIR=$(pwd)/prefix_cmake" >> $GITHUB_ENV
( cd prefix_cmake; find . ) | LC_ALL=C sort -u
- name: Test using showfont (CMake)
if: "runner.os == 'Linux' && matrix.platform.cmake"
run: |
# Just check that it doesn't crash, we can't really test the results...
env -C build-cmake/ SDL_VIDEODRIVER=dummy ./showfont -dump /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
# ... but we can at least assert that it outputs a .bmp
file build-cmake/glyph-100.bmp
- name: Configure (Autotools)
if: "! matrix.platform.cmake"
run: |
set -eu
rm -fr build-autotools
mkdir build-autotools
./autogen.sh
set -- --prefix=$(pwd)/prefix_autotools
( cd build-autotools && ../configure "$@" )
- name: Build (Autotools)
if: "! matrix.platform.cmake"
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools V=1
- name: Test (showfont)
if: "runner.os == 'Linux' && ! matrix.platform.cmake"
run: |
# Just check that it doesn't crash, we can't really test the results...
env -C build-autotools SDL_VIDEODRIVER=dummy ./showfont -dump /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
# ... but we can at least assert that it outputs a .bmp
file build-autotools/glyph-100.bmp
- name: Install (Autotools)
if: "! matrix.platform.cmake"
run: |
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
rm -rf prefix_autotools
make -j"${parallel}" -C build-autotools install V=1
echo "SDL2_ttf_DIR=$(pwd)/prefix_autotools" >> $GITHUB_ENV
( cd prefix_autotools; find . ) | LC_ALL=C sort -u
- name: Distcheck (Autotools)
if: "runner.os == 'Linux' && ! matrix.platform.cmake"
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools distcheck V=1
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${{ env.SDL2_ttf_DIR }};${{ env.SDL2_DIR }}" \
-DTEST_SHARED=${{ matrix.platform.shared }} \
-DTEST_STATIC=${{ matrix.platform.static }}
cmake --build cmake_config_build --verbose --config Release