Repository navigation
213 lines (198 loc) · 6.77 KB
/
Copy pathci.yml
File metadata and controls
213 lines (198 loc) · 6.77 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#
# Created: 13th October 2026
# Updated: 13th October 2026
#
name: CI
on:
push:
branches:
- master
- dev
- boilerplate
- idiomatic
- rc1
- rc2
- rc3
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
cell:
name: CI (${{ matrix.id }})
strategy:
fail-fast: false
matrix:
include:
- id: linux-clang
os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- id: linux-gcc
os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- id: macos-clang
os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- id: macos-gcc
os: macos-latest
c_compiler: gcc
cpp_compiler: g++
- id: windows-cl
os: windows-latest
c_compiler: cl
cpp_compiler: cl
# `toolchain` carries what is not a compiler: MinGW needs its own
# generator and PATH, but the compilers it drives are gcc and g++
- id: windows-mingw
os: windows-latest
c_compiler: gcc
cpp_compiler: g++
toolchain: mingw
uses: ./.github/workflows/ci-cell.yml
with:
cell-id: ${{ matrix.id }}
os: ${{ matrix.os }}
c-compiler: ${{ matrix.c_compiler }}
cpp-compiler: ${{ matrix.cpp_compiler }}
build-type: Release
toolchain: ${{ matrix.toolchain }}
secrets: inherit
install-smoke:
name: Install smoke (${{ matrix.os }}, ${{ matrix.toolchain || matrix.c_compiler }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: windows-latest
c_compiler: gcc
cpp_compiler: g++
toolchain: mingw
steps:
- uses: actions/checkout@v4
- name: Install Clang (Ubuntu)
if: runner.os == 'Linux' && matrix.c_compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang
- name: Setup MSYS2 MinGW
if: runner.os == 'Windows' && matrix.toolchain == 'mingw'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
- name: Configure
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake -B build -S . \
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
elif [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake -B build -S . -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
else
cmake -B build -S . \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
fi
- name: Build
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake --build build --config "${{ env.BUILD_TYPE }}" --parallel
elif [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake --build build --parallel 2
else
cmake --build build --parallel
fi
- name: Install
shell: bash
run: |
set -euo pipefail
PREFIX="${RUNNER_TEMP}/install-prefix"
echo "INSTALL_PREFIX=$PREFIX" >> "$GITHUB_ENV"
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake --install build --config "${{ env.BUILD_TYPE }}" --prefix "$PREFIX"
else
cmake --install build --prefix "$PREFIX"
fi
- name: Verify install tree
shell: bash
run: |
set -euo pipefail
test -f "${INSTALL_PREFIX}/include/libpath/libpath.h"
test -f "${INSTALL_PREFIX}/lib/cmake/libpath/libpath-config.cmake"
- name: Configure and run install smoke consumer
shell: bash
run: |
set -euo pipefail
CONSUMER="${RUNNER_TEMP}/consumer"
mkdir -p "$CONSUMER"
cat > "$CONSUMER/CMakeLists.txt" <<'EOF'
cmake_minimum_required(VERSION 3.13)
project(libpath_install_smoke C)
find_package(libpath REQUIRED)
add_executable(consumer consumer.c)
target_link_libraries(consumer PRIVATE libpath::core)
EOF
cat > "$CONSUMER/consumer.c" <<'EOF'
#include <libpath/libpath.h>
int main(void) { return 0; }
EOF
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake -S "$CONSUMER" -B consumer-build \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --config "${{ env.BUILD_TYPE }}" --parallel
consumer-build/${{ env.BUILD_TYPE }}/consumer.exe
elif [ "${{ matrix.toolchain }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake -S "$CONSUMER" -B consumer-build -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --parallel 2
consumer-build/consumer.exe
else
cmake -S "$CONSUMER" -B consumer-build \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --parallel
consumer-build/consumer
fi