-
Notifications
You must be signed in to change notification settings - Fork 7
149 lines (128 loc) · 4.01 KB
/
cmake.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: C/C++ CI
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: ${{ matrix.target }}-${{ matrix.tls }}
runs-on: ${{ matrix.image }}-latest
env:
CI_CACHE: '${{ github.workspace }}/.ci.cache'
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_BINARY_SOURCES: 'clear;files,${{ github.workspace }}/.ci.cache,readwrite'
VCPKG_DEFAULT_TRIPLET: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- image: ubuntu
tls: openssl
target: x64-linux
- image: ubuntu
tls: mbedtls
target: x64-linux
- image: macOS
tls: openssl
target: arm64-osx
- image: macOS
tls: mbedtls
target: arm64-osx
- image: windows
tls: openssl
target: x64-windows-static-md
- image: windows
tls: openssl
target: x64-mingw-static
- image: windows
tls: mbedtls
target: x64-windows-static-md
steps:
- name: Install tools
if: matrix.image == 'ubuntu'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: valgrind softhsm2
- name: Install tools
if: matrix.image == 'macOS'
run: |
brew install pkg-config softhsm
- name: Add msbuild to PATH
if: matrix.image == 'windows'
uses: microsoft/setup-msbuild@v2
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: lukka/get-cmake@latest
- name: create cache dir
shell: bash
run: |
mkdir -p ${CI_CACHE}
- name: Cache ${{ matrix.target }} deps
id: cache
uses: actions/cache@v4
with:
save-always: true
path: ${{ env.CI_CACHE }}
key: dep-${{ matrix.target }}-${{ matrix.tls }}-${{ hashFiles('./vcpkg.json') }}
restore-keys: |
dep-${{ matrix.target }}-${{ matrix.tls }}-
dep-${{ matrix.target }}-
- uses: lukka/run-vcpkg@v11
with:
doNotCache: false
runVcpkgInstall: false
- uses: lukka/run-cmake@v10
name: Configure build
with:
configurePreset: ${{ matrix.target }}
configurePresetAdditionalArgs: "[ `-DTLSUV_TLSLIB=${{ matrix.tls }}`, `-DVCPKG_MANIFEST_FEATURES='test;samples;${{ matrix.tls }}'` ]"
- name: Build
id: build
run: |
cmake --build build
- name: Setup Golang with cache
uses: actions/setup-go@v5
with:
go-version-file: tests/test_server/go.mod
cache-dependency-path: tests/test_server/go.sum
- name: build test server
run: |
cd ./tests/test_server
go build -o ${{ github.workspace }}/build/ .
- name: start test server
if: matrix.image != 'windows'
run: |
${{ github.workspace }}/build/test-server -ca-key ./tests/certs/ca.key -ca ./tests/certs/ca.pem &
- name: start test server
if: matrix.image == 'windows'
run: |
Start-Process -FilePath ${{ github.workspace }}/build/test-server -ArgumentList "-ca-key","./tests/certs/ca.key","-ca","./tests/certs/ca.pem"
- name: Test
env:
TLSUV_TEST_LOG: 7
if: steps.build.outcome == 'success'
run: |
cd build
ctest --output-on-failure --no-compress-output -T test
- name: Memory Check
if: steps.build.outcome == 'success' && matrix.image == 'ubuntu'
env:
TLSUV_TEST_LOG: 7
run: |
cd build
ctest --output-on-failure --no-compress-output -T memcheck
- name: upload test summary
if: always()
uses: mikepenz/action-junit-report@v4
with:
detailed_summary: 'true'
report_paths: ${{ github.workspace }}/build/**/TEST-*.xml
- name: upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-${{ matrix.tls }}-TestReport
path: ${{ github.workspace }}/build/Testing/