-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (125 loc) · 4.3 KB
/
ci.yml
File metadata and controls
138 lines (125 loc) · 4.3 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
BUILD_TYPE: Release
TEST_BUILD_TYPE: Debug
NON_INTERACTIVE_TESTS: |
TestApiProviderOption
TestBase64
TestBruteForceLimiter
TestCache
TestChaCha20Poly1305
TestCounter
TestCryptoKdfHkdfSha256
TestDatabase /tmp/tui-test.db
TestEcdhePsk
TestEd25519
TestFakeCredentialGenerator
TestHttpClient
TestHttpStreamResponseParser
TestRegister username password
TestResourceVersionManager
TestRpcServer
TestSecureSession
TestSpake2p
TestSqlite /tmp/tui-test.db
TestStreamBatcher
TestTevInjectionQueue
TestTlv
TestUtf8
TestUuid
TestWorkerThread
TestZstdMessageCodec
jobs:
build-and-test:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install base packages
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
pkg-config \
curl \
git \
libcurl4-openssl-dev \
libsqlite3-dev \
uuid-dev \
nlohmann-json3-dev \
libssl-dev \
valgrind \
libzstd-dev
- name: Install libsodium (>=1.0.19) from source
run: |
set -euo pipefail
curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.20-stable.tar.gz -o /tmp/libsodium.tar.gz
tar -xf /tmp/libsodium.tar.gz -C /tmp
pushd /tmp/libsodium-stable
./configure --enable-shared
make -j"$(nproc)"
sudo make install
sudo ldconfig
popd
- name: Install libtev-cpp from source
run: |
set -euo pipefail
git clone --depth=1 https://github.com/chemwolf6922/tiny-event-loop-cpp /tmp/tev-cpp
cmake -S /tmp/tev-cpp -B /tmp/tev-cpp/build -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build /tmp/tev-cpp/build --parallel
sudo cmake --install /tmp/tev-cpp/build
sudo ldconfig
- name: Install js-style-co-routine from source
run: |
set -euo pipefail
git clone --depth=1 https://github.com/chemwolf6922/js-style-co-routine /tmp/js-style-co-routine
cmake -S /tmp/js-style-co-routine -B /tmp/js-style-co-routine/build -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build /tmp/js-style-co-routine/build --parallel
sudo cmake --install /tmp/js-style-co-routine/build
sudo ldconfig
- name: Install tiny-websocket from source
run: |
set -euo pipefail
git clone --depth=1 --recursive https://github.com/chemwolf6922/tiny-websocket /tmp/tiny-websocket
cmake -S /tmp/tiny-websocket -B /tmp/tiny-websocket/build -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build /tmp/tiny-websocket/build --parallel
sudo cmake --install /tmp/tiny-websocket/build
sudo ldconfig
- name: Configure main build
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="$BUILD_TYPE"
- name: Build binaries
run: cmake --build build --parallel
- name: Configure tests
run: cmake -S test -B test/build -DCMAKE_BUILD_TYPE="$TEST_BUILD_TYPE"
- name: Build tests
run: cmake --build test/build --parallel
- name: Run selected non-interactive tests with valgrind
if: env.NON_INTERACTIVE_TESTS != ''
run: |
set -euo pipefail
mapfile -t tests < <(printf '%s\n' "$NON_INTERACTIVE_TESTS" | sed '/^$/d' | sed '/^#/d')
pushd test/build
for line in "${tests[@]}"; do
set -- $line
bin="$1"
shift || true
if [[ -z "$bin" ]]; then
continue
fi
if [[ ! -x "$bin" ]]; then
echo "Missing test binary: $PWD/$bin" >&2
exit 1
fi
echo "::group::valgrind $bin $*"
valgrind --leak-check=full --errors-for-leak-kinds=definite,possible --error-exitcode=42 "./$bin" "$@"
echo "::endgroup::"
done
popd