-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (133 loc) · 4.98 KB
/
ci.yml
File metadata and controls
157 lines (133 loc) · 4.98 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
name: CI Build & Test
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
BUILD_TYPE: Release
jobs:
build-native:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x86_64
- os: macos-14
platform: darwin-arm64
- os: windows-2022
platform: windows-x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
key: fetchcontent-${{ matrix.os }}-${{ hashFiles('cmake/libraries/*.cmake', 'CMakeLists.txt') }}
restore-keys: |
fetchcontent-${{ matrix.os }}-
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libssl-dev
- name: Set OpenSSL path (macOS)
if: runner.os == 'macOS'
run: |
echo "OPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3" >> "$GITHUB_ENV"
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install ninja openssl -y
- name: Set up MSVC environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: "Use D: drive for build (Windows)"
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Path "D:\build" -Force
if (Test-Path "build\_deps") {
Copy-Item -Recurse -Force "build\_deps" "D:\build\_deps"
}
Remove-Item -Recurse -Force "build" -ErrorAction SilentlyContinue
New-Item -ItemType Junction -Path "build" -Target "D:\build"
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
run: |
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DBUILD_TESTING=ON
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$opensslRoot = "C:\Program Files\OpenSSL-Win64"
if (-not (Test-Path $opensslRoot)) {
$opensslRoot = "C:\Program Files\OpenSSL"
}
# Choco OpenSSL puts .lib files in lib/VC/x64/MD/ — locate them explicitly
$cryptoLib = Get-ChildItem "$opensslRoot" -Recurse -Filter "libcrypto.lib" -ErrorAction SilentlyContinue | Select-Object -First 1
$sslLib = Get-ChildItem "$opensslRoot" -Recurse -Filter "libssl.lib" -ErrorAction SilentlyContinue | Select-Object -First 1
$cmakeArgs = @(
"-B", "build",
"-G", "Ninja",
"-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}",
"-DBUILD_TESTING=ON",
"-DOPENSSL_ROOT_DIR=$opensslRoot"
)
if ($cryptoLib) { $cmakeArgs += "-DOPENSSL_CRYPTO_LIBRARY=$($cryptoLib.FullName)" }
if ($sslLib) { $cmakeArgs += "-DOPENSSL_SSL_LIBRARY=$($sslLib.FullName)" }
cmake @cmakeArgs
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
- name: Run tests
run: ctest --test-dir build --output-on-failure -C ${{ env.BUILD_TYPE }}
build-linux-distros:
strategy:
fail-fast: false
matrix:
include:
- container: debian:bookworm
platform: linux-x86_64-deb
install_cmd: >-
apt-get update &&
apt-get install -y cmake ninja-build g++ libssl-dev git ca-certificates curl
- container: fedora:40
platform: linux-x86_64-rpm
install_cmd: >-
dnf install -y cmake ninja-build gcc-c++ openssl-devel git
- container: archlinux:latest
platform: linux-x86_64-arch
install_cmd: >-
pacman -Syu --noconfirm cmake ninja gcc openssl git
runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
- name: Install dependencies
run: ${{ matrix.install_cmd }}
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- uses: actions/checkout@v4
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
key: fetchcontent-${{ matrix.container }}-${{ hashFiles('cmake/libraries/*.cmake', 'CMakeLists.txt') }}
restore-keys: |
fetchcontent-${{ matrix.container }}-
- name: Configure CMake
run: |
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DBUILD_TESTING=ON
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
- name: Run tests
run: ctest --test-dir build --output-on-failure -C ${{ env.BUILD_TYPE }}