-
Notifications
You must be signed in to change notification settings - Fork 9
154 lines (128 loc) · 4.28 KB
/
Copy pathci.yaml
File metadata and controls
154 lines (128 loc) · 4.28 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
codestyle:
name: Code Style Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Full history needed for diff against main
- name: Fetch main branch
run: git fetch origin main:refs/remotes/origin/main
- name: Install clang-format from LLVM repository
run: |
# Add LLVM GPG key
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
# Add LLVM repository
CODENAME=$(lsb_release -cs)
echo "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list
# Install clang-format-18 and generic clang-format
sudo apt-get update
sudo apt-get install -y clang-format-18 clang-format
- name: Check code style
env:
CI: true
run: ./scripts/codestyle/format_diff.sh -v .
- name: Upload format diff
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: format-diff
path: diff.md
tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: codestyle
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
ninja-build \
pkg-config \
libssl-dev \
libwebsockets-dev \
libcjson-dev \
libavahi-compat-libdnssd-dev
- name: Configure tests
run: cmake -B tests/build -S tests -G Ninja
- name: Build tests
run: cmake --build tests/build
- name: Run tests
run: ctest --test-dir tests/build --output-on-failure
build-linux:
name: Build (Linux)
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
ninja-build \
pkg-config \
libssl-dev \
libwebsockets-dev \
libcjson-dev \
libavahi-compat-libdnssd-dev
- name: Configure
run: cmake -B build -G Ninja
- name: Build
run: cmake --build build
build-windows:
name: Build (Windows)
runs-on: windows-latest
needs: tests
env:
VCPKG_ROOT: C:\vcpkg
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Cache vcpkg packages
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: C:\vcpkg\installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
restore-keys: vcpkg-${{ runner.os }}
- name: Configure
shell: pwsh
run: |
cmake -B build `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DVCPKG_INSTALLED_DIR="$env:VCPKG_ROOT\installed"
- name: Build
run: cmake --build build --config Release
build-macos:
name: Build (macOS)
runs-on: macos-latest
needs: tests
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
run: |
brew install openssl@3 libwebsockets cjson ninja
- name: Configure
run: |
cmake -B build -G Ninja \
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) \
-DOPENSSL_INCLUDE_DIR=$(brew --prefix openssl@3)/include \
-DOPENSSL_CRYPTO_LIBRARY=$(brew --prefix openssl@3)/lib/libcrypto.dylib \
-DOPENSSL_SSL_LIBRARY=$(brew --prefix openssl@3)/lib/libssl.dylib
- name: Build
run: cmake --build build