-
Notifications
You must be signed in to change notification settings - Fork 21
76 lines (63 loc) · 2.28 KB
/
tests.yml
File metadata and controls
76 lines (63 loc) · 2.28 KB
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
name: Tests
on:
push:
branches:
- master
pull_request:
jobs:
phpunit:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '7.4'
- '8.0'
- '8.4'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Install dependencies
run: composer update --no-interaction --prefer-dist --no-progress
- name: Configure SSH integration server
run: |
sudo apt-get update
sudo apt-get install -y openssh-server
sudo userdel -r ci-test >/dev/null 2>&1 || true
sudo useradd -m -s /bin/bash ci-test
echo 'ci-test:ci-test-password' | sudo chpasswd
mkdir -p "$HOME/.ssh"
ssh-keygen -q -t rsa -b 4096 -N '' -f "$HOME/.ssh/php_ssh_connection_ci_key"
sudo mkdir -p /home/ci-test/.ssh
cat "$HOME/.ssh/php_ssh_connection_ci_key.pub" | sudo tee /home/ci-test/.ssh/authorized_keys >/dev/null
sudo chown -R ci-test:ci-test /home/ci-test/.ssh
sudo chmod 700 /home/ci-test/.ssh
sudo chmod 600 /home/ci-test/.ssh/authorized_keys
if grep -q '^#\?PasswordAuthentication ' /etc/ssh/sshd_config; then
sudo sed -i 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config
else
echo 'PasswordAuthentication yes' | sudo tee -a /etc/ssh/sshd_config >/dev/null
fi
if grep -q '^#\?PubkeyAuthentication ' /etc/ssh/sshd_config; then
sudo sed -i 's/^#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
else
echo 'PubkeyAuthentication yes' | sudo tee -a /etc/ssh/sshd_config >/dev/null
fi
sudo service ssh restart
- name: Run tests
env:
RUN_SSH_INTEGRATION_TESTS: '1'
SSH_TEST_HOST: 127.0.0.1
SSH_TEST_PORT: '22'
SSH_TEST_USER: ci-test
SSH_TEST_PASSWORD: ci-test-password
run: |
export SSH_TEST_PRIVATE_KEY_PATH="$HOME/.ssh/php_ssh_connection_ci_key"
vendor/bin/phpunit