-
Notifications
You must be signed in to change notification settings - Fork 143
134 lines (130 loc) · 3.88 KB
/
test-nodejs.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
name: JsThemis
on:
pull_request:
paths:
- '.github/workflows/test-nodejs.yaml'
- 'docs/examples/js/**'
- 'src/soter/**'
- 'src/themis/**'
- 'src/wrappers/themis/jsthemis/**'
- 'test/jsthemis/**'
- '**/*.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
strategy:
matrix:
node-version:
- 10.x # legacy
- 12.x # old LTS
- 14.x # current LTS
- 16.x # current stable
fail-fast: false
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
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Check out code
uses: actions/checkout@v2
with:
submodules: true
- name: Install Themis Core
env:
NODE_VERSION: ${{ matrix.node-version }}
run: |
make
sudo -E make install
- name: Run test suite
run: |
echo Node.js: $(node --version)
echo npm: $(npm --version)
make test_js
examples:
name: Code examples
runs-on: ubuntu-20.04
strategy:
matrix:
node-version:
- 12.x # old LTS
- 14.x # current LTS
- 16.x # current stable
fail-fast: false
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
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Install Themis Core
run: |
make
sudo make install
- name: Install JsThemis
run: |
echo Node.js: $(node --version)
echo npm: $(npm --version)
rm -rf node_modules package-lock.json
make jsthemis_install
- name: Test examples (Secure Cell)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/js
echo "Test Secure Cell..."
node secure_cell.js
echo "ok"
- name: Test examples (Secure Message)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/js
echo "Test Secure Message..."
alice=($(node secure_keygen.js | cut -c 15-))
bob=($(node secure_keygen.js | cut -c 15-))
enc=$(node secure_message.js enc "${alice[0]}" "${bob[1]}" message)
dec=$(node secure_message.js dec "${bob[0]}" "${alice[1]}" "$enc")
test "$dec" = "message"
echo "ok"
- name: Test examples (Secure Session)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/js
echo "Test Secure Session..."
node secure_session_server.js &
sleep 1 # give the server time to launch
node secure_session_client.js > output.txt
kill -SIGTERM "$!"
grep -q 'Hello server!!!' output.txt
echo "ok"
- name: Test examples (Secure Comparator)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/js
echo "Test Secure Comparator..."
node secure_comparator_server.js &
sleep 1 # give the server time to launch
node secure_comparator_client.js
kill -SIGTERM "$!"
echo "ok"