-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (126 loc) · 5.57 KB
/
test.yml
File metadata and controls
155 lines (126 loc) · 5.57 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
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
# Copyright Agustin K-ballo Berge, Fusion Fenix 2026
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
name: test
on:
push:
branches: [ main, feature/** ]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ── Linux / GCC 14 ──
- os: ubuntu-24.04
compiler: gcc-14
preset: dev-gcc
# ── Linux / Clang 18 ──
- os: ubuntu-24.04
compiler: clang-18+libc++
preset: dev-clang-libcxx
# ── macOS 15 / AppleClang 16 ──
- os: macos-15
compiler: apple-clang-16
preset: dev-clang
# ── Windows 2022 / MSVC ──
- os: windows-2022
compiler: msvc
preset: dev-msvc
steps:
- uses: actions/checkout@v5
- name: Set up MSVC environment
if: matrix.compiler == 'msvc'
shell: pwsh
run: |
$vcvars = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmd /c "`"$vcvars`" && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
"$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
}
- name: Install libc++
if: matrix.compiler == 'clang-18+libc++'
run: sudo apt-get install -y libc++-18-dev libc++abi-18-dev
- name: Install Ninja
if: runner.os == 'Linux'
run: sudo apt-get install -y ninja-build
- name: Check CMake Version
run: cmake --version
# -----------------------------------------------------------------------
# Main project
# -----------------------------------------------------------------------
- name: Configure
run: cmake --preset ${{ matrix.preset }} -B build/${{ matrix.preset }}
- name: Build (Debug)
run: cmake --build build/${{ matrix.preset }} --config Debug
- name: Test (Debug)
run: ctest --test-dir build/${{ matrix.preset }} --build-config Debug
--output-on-failure
--no-compress-output
--output-junit test-results-${{ matrix.compiler }}-debug.xml
- name: Build (Release)
run: cmake --build build/${{ matrix.preset }} --config Release
- name: Test (Release)
run: ctest --test-dir build/${{ matrix.preset }} --build-config Release
--output-on-failure
--no-compress-output
--output-junit test-results-${{ matrix.compiler }}-release.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: test-results-${{ matrix.compiler }}
path: build/${{ matrix.preset }}/test-results-*.xml
retention-days: 30
# -----------------------------------------------------------------------
# FetchContent variant — simulates embedding via FetchContent_MakeAvailable
# -----------------------------------------------------------------------
- name: Copy Preset (FetchContent)
run: cp ./CMakePresets.json test/cmake-fetch_content
- name: Test Consumer (FetchContent) — Configure
working-directory: test/cmake-fetch_content
run: cmake --preset ${{ matrix.preset }} -B build-consumer-fetch_content
-DEGGS_FLAT_MAP_SOURCE_DIR=${{ github.workspace }}
- name: Test Consumer (FetchContent) — Build
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content --config Debug
- name: Test Consumer (FetchContent) — Test
working-directory: test/cmake-fetch_content
run: ctest --test-dir build-consumer-fetch_content --build-config Debug
--output-on-failure
# -----------------------------------------------------------------------
# Install variant — simulates a real end-user find_package workflow
# -----------------------------------------------------------------------
- name: Test Install
run: cmake --install build/${{ matrix.preset }}
--prefix ${{ runner.temp }}/eggs-flat_map-install
--config Release
- name: Upload installed package
uses: actions/upload-artifact@v6
with:
name: installed-package-${{ matrix.compiler }}
path: ${{ runner.temp }}/eggs-flat_map-install
if-no-files-found: error
retention-days: 7
- name: Clean Source and Build Tree
run: cmake -E rm -rf ./include ./src ./build
- name: Copy Preset (find_package)
run: cp ./CMakePresets.json test/cmake-find_package
- name: Test Consumer (find_package) — Configure
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-flat_map-install
--debug-find-pkg=Eggs.FlatMap
- name: Test Consumer (find_package) — Build
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package --config Debug
- name: Test Consumer (find_package) — Test
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package --build-config Debug
--output-on-failure