-
Notifications
You must be signed in to change notification settings - Fork 45
289 lines (236 loc) · 7.88 KB
/
test.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
---
name: Build and test libBLS
on:
push:
branches-ignore:
- develop
- master
- beta
- stable
defaults:
run:
shell: bash
jobs:
linux_build_and_test:
runs-on: ubuntu-20.04
steps:
- name: Extract repo name
run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F /
'{print $2}')
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Checkout
uses: actions/checkout@v2
- name: update apt
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update
- name: install packages
run: |
sudo apt-get install -y software-properties-common
sudo apt-get install -y gcc-9 g++-9
- name: Use g++-9 and gcov-9 by default
run: >
echo "Updating all needed alternatives"
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-9 9
sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-9 9
sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-9 9
echo "Checking alternative for gcc"
which gcc
gcc --version
echo "Checking alternative for g++"
which g++
g++ --version
echo "Checking alternative for gcov"
which gcov
gcov --version
echo "Checking alternative for gcov-dump"
which gcov-dump
gcov-dump --version
echo "Checking alternative for gcov-tool"
which gcov-tool
gcov-tool --version
- name: Update apt
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test;
- name: Install packages
run: >
sudo apt-get update
sudo apt-get install -y gcc-9 g++-9 gawk sed shtool \
libffi-dev yasm texinfo flex bison libgnutls28-dev python3 gcc-multilib git
sudo apt-get update -qq
sudo apt-get install -y python3-pip
pip3 install --upgrade pip
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install pyopenssl ndg-httpsclient pyasn1
sudo python3 -m pip install requests[security]
- name: Get newest lcov
run: >
echo "Removing previous lcov version..."
sudo apt-get remove lcov || true
echo "Installing newest lcov version..."
rm -rf newer_lcov || true
mkdir newer_lcov
cd newer_lcov
git clone https://github.com/linux-test-project/lcov --recursive --recurse-submodules
cd lcov
git checkout 92e2121
sudo make install
cd ..
cd ..
echo "Checking installed lcov version..."
which lcov
lcov --version
- name: Build dependencies
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON"
cd deps
./build.sh
- name: Configure all
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
CMAKE_BUILD_FLAGS="-DCOVERAGE=ON"
mkdir -p build && cd build
cmake $CMAKE_BUILD_FLAGS ..
- name: Build all
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
CMAKE_BUILD_FLAGS="-DCOVERAGE=ON"
cd build
make -j$(nproc)
- name: Run sgxwallet container
run: |
export SGX_WALLET_TAG=1.83.0-develop.5
./scripts/run_sgx_simulator.sh
sleep 60
- name: Run tests
run: |
cp scripts/parameters.json build/
cd build
./bls_unit_test
./dkg_unit_test
./utils_unit_test
./bls_test
./threshold_encryption/te_unit_test
./threshold_encryption/te_test
./dkg_attack
./threshold_encryption/te_sample_sgx
- name: Create lcov report
run: >
cd build
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files
lcov --remove coverage.info 'deps/*' --output-file coverage.info # filter dependency files
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.info
osx_build_and_test:
runs-on: macos-13
steps:
- name: Extract repo name
run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F /
'{print $2}')
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Checkout
uses: actions/checkout@v2
- name: Install packages
run: |
brew install yasm texinfo shtool libtool coreutils
- name: Build dependencies
run: |
cd deps
./build.sh
- name: Configure all
run: |
mkdir -p build && cd build
cmake ..
- name: Build all
run: |
cd build
make -j$(sysctl -n hw.ncpu)
- name: Run tests
run: |
cp scripts/parameters.json build/
cd build
./bls_unit_test
./dkg_unit_test
./bls_test
./threshold_encryption/te_unit_test
./threshold_encryption/te_test
./dkg_attack
linux_build_with_emscripten:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version:
- 14.x
steps:
- name: Extract repo name
run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F /
'{print $2}')
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Checkout
uses: actions/checkout@v2
- name: Update apt
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test;
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y gcc-9 g++-9 gawk sed shtool \
libffi-dev yasm texinfo flex bison \
python3 gcc-multilib
sudo apt-get update -qq
sudo apt-get install -y python3-pip
pip3 install --upgrade pip
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install pyopenssl ndg-httpsclient pyasn1
sudo python3 -m pip install requests[security]
- name: Install NODE JS
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Build dependencies
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
cd deps
./build.sh WITH_EMSCRIPTEN=1
cd ..
- name: Build all
run: >
cd deps/emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
cd ../..
mkdir -p build_em
cd build_em
export LIBRARIES_ROOT=../deps/deps_inst/x86_or_x64/lib
emcmake cmake -DEMSCRIPTEN=ON .. -DGMP_LIBRARY="$LIBRARIES_ROOT"/libgmp.a -DCRYPTOPP_LIBRARY="$LIBRARIES_ROOT"/libcrypto.a -DGMPXX_LIBRARY="$LIBRARIES_ROOT"/libgmpxx.a
emmake make -j$(nproc)
cd ..
- name: Run tests
run: |
cp tools/generate_bls_keys build_em/
cp tools/decrypt_message build_em/
cd build_em/
cp threshold_encryption/encrypt_message.* .
./generate_bls_keys
MESSAGE=`cat message.txt`
PUBLIC_BLS_KEY=`cat bls_public_key.txt`
node encrypt_message.js $MESSAGE $PUBLIC_BLS_KEY > encrypted_data.txt
./decrypt_message