-
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (117 loc) · 4.76 KB
/
build_and_run_tests.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
name: Build and run tests
on:
push:
branches: [main]
paths-ignore:
- "User data Default/**"
- "**.md"
pull_request:
branches: [main]
env:
cmake_configure_args: -D WARNINGS_AS_ERRORS_FOR_COOLLAB_LAUNCHER=ON
cmakelists_folder: "."
cmake_target: Tests-Coollab-Launcher
jobs:
build-and-run-tests:
name: ${{matrix.config.name}} ${{matrix.build_type}}
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {
name: Windows MSVC,
os: windows-latest,
cmake_configure_args: -D CMAKE_C_COMPILER=cl CMAKE_CXX_COMPILER=cl -G Ninja,
}
- {
name: Windows Clang,
os: windows-latest,
cmake_configure_args: -T ClangCL,
}
- {
name: Linux Clang,
os: ubuntu-latest,
cmake_configure_args: -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -G Ninja,
}
- {
name: Linux GCC,
os: ubuntu-latest,
cmake_configure_args: -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -G Ninja,
}
- {
name: MacOS Clang,
os: macos-latest,
cmake_configure_args: -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -G Ninja -D OPENSSL_ROOT_DIR=/usr/local/opt/openssl,
}
build_type:
- Debug
- Release
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up MSVC # NOTE: required to find cl.exe when using the Ninja generator. And we need to use Ninja in order for ccache to be able to cache stuff with MSVC.
if: matrix.config.name == 'Windows MSVC'
uses: ilammy/[email protected]
- name: Cache vcpkg
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
${{ runner.temp }}/vcpkg
key: vcpkg-${{ runner.os }}-${{ hashFiles('**/vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-
- name: Cache vcpkg installed packages
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
${{ runner.temp }}/vcpkg/installed
${{ runner.temp }}/vcpkg/buildtrees
key: vcpkg-packages-${{ runner.os }}-${{ hashFiles('**/vcpkg.json') }}
restore-keys: vcpkg-packages-${{ runner.os }}-
- name: Install vcpkg
if: runner.os == 'Windows'
run: |
if not exist "${{ runner.temp }}\vcpkg" (
git clone https://github.com/microsoft/vcpkg.git ${{ runner.temp }}\vcpkg
cd ${{ runner.temp }}\vcpkg
.\bootstrap-vcpkg.bat
)
shell: cmd
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
${{ runner.temp }}\vcpkg\vcpkg.exe install openssl:x64-windows
shell: cmd
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev mesa-common-dev build-essential libgtk-3-dev
sudo apt-get install -y libssl-dev
sudo apt-get install -y libpulse-dev libasound2-dev
sudo apt-get install -y libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev
- name: Install MacOS dependencies
if: runner.os == 'MacOS'
run: brew install ffmpeg
- name: ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{matrix.config.name}}-${{matrix.build_type}}
- name: Set CMake Toolchain Argument
if: runner.os == 'Windows'
run: echo "CMAKE_TOOLCHAIN_ARG=-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" >> $GITHUB_ENV
shell: bash
- name: Build
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: ${{github.workspace}}/${{env.cmakelists_folder}}/CMakeLists.txt
cmakeAppendedArgs: ${{env.cmake_configure_args}} -D CMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.config.cmake_configure_args}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache ${{ env.CMAKE_TOOLCHAIN_ARG }}
buildWithCMakeArgs: --config ${{matrix.build_type}} --target ${{env.cmake_target}}
cmakeBuildType: ${{matrix.build_type}}
buildDirectory: ${{github.workspace}}/build
- name: Run
run: ${{github.workspace}}/bin/tests/${{matrix.build_type}}/${{matrix.config.name == 'Windows Clang' && matrix.build_type || ''}}/${{env.cmake_target}}