-
Notifications
You must be signed in to change notification settings - Fork 23
419 lines (370 loc) · 15.9 KB
/
github-ci.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Build and Test
on:
# By default this will run when the activity type is "opened", "synchronize",
# or "reopened".
pull_request:
branches:
- main
# Run when protected branches are pushed to, e.g. via merge
push:
branches:
- main
# Manually run this workflow on any specified branch.
workflow_dispatch:
################
# Ubuntu 22.04 #
################
jobs:
format:
name: Format
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# Required for pre-commit
- run: pip3 install bandit black cpplint docker mypy pydantic==1.10.4 pylint pylint-pydantic types-toml
- run: sudo snap install shfmt
- run: sudo apt install shellcheck
# NOTE: This is deprecated in favor of pre-commit.ci
- uses: pre-commit/[email protected]
with:
extra_args: --all-files
test-hekit-bash:
name: Test hekit commands (bash)
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup
run: |
pip3 install docker pytest pytest-mock pytest-xdist toml
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run pytests
run: pytest tests/ -n 8 --dist loadgroup
- name: hekit init
run: |
export SHELL=/bin/bash
./hekit init <<< y
source /home/runner/.bash_profile
cd .. && hekit -h
test-hekit-zshell:
name: Test hekit commands (zshell)
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup
run: |
pip3 install docker pytest pytest-mock pytest-xdist toml
sudo apt install zsh -y
touch ~/.zshrc
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run pytests
shell: zsh {0}
run: pytest tests/ -n 8 --dist loadgroup
- name: hekit init
shell: zsh {0}
run: |
export SHELL=/bin/zsh
./hekit --debug init <<< y
source /home/runner/.zshrc
cd .. && hekit -h
build-and-test-toolkit-palisade:
name: HEKit PALISADE | ${{ matrix.os }} ${{ matrix.c_compiler }} py${{ matrix.python-version }}
# Disable this job for now as it fails due to HEXL-PALISADE issue
# (fixed in HEXL 1.2.5 re-enable when we can update the HEXL version)
if: ${{ false }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
# python3.10 is default on Ubuntu-22.04
python-version: ["3.10"]
c_compiler: [clang-14, gcc-11]
os: [ubuntu-22.04]
include:
# pairing cc compiler with relevant cxx compiler
# clang-14 and gcc-11 default on Ubuntu-22.04
- c_compiler: clang-14
cxx_compiler: clang++-14
- c_compiler: gcc-11
cxx_compiler: g++-11
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup
run: |
pip3 install toml
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "CC=${{matrix.c_compiler}}" >> $GITHUB_ENV
echo "CXX=${{matrix.cxx_compiler}}" >> $GITHUB_ENV
- name: Build and install PALISADE and sample kernels recipe
run: |
./hekit --config default.config install .github/hekit-recipes/palisade.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config default.config list
echo "PALISADE_KERNELS_BUILD_DIR=$HOME/.hekit/components/sample-kernels/palisade/build" >> $GITHUB_ENV
- name: Run unit tests
run: ${PALISADE_KERNELS_BUILD_DIR}/test/unit-test
# PALISADE sample kernels
- name: Run PALISADE sample kernels
run: KMP_WARNINGS=0 OMP_NUM_THREADS=5 ${PALISADE_KERNELS_BUILD_DIR}/sample-kernels-palisade --benchmark_out_format=json --benchmark_out="${GITHUB_JOB}_sample-kernels-palisade_${GITHUB_SHA}.json"
- name: Archive PALISADE sample kernel results
uses: actions/upload-artifact@v3
with:
name: ${{github.job}}_sample-kernels-palisade_${{github.sha}}.json
path: ${{github.job}}_sample-kernels-palisade_${{github.sha}}.json
retention-days: 90 # Maximum for free version
build-and-test-toolkit-helib:
name: HEKit HElib | ${{ matrix.os }} ${{ matrix.c_compiler }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
# python3.10 is default on Ubuntu-22.04
python-version: ["3.10"]
c_compiler: [clang-14, gcc-11]
os: [ubuntu-22.04]
include:
# pairing cc compiler with relevant cxx compiler
# clang-14 and gcc-11 default on Ubuntu-22.04
- c_compiler: clang-14
cxx_compiler: clang++-14
- c_compiler: gcc-11
cxx_compiler: g++-11
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup
run: |
pip3 install toml pydantic==1.10.4 pytest
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "CC=${{matrix.c_compiler}}" >> $GITHUB_ENV
echo "CXX=${{matrix.cxx_compiler}}" >> $GITHUB_ENV
echo "python-version=${{matrix.python-version}}" >> $GITHUB_ENV
python --version
- name: Build and install HElib and example recipe
run: |
./hekit --config default.config install .github/hekit-recipes/helib.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config default.config list
echo "PSI_BUILD_DIR=$HOME/.hekit/components/examples/psi/build" >> $GITHUB_ENV
- name: Run PSI example
run: |
echo -e "apple\nBanana\ncat\nBa-Ra\nCalifornia" > client.set
${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/fruits.set | grep -B 1 "apple"
${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/ancient_egyptian_gods.set | grep -B 1 "Ba-Ra"
${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/us_states.set | grep -B 1 "California"
- name: Build PSI config tests
run: |
./hekit --config default.config install recipes/config-psi.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config default.config list
echo "CONFIG_PSI_TEST_DIR=$HOME/.hekit/components/psi/configurable-psi/build" >> $GITHUB_ENV
- name: Run PSI config unit tests
run: ${CONFIG_PSI_TEST_DIR}/bin/unit-test
- name: Run PSI config pytests
run: |
source deployments/config_psi/setenv.sh
pytest deployments/config_psi/tests/
pytest deployments/config_psi/scripts/tests/
build-and-test-toolkit-seal:
name: HEKit SEAL | ${{ matrix.os }} ${{ matrix.c_compiler }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
# python3.10 is default on Ubuntu-22.04
python-version: ["3.10"]
c_compiler: [clang-14, gcc-11]
os: [ubuntu-22.04]
include:
# pairing cc compiler with relevant cxx compiler
# clang-14 and gcc-11 default on Ubuntu-22.04
- c_compiler: clang-14
cxx_compiler: clang++-14
- c_compiler: gcc-11
cxx_compiler: g++-11
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup
run: |
pip3 install toml
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "CC=${{matrix.c_compiler}}" >> $GITHUB_ENV
echo "CXX=${{matrix.cxx_compiler}}" >> $GITHUB_ENV
echo "python-version=${{ matrix.python-version }}">> $GITHUB_ENV
python --version
- name: he-toolkit-seal-ubuntu-22
if: matrix.os == 'ubuntu-22.04' && matrix.c_compiler == 'clang-14'
run: |
sudo apt install libomp-dev
- name: Build and install SEAL, examples, and sample kernels recipe
run: |
./hekit --config default.config install .github/hekit-recipes/seal.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config default.config list
echo "QUERY_BUILD_DIR=$HOME/.hekit/components/examples/secure-query/build" >> $GITHUB_ENV
echo "LR_BUILD_DIR=$HOME/.hekit/components/examples/logistic-regression/build" >> $GITHUB_ENV
echo "SEAL_KERNELS_BUILD_DIR=$HOME/.hekit/components/sample-kernels/seal/build" >> $GITHUB_ENV
- name: Run Secure Query example
run: |
cd ${QUERY_BUILD_DIR}
echo -n "Input: Louisiana, " && ./secure-query <<< $'\n\nLouisiana\n' | grep "Baton Rouge"
echo -n "Input: North Dakota, " && ./secure-query <<< $'\n\nNorth Dakota\n' | grep "Bismarck"
echo -n "Input: Wyoming, " && ./secure-query <<< $'\n\nWyoming\n' | grep "Cheyenne"
- name: Run LR example
run: |
cd ${LR_BUILD_DIR}
./lr_test --compare --data lrtest_large | grep "All match!"
- name: Run sample kernels unit test
run: ${SEAL_KERNELS_BUILD_DIR}/test/unit-test
# SEAL sample kernels
- name: Run SEAL sample kernels
run: KMP_WARNINGS=0 OMP_NUM_THREADS=5 ${SEAL_KERNELS_BUILD_DIR}/sample-kernels-seal --benchmark_out_format=json --benchmark_out="${GITHUB_JOB}_sample-kernels-seal_${GITHUB_SHA}.json"
- name: Archive SEAL sample kernel results
uses: actions/upload-artifact@v3
with:
name: ${{github.job}}_sample-kernels-seal_${{github.sha}}.json
path: ${{github.job}}_sample-kernels-seal_${{github.sha}}.json
retention-days: 90 # Maximum for free version
##############
# IceLake CI #
##############
format-icelake:
name: Format (IceLake)
# Disable this job for now and until a self-hosted icelake becomes available
if: ${{ false }}
runs-on: [self-hosted, Linux, X64, ice-lake]
steps:
# Add local bin for cpplint
- name: Setup
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
- name: pre-commit
run: pre-commit run --all-files
test-hekit-icelake:
name: Test hekit commands (IceLake)
# Disable this job for now and until a self-hosted icelake becomes available
if: ${{ false }}
runs-on: [self-hosted, Linux, X64, ice-lake]
defaults:
run:
shell: bash
steps:
# Add local bin for pytest
- name: Setup
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
- name: Run pytests
run: pytest tests/ -n 8 --dist loadgroup
build-and-test-toolkit-icelake:
name: Build, test and run HE Toolkit (IceLake)
# Disable this job for now and until a self-hosted icelake becomes available
if: ${{ false }}
runs-on: [self-hosted, Linux, X64, ice-lake]
defaults:
run:
shell: bash
steps:
# Add local bin for pip modules and create temp workspace
- name: Setup
run: |
temp_workspace="$(pwd)/../$(date +%s)"
mkdir $temp_workspace
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "TEMP_DIRECTORY=$temp_workspace" >> $GITHUB_ENV
echo "HE_WORKSPACE=$temp_workspace/.hekit/components" >> $GITHUB_ENV
echo "CONFIG_FILE=$temp_workspace/default.config" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Init hekit
run: echo "repo_location = \"$HE_WORKSPACE\"" > $CONFIG_FILE
- name: Build and install default recipe
run: |
./hekit --config $CONFIG_FILE install recipes/default.toml
./hekit --config $CONFIG_FILE list
- name: Build examples
run: |
./hekit --config $CONFIG_FILE build recipes/examples.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config $CONFIG_FILE list
echo "PSI_BUILD_DIR=$HE_WORKSPACE/examples/psi/build" >> $GITHUB_ENV
echo "QUERY_BUILD_DIR=$HE_WORKSPACE/examples/secure-query/build" >> $GITHUB_ENV
echo "LR_BUILD_DIR=$HE_WORKSPACE/examples/logistic-regression/build" >> $GITHUB_ENV
- name: Run PSI example
run: |
echo -e "apple\nBanana\ncat\nBa-Ra\nCalifornia" > client.set
${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/fruits.set | grep -B 1 "apple"
${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/ancient_egyptian_gods.set | grep -B 1 "Ba-Ra"
${PSI_BUILD_DIR}/psi client.set --server ${PSI_BUILD_DIR}/datasets/us_states.set | grep -B 1 "California"
- name: Run Secure Query example
run: |
cd ${QUERY_BUILD_DIR}
echo -n "Input: Louisiana, " && ./secure-query <<< $'\n\nLouisiana\n' | grep "Baton Rouge"
echo -n "Input: North Dakota, " && ./secure-query <<< $'\n\nNorth Dakota\n' | grep "Bismarck"
echo -n "Input: Wyoming, " && ./secure-query <<< $'\n\nWyoming\n' | grep "Cheyenne"
- name: Run LR example
run: |
cd ${LR_BUILD_DIR}
./lr_test --compare --data lrtest_large | grep "All match!"
- name: Build PSI config tests
run: |
./hekit --config $CONFIG_FILE install recipes/config-psi.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config $CONFIG_FILE list
echo "CONFIG_PSI_TEST_DIR=$HOME/.hekit/components/psi/configurable-psi/build" >> $GITHUB_ENV
- name: Run PSI config unit tests
run: ${CONFIG_PSI_TEST_DIR}/bin/unit-test
- name: Run PSI config pytests
run: |
source deployments/config_psi/setenv.sh
pytest deployments/config_psi/tests/
pytest deployments/config_psi/scripts/tests/
- name: Build sample kernels
run: |
./hekit --config $CONFIG_FILE build recipes/sample-kernels.toml --recipe_arg "toolkit-path=${GITHUB_WORKSPACE}"
./hekit --config $CONFIG_FILE list
echo "SEAL_KERNELS_BUILD_DIR=$HE_WORKSPACE/sample-kernels/seal/build" >> $GITHUB_ENV
echo "PALISADE_KERNELS_BUILD_DIR=$HE_WORKSPACE/sample-kernels/palisade/build" >> $GITHUB_ENV
- name: Run sample kernels unit test
run: |
${SEAL_KERNELS_BUILD_DIR}/test/unit-test
${PALISADE_KERNELS_BUILD_DIR}/test/unit-test
# PALISADE sample kernels
- name: Run PALISADE sample kernels
run: KMP_WARNINGS=0 OMP_NUM_THREADS=5 ${PALISADE_KERNELS_BUILD_DIR}/sample-kernels-palisade --benchmark_out_format=json --benchmark_out="${GITHUB_JOB}_sample-kernels-palisade_${GITHUB_SHA}.json"
- name: Archive PALISADE sample kernel results
uses: actions/upload-artifact@v3
with:
name: ${{github.job}}_sample-kernels-palisade_${{github.sha}}.json
path: ${{github.job}}_sample-kernels-palisade_${{github.sha}}.json
retention-days: 90 # Maximum for free version
# SEAL sample kernels
- name: Run SEAL sample kernels
run: KMP_WARNINGS=0 OMP_NUM_THREADS=5 ${SEAL_KERNELS_BUILD_DIR}/sample-kernels-seal --benchmark_out_format=json --benchmark_out="${GITHUB_JOB}_sample-kernels-seal_${GITHUB_SHA}.json"
- name: Archive SEAL sample kernel results
uses: actions/upload-artifact@v3
with:
name: ${{github.job}}_sample-kernels-seal_${{github.sha}}.json
path: ${{github.job}}_sample-kernels-seal_${{github.sha}}.json
retention-days: 90 # Maximum for free version
- name: Clean up hekit directory
if: always()
run: |
./hekit --config $CONFIG_FILE remove --all -y
rm -rf $TEMP_DIRECTORY