-
Notifications
You must be signed in to change notification settings - Fork 144
169 lines (165 loc) · 6 KB
/
test-php.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
name: PHPThemis
on:
pull_request:
paths:
- '.github/workflows/test-php.yaml'
- 'src/soter/**'
- 'src/themis/**'
- 'src/wrappers/themis/php/**'
- 'src/wrappers/themis/php7/**'
- 'tests/phpthemis/**'
- '**/*.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
- name: Install PHP from PPA
run: |
sudo apt install --yes software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install --yes \
php7.4 php7.4-fpm- php7.4-dev php7.4-xml php7.4-mbstring \
php7.3 php7.3-fpm- php7.3-dev php7.3-xml php7.3-mbstring \
php7.2 php7.2-fpm- php7.2-dev php7.2-xml php7.2-mbstring \
php7.1 php7.1-fpm- php7.1-dev php7.1-xml php7.1-mbstring \
php7.0 php7.0-fpm- php7.0-dev php7.0-xml php7.0-mbstring \
php5.6 php5.6-fpm- php5.6-dev php5.6-xml php5.6-mbstring
- name: Check out code
uses: actions/checkout@v2
- name: Prepare Themis Core
run: |
make
sudo make install
make prepare_tests_all
- name: Run test suite (PHP 5.6)
if: always()
run: |
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --set php-config /usr/bin/php-config5.6
sudo update-alternatives --set phpize /usr/bin/phpize5.6
sudo git clean -fxd src
./configure
sudo make phpthemis_install
make test_php
- name: Run test suite (PHP 7.0)
if: always()
run: |
sudo update-alternatives --set php /usr/bin/php7.0
sudo update-alternatives --set php-config /usr/bin/php-config7.0
sudo update-alternatives --set phpize /usr/bin/phpize7.0
sudo git clean -fxd src
./configure
sudo make phpthemis_install
make test_php
- name: Run test suite (PHP 7.1)
if: always()
run: |
sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set php-config /usr/bin/php-config7.1
sudo update-alternatives --set phpize /usr/bin/phpize7.1
sudo git clean -fxd src
./configure
sudo make phpthemis_install
make test_php
- name: Run test suite (PHP 7.2)
if: always()
run: |
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
sudo git clean -fxd src
./configure
sudo make phpthemis_install
make test_php
- name: Run test suite (PHP 7.3)
if: false # PHP 7.3 is not supported currently and crashes
run: |
sudo update-alternatives --set php /usr/bin/php7.3
sudo update-alternatives --set php-config /usr/bin/php-config7.3
sudo update-alternatives --set phpize /usr/bin/phpize7.3
sudo git clean -fxd src
./configure
sudo make phpthemis_install
make test_php
- name: Run test suite (PHP 7.4)
if: false # PHP 7.4 is not supported currently and crashes
run: |
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set php-config /usr/bin/php-config7.4
sudo update-alternatives --set phpize /usr/bin/phpize7.4
sudo git clean -fxd src
./configure
sudo make phpthemis_install
make test_php
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
- name: Install PHP from PPA
run: |
sudo apt install --yes software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install --yes \
php7.2 php7.2-fpm- php7.2-dev php7.2-xml php7.2-mbstring
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
- name: Check out code
uses: actions/checkout@v2
- name: Install Themis Core
run: |
make
sudo make install
- name: Install PHPThemis
run: |
sudo make phpthemis_install
sudo sh -c 'echo "extension=phpthemis.so" > /etc/php/7.2/cli/conf.d/20-phpthemis.ini'
- name: Test examples (Secure Cell, PHP 7.2)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/php
echo "Testing Secure Cell..."
php scell_test.php
echo "ok"
- name: Test examples (Secure Message, PHP 7.2)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/php
echo "Testing Secure Message..."
php smessage_test.php
echo "ok"
- name: Test examples (Secure Session, PHP 7.2)
if: always()
run: |
cd $GITHUB_WORKSPACE/docs/examples/php
echo "Testing Secure Session..."
php ssession_server.php &
sleep 1 # give the server time to launch
php ssession_client.php
kill -SIGTERM "$!"
echo "ok"
# Secure Comparator not supported by PHPThemis (as of v0.12, 2019-11-17)