-
Notifications
You must be signed in to change notification settings - Fork 145
193 lines (171 loc) · 5.52 KB
/
test-python.yaml
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
name: PyThemis
on:
pull_request:
paths:
- '.github/workflows/test-python.yaml'
- 'docs/examples/python/**'
- 'src/soter/**'
- 'src/themis/**'
- 'src/wrappers/themis/python/**'
- 'tests/pythemis/**'
- '**/*.mk'
- 'Makefile'
- '!**/README*'
push:
branches:
- master
- stable
- release/*
schedule:
- cron: '20 6 * * 1' # every Monday at 6:20 UTC
env:
WITH_FATAL_WARNINGS: yes
jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-20.04
steps:
- name: Install system dependencies
run: |
sudo sh -c 'echo "DEBIAN_FRONTEND=noninteractive" >> /etc/environment'
sudo apt update
sudo apt install --yes gcc make libssl-dev \
python python-setuptools \
python3 python3-setuptools
- name: Check out code
uses: actions/checkout@v2
- name: Prepare Themis Core
run: |
make
sudo make install
make prepare_tests_all
- name: Install PyThemis
run: sudo make pythemis_install
- name: Run test suite
run: make test_python
examples:
name: Code examples
runs-on: ubuntu-20.04
strategy:
fail-fast: false
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_DB: scell_token_protect_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
rabbitmq:
image: rabbitmq
ports:
- 5672:5672
options: --hostname=localhost
steps:
- name: Install system dependencies
run: |
sudo sh -c 'echo "DEBIAN_FRONTEND=noninteractive" >> /etc/environment'
sudo apt update
sudo apt install --yes gcc make libssl-dev \
python3 python3-pip python3-setuptools \
libpq-dev
- name: Install Python modules
run: |
sudo pip3 install tornado twisted psycopg2 pika
- name: Check out code
uses: actions/checkout@v2
- name: Install Themis Core
run: |
make
sudo make install
- name: Install PyThemis
run: sudo make pythemis_install
- name: Test examples (Secure Cell)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/python
echo "Secure Cell: showcase"
python3 scell_test.py
echo
echo "Secure Cell: PostgreSQL"
python3 scell_test_postgres.py
echo
echo "Secure Cell: XML processing"
python3 scell_xml_format-preserving_encryption.py
diff -q example_data/test.xml decoded_data.xml
echo
- name: Test examples (Secure Message)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/python
echo "Generating keys..."
python3 skeygen_test.py private.key public.key
echo
echo "Secure Message: sockets: encryption"
python3 smessage_test_server.py &
sleep 1 # give server time to start
python3 smessage_test_client.py
echo
echo "Secure Message: sockets: sign/verify"
python3 smessage_sv_test_server.py &
sleep 1 # give server time to start
python3 smessage_sv_test_client.py
echo
echo "Secure Message: Twisted"
python3 smessage_test_twisted.py &
sleep 2 # give server time to start
python3 smessage_test_client.py
kill -SIGTERM $!
echo
echo "Secure Message: Tornado"
python3 smessage_test_tornado_server.py &
sleep 1 # give server time to start
python3 smessage_test_tornado_client.py
kill -SIGTERM $!
echo
echo "Secure Message: RabbitMQ"
python3 smessage_test_rabbitMQ_server.py &
sleep 1 # give server time to start
python3 smessage_test_rabbitMQ_client.py
kill -SIGTERM $!
echo
- name: Test examples (Secure Session)
if: always()
# This step tends to randomly hang up. Use a shorter timeout here
# instead of the default 6-hour one.
timeout-minutes: 5
run: |
cd $GITHUB_WORKSPACE/docs/examples/python
echo "Secure Session: sockets"
python3 ssession_test_server.py &
sleep 1 # give server time to start
python3 ssession_test_client.py
echo
echo "Secure Session: Twisted"
python3 ssession_test_twisted.py &
sleep 1 # give server time to start
python3 ssession_test_client.py
kill -SIGTERM $!
echo
echo "Secure Session: Tornado"
python3 ssession_test_tornado_server.py &
sleep 1 # give server time to start
python3 ssession_test_tornado_client.py
kill -SIGTERM $!
echo
echo "Secure Session: RabbitMQ"
python3 ssession_rabbitMQ_server_test.py &
sleep 1 # give server time to start
python3 ssession_rabbitMQ_client_test.py
kill -SIGTERM $!
echo
- name: Test examples (Secure Comparator)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/python
python3 scomparator_test_server.py | tee server-output.txt &
sleep 1 # give server time to start
python3 scomparator_test_client.py | tee client-output.txt
test "$(cat server-output.txt)" = "match"
test "$(cat client-output.txt)" = "match"