forked from ridiculousfish/libdivide
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (101 loc) · 4.07 KB
/
Copy pathfull_build.yml
File metadata and controls
114 lines (101 loc) · 4.07 KB
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
name: Full Build and Test
on:
# This job takes a long time to run, so only run it when the canary build passes
# Ideally we'd use the workflow_run trigger and have GitHub launch this action, but the docs state:
# This event will only trigger a workflow run if the workflow file is on the default branch.
# ...which leads to some interesting behaviors
workflow_call:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
Full-Build-Ubuntu:
runs-on: ${{ matrix.os }}
strategy:
# We want to test all matrix combinations regardless of failure
fail-fast: false
matrix:
os:
- ubuntu-24.04
- ubuntu-22.04
build_type:
- Release
- Sanitize
cpp_compiler:
- g++
- clang++
env:
output_folder: ${{github.workspace}}/build/
steps:
- uses: actions/checkout@v5
- name: Configure CMake & Build
env:
C_COMPILER: ${{ matrix.cpp_compiler == 'g++' && 'gcc' || 'clang' }}
CXX_COMPILER: ${{ matrix.cpp_compiler }}
BUILD_TYPE: ${{ matrix.build_type }}
run: |
cmake -B "$output_folder" \
"-DCMAKE_C_COMPILER=$C_COMPILER" \
"-DCMAKE_CXX_COMPILER=$CXX_COMPILER" \
-DLIBDIVIDE_BUILD_TESTS=ON \
"-DCMAKE_BUILD_TYPE=$BUILD_TYPE"
cmake --build "$output_folder" --config "$BUILD_TYPE"
- name: Test
working-directory: ${{ env.output_folder }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }} --verbose
Full-Build-Windows:
runs-on: ${{ matrix.os }}
strategy:
# We want to test all matrix combinations regardless of failure
fail-fast: false
# This makes development easier
# max-parallel: 0
matrix:
os:
- windows-2022
- windows-2025
build_type:
- Release
- Sanitize
cpp_compiler:
- clang-cl.exe
- cl.exe
include:
# Set generator per os
# Note: These *expand* the existing matrix configurations, it doesn't create new matrix configurations
# See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
- os: windows-2022
generator: Visual Studio 17 2022
vs_install_path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise
- os: windows-2025
generator: Visual Studio 18 2026
vs_install_path: C:\Program Files\Microsoft Visual Studio\18\Enterprise
# clang-cl requires the toolset flag be set correctly
- cpp_compiler: clang-cl.exe
toolset: ClangCL
exclude:
# MSVC Clang toolchain fails sanitization
- cpp_compiler: clang-cl.exe
build_type: Sanitize
env:
output_folder: ${{github.workspace}}/build/
steps:
- uses: actions/checkout@v5
- name: Configure CMake, Build & Test
env:
SANITIZER_OPTION: ${{ matrix.build_type == 'Sanitize' && '-DLIBDIVIDE_ENABLE_SANITIZERS=ON' || '' }}
TOOLSET_ARGS: ${{ matrix.toolset && format('-T {0}', matrix.toolset) || '' }}
shell: cmd
run: |
call "${{ matrix.vs_install_path }}\VC\Auxiliary\Build\vcvarsall.bat" x64 && ^
cmake -B "%output_folder%" ^
-G "${{ matrix.generator }}" ^
-DCMAKE_C_COMPILER=${{ matrix.cpp_compiler }} ^
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} ^
-DLIBDIVIDE_BUILD_TESTS=ON ^
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^
%SANITIZER_OPTION% %TOOLSET_ARGS% && ^
cmake --build "%output_folder%" --config ${{ matrix.build_type }} && ^
cd /d "%output_folder%" && ^
ctest --build-config ${{ matrix.build_type }} --verbose