-
Notifications
You must be signed in to change notification settings - Fork 32
138 lines (135 loc) · 6.03 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
name: Build
on:
pull_request:
push:
schedule:
- cron: '5 1 * * *' # Build every day at 1:05am
jobs:
Build:
name: '${{ matrix.platform.name }}'
runs-on: '${{ matrix.platform.os }}'
# The scheduled event should only run on libsdl-org/sdl2-compat
if: ${{ (github.event_name == 'schedule' && github.repository == 'libsdl-org/sdl2-compat') || (github.event_name != 'schedule') }}
strategy:
fail-fast: false
matrix:
platform:
- { name: 'Linux', os: ubuntu-latest, artifact: 'SDL2_compat-ubuntu', shell: sh, static: true }
- { name: 'MacOS', os: macos-latest, artifact: 'SDL2_compat-macos', shell: sh }
- { name: 'Windows msys2 (mingw32)', os: windows-latest, artifact: 'SDL2_compat-mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: 'Windows msys2 (mingw64)', os: windows-latest, artifact: 'SDL2_compat-mingw64', shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
- { name: 'Windows msys2 (clang32)', os: windows-latest, artifact: 'SDL2_compat-clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
- { name: 'Windows msys2 (clang64)', os: windows-latest, artifact: 'SDL2_compat-clang64', shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
- { name: 'Windows MSVC (x86)', os: windows-latest, artifact: 'SDL2_compat-VC-x86', shell: sh, msvc: true, msvc-arch: x86 }
- { name: 'Windows MSVC (x64)', os: windows-latest, artifact: 'SDL2_compat-VC-x64', shell: sh, msvc: true, msvc-arch: x64 }
- { name: 'Windows MSVC (arm32)', os: windows-latest, artifact: 'SDL2_compat-VC-arm32', shell: sh, msvc: true, msvc-arch: amd64_arm, cross: true }
- { name: 'Windows MSVC (arm64)', os: windows-latest, artifact: 'SDL2_compat-VC-arm64', shell: sh, msvc: true, msvc-arch: amd64_arm64, cross: true }
defaults:
run:
shell: ${{ matrix.platform.shell }}
steps:
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.platform.msvc }}
with:
arch: ${{ matrix.platform.msvc-arch }}
- name: Set up MSYS2
if: ${{ contains(matrix.platform.shell, 'msys2') }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.platform.msystem }}
install: >-
${{ matrix.platform.msys-env }}-cc
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-crt
${{ matrix.platform.msys-env }}-ninja
- name: Get sdl2-compat sources
uses: actions/checkout@v3
- name: Install Ninja
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
uses: turtlesec-no/get-ninja@main
- name: Set up SDL3
uses: libsdl-org/setup-sdl@main
id: sdl
with:
cmake-generator: Ninja
version: 3-head
sdl-test: true
shell: ${{ matrix.platform.shell }}
add-to-environment: true
- name: Set up Linux dependencies
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev
- name: Configure (CMake)
run: |
cmake -S . -B build \
-DSDL2COMPAT_STATIC=${{ matrix.platform.static }} \
-DSDL2COMPAT_INSTALL=TRUE \
-DCMAKE_INSTALL_LIBDIR=lib \
-DSDL2COMPAT_INSTALL_CPACK=TRUE \
-DCMAKE_INSTALL_PREFIX=prefix \
-DSDL2COMPAT_WERROR=ON \
-DCMAKE_POLICY_DEFAULT_CMP0141="NEW" \
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT="ProgramDatabase" \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.platform.msvc && '-DEBUG' }}" \
-DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.platform.msvc && '-DEBUG' }}" \
-GNinja
- name: Build (CMake)
id: build
run: |
cmake --build build/ --verbose
- name: Install (CMake)
run: |
cmake --install build/
echo "SDL2_ROOT=$(pwd)/prefix" >>$GITHUB_ENV
- name: Package (CPack)
if: ${{ always() && steps.build.outcome == 'success' }}
run: |
cmake --build build/ --target package
- name: Run build-time tests (CMake)
if: ${{ false && !matrix.platform.cross }} # FIXME: enable build-time tests on CI
run: |
#FIXME: do this in libsdl-org/setup-sdl (by adding it to .bashrc)? Or move to separate ci step?
sdl_binpath="${{ steps.sdl.outputs.prefix }}/bin"
if [ "x${{ runner.os }}" = "xWindows" ]; then
sdl_binpath="$( cygpath -u "$sdl_binpath" )"
fi
echo "sdl_binpath=$sdl_binpath"
export PATH="$sdl_binpath:$PATH"
export LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH"
set -eu
export SDL_TESTS_QUICK=1
ctest -VV --test-dir build/
- name: Run build tests (CMake)
run: |
cmake --build build/ --verbose --target sdl2compat-build-tests
- name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux build
if: ${{ runner.os == 'Linux' }}
run: |
./build-scripts/test-versioning.sh
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=${{ matrix.platform.static || 'false' }} \
-DCMAKE_BUILD_TYPE=Release \
-GNinja
cmake --build cmake_config_build --verbose
- name: Verify sdl2-config
if: ${{ !matrix.platform.msvc }}
run: |
export PATH=${{ env.SDL2_ROOT }}/bin:$PATH
cmake/test/test_sdlconfig.sh ${{ !matrix.platform.static && '--no-static' }}
- name: Verify sdl2.pc
if: ${{ !matrix.platform.msvc }}
run: |
export PKG_CONFIG_PATH=${{ env.SDL2_ROOT }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh ${{ !matrix.platform.static && '--no-static' }}
- uses: actions/upload-artifact@v3
if: ${{ always() && steps.build.outcome == 'success' }}
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL2_compat*