-
Notifications
You must be signed in to change notification settings - Fork 97
254 lines (231 loc) · 8.99 KB
/
linux.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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Linux tests
on:
push:
branches: [ '*' ]
pull_request:
branches: [ "main" ]
jobs:
coding_style_tests:
uses: ./.github/workflows/coding_style.yml
linux_baseline:
runs-on: ubuntu-latest
needs: [coding_style_tests]
strategy:
fail-fast: false
matrix:
cmake-params: [ "", "-DOQS_KEM_ENCODERS=ON" ]
container:
image: openquantumsafe/ci-ubuntu-jammy:latest
env:
MAKE_PARAMS: "-j 18"
LIBOQS_BRANCH: "main"
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Full build
run: OQSPROV_CMAKE_PARAMS=${{ matrix.cmake-params}} ./scripts/fullbuild.sh
- name: Enable sibling oqsprovider for testing
run: cd _build/lib && ln -s oqsprovider.so oqsprovider2.so
- name: Test
run: ./scripts/runtests.sh -V
linux_intel:
runs-on: ubuntu-latest
needs: [coding_style_tests]
strategy:
fail-fast: false
matrix:
ossl-branch: [openssl-3.1.0, master]
include:
- name: alpine
container: openquantumsafe/ci-alpine-amd64:latest
# focal test done on CircleCI - save the compute cycles here until CCI is dropped
# - name: focal
# container: openquantumsafe/ci-ubuntu-focal-x86_64:latest
- name: jammy
container: openquantumsafe/ci-ubuntu-jammy:latest
container:
image: ${{ matrix.container }}
env:
MAKE_PARAMS: "-j 18"
LIBOQS_BRANCH: "main"
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Full build
run: OPENSSL_BRANCH=${{ matrix.ossl-branch }} ./scripts/fullbuild.sh
- name: Enable sibling oqsprovider for testing
run: cd _build/lib && ln -s oqsprovider.so oqsprovider2.so
- name: Test
run: ./scripts/runtests.sh -V
- name: Verify nothing changes on re-generate code
run: |
apt-get update && apt-get install -y clang-format && \
git config --global user.name "ciuser" && \
git config --global user.email "[email protected]" && \
git config --global --add safe.directory `pwd` && \
export LIBOQS_SRC_DIR=`pwd`/liboqs && \
! pip3 install -r oqs-template/requirements.txt 2>&1 | grep ERROR && \
python3 oqs-template/generate.py && \
./scripts/do_code_format.sh --no-dry-run && \
git diff && \
! git status | grep modified
- name: Build .deb install package
run: cpack -C DebPack
working-directory: _build
- name: Retain .deb installer
uses: actions/upload-artifact@v3
with:
name: oqsprovider-x64
path: _build/*.deb
- name: Verify that the static library is copied to the install directory.
run: |
OPENSSL_BRANCH=${{ matrix.ossl-branch }} OQSPROV_CMAKE_PARAMS="-DOQS_PROVIDER_BUILD_STATIC=ON" ./scripts/fullbuild.sh -f && \
mkdir -p _sysroot/ && \
cmake --install _build --prefix _sysroot/ && \
stat _sysroot/lib/liboqsprovider.a
asan_linux_intel:
name: "Security checks"
runs-on: ubuntu-latest
needs: [coding_style_tests]
strategy:
fail-fast: false
container:
image: openquantumsafe/ci-ubuntu-jammy:latest
env:
CC: "clang"
CXX: "clang++"
ASAN_C_FLAGS: "-fsanitize=address -fno-omit-frame-pointer"
ASAN_OPTIONS: "detect_stack_use_after_return=1,detect_leaks=1"
OPENSSL_BRANCH: "openssl-3.1"
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Install dependencies
run: apt-get update && apt-get install -y clang llvm ninja-build git cmake libclang-14-dev libclang-common-14-dev
- name: Clone and build OpenSSL(3) with ASan
run: |
git clone --depth=1 --branch "${OPENSSL_BRANCH}" https://github.com/openssl/openssl.git openssl
cd openssl
mkdir install
./Configure --openssldir="${PWD}/install" \
--prefix="${PWD}/install" \
--debug \
enable-asan \
no-tests
make -j$(nproc)
make install_sw
cd ..
- name: Clone and build liboqs with ASan
run: |
git clone --depth=1 --branch main https://github.com/open-quantum-safe/liboqs.git liboqs
cd liboqs
mkdir build install
cmake -GNinja -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DOQS_USE_OPENSSL=OFF \
-DCMAKE_C_FLAGS="${ASAN_C_FLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${ASAN_C_FLAGS}" \
-DCMAKE_INSTALL_PREFIX="${PWD}/install"
cmake --build build -j$(nproc)
cmake --install build
cd ..
- name: Build oqs-provider with ASan
run: |
cmake -GNinja -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DOPENSSL_ROOT_DIR="$PWD/openssl/install" \
-Dliboqs_DIR="$PWD/liboqs/install/lib/cmake/liboqs" \
-DCMAKE_C_FLAGS="${ASAN_C_FLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${ASAN_C_FLAGS}"
cmake --build build -j$(nproc)
- name: Verify that test binaries are linked against ASan
run: |
find build/test/ -type f -perm '/u=x' | while read -r test_bin; do
if ! nm "${test_bin}" | grep -q '__local_asan_preinit'; then
echo "ASan not found in ${test_bin}"
exit 1
fi
done
- name: Run tests
run: |
ctest --test-dir build \
--output-on-failure \
--extra-verbose
linux_aarch64:
name: "aarch64 cross-compilation"
runs-on: ubuntu-latest
needs: [coding_style_tests]
strategy:
fail-fast: false
container:
image: openquantumsafe/ci-ubuntu-jammy:latest
env:
OPENSSL_BRANCH: "master"
INSTALL_DIR: "/opt/install"
CMAKE_TOOLCHAIN_FILE: "/opt/linux-aarch64-toolchain.cmake"
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4
- name: Install dependencies
run: apt-get update && apt-get install -y ninja-build git cmake nodejs gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
- name: Prepare install directory
run: mkdir -p "${INSTALL_DIR}"
- name: Clone and build OpenSSL(3) for linux-aarch64
working-directory: /opt/
run: |
git clone --depth=1 --branch "${OPENSSL_BRANCH}" https://github.com/openssl/openssl.git openssl
cd openssl
./Configure linux-aarch64 no-tests --prefix="${INSTALL_DIR}" \
--openssldir="${INSTALL_DIR}" \
--cross-compile-prefix=aarch64-linux-gnu- \
--release
make -j$(nproc)
make install_sw
- name: Write CMake toolchain file for liboqs and oqs-provider
run: |
echo "set(CMAKE_SYSTEM_NAME Linux) \n
set(CMAKE_SYSTEM_PROCESSOR aarch64) \n
set(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")\n" > "${CMAKE_TOOLCHAIN_FILE}"
- name: Clone and build liboqs for linux-aarch64
working-directory: /opt/
run: |
git clone --depth=1 --branch main https://github.com/open-quantum-safe/liboqs.git liboqs
cd liboqs
mkdir build install
cmake --toolchain "${CMAKE_TOOLCHAIN_FILE}" \
-GNinja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DOQS_USE_OPENSSL=OFF
cmake --build build -j$(nproc)
cmake --install build
- name: Build oqs-provider for linux-aarch64
run: |
cmake --toolchain "${CMAKE_TOOLCHAIN_FILE}" \
-GNinja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DOPENSSL_ROOT_DIR="${INSTALL_DIR}" \
-Dliboqs_DIR="${INSTALL_DIR}/lib/cmake/liboqs"
cmake --build build -j$(nproc)
cmake --install build
- name: Run tests with qemu-aarch64
run: |
cmake -B build -DCMAKE_CROSSCOMPILING_EMULATOR="qemu-aarch64;-L;/usr/aarch64-linux-gnu"
ctest --test-dir build/
- name: Build .deb install package
run: |
cpack \
--toolchain "${CMAKE_TOOLCHAIN_FILE}" \
-C DebPack \
-DCMAKE_INSTALL_PREFIX=/usr
working-directory: build
- name: Verify the .deb file target architecture.
working-directory: build
run: |
dpkg -I oqs-provider-*.deb | grep -q "Architecture: arm64"
- name: Retain .deb installer
uses: actions/upload-artifact@v3
with:
name: oqsprovider-aarch64
path: build/*.deb