-
Notifications
You must be signed in to change notification settings - Fork 144
121 lines (117 loc) · 3.7 KB
/
test-ruby.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
name: RbThemis
on:
pull_request:
paths:
- '.github/workflows/test-ruby.yaml'
- 'docs/examples/ruby/**'
- 'src/soter/**'
- 'src/themis/**'
- 'src/wrappers/themis/ruby/**'
- 'tests/rbthemis/**'
- '**/*.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 \
ruby ruby-dev
- name: Install RVM
run: |
sudo apt install --yes software-properties-common
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt update
sudo apt install rvm
# Recent versions of RVM do not add us to "rvm" group automatically
# and install their binaries into /usr/share, expecting the PATH
# to be set via shell profile. GitHub Actions do not load profile
# so we have to tweak the path manually here.
sudo usermod -a -G rvm $(id -nu)
echo "/usr/share/rvm/bin" >> "$GITHUB_PATH"
- name: Check out code
uses: actions/checkout@v2
- name: Prepare Themis Core
run: |
make
sudo make install
make prepare_tests_all
- name: Install RubyThemis
run: sudo make rbthemis_install
- name: Run test suite (system Ruby)
run: |
rvm use system
make test_ruby
- name: Uninstall RubyThemis
run: sudo make rbthemis_uninstall
examples:
name: Code examples
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 \
ruby ruby-dev
- name: Install Ruby gems
run: |
sudo gem install eventmachine
- name: Check out code
uses: actions/checkout@v2
- name: Install Themis Core
run: |
make
sudo make install
- name: Install RubyThemis
run: sudo make rbthemis_install
- name: Test examples (Secure Cell)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/ruby
echo "Testing Secure Cell..."
ruby scell_test.rb
echo "ok"
- name: Test examples (Secure Message)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/ruby
echo "Testing Secure Message..."
ruby smessage_test.rb
ruby skeygen.rb
echo "ok"
- name: Test examples (Secure Session)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/ruby
echo "Testing Secure Session..."
ruby ssession_test_eventmachine_server.rb &
sleep 1 # give the server time to launch
ruby ssession_test_eventmachine_client.rb
wait "$!" # the server should shut down
echo "ok"
- name: Test examples (Secure Comparator)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/ruby
echo "Testing Secure Comparator..."
ruby scomparator_test_eventmachine_server.rb &
sleep 1 # give the server time to launch
ruby scomparator_test_eventmachine_client.rb | tee output.txt
grep -q '^does not match$' output.txt
kill -SIGTERM "$!"
echo "ok"