-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
119 lines (105 loc) · 3.34 KB
/
action.yml
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
name: Web Installer Testing
description: Automated testing of the Moodle web installation
inputs:
php:
description: 'PHP Version to test'
required: true
default: 8.3
#
# It's triggered manually (workflow_dispatch) and helps to ensure that the web installation process works as
# expected and helps to detect any issues early.
#
# The workflow sets up a PostgreSQL database, PHP, clone moodle-webinstall repository and run the install Behat test.
# It also takes a screenshot of the Moodle installation page and uploads it as an artifact so it can be verified in
# case of failures.
#
# For more information about the web install testing, see https://github.com/moodlehq/moodle-webinstaller-test
runs:
using: "composite"
steps:
- name: Setting up DB PostgreSQL
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 13
postgresql db: test
postgresql user: test
postgresql password: test
- name: Wait for PostgreSQL to be ready
shell: bash
run: |
for i in {1..30}; do
if pg_isready -h localhost -p 5432 -U test; then
echo "PostgreSQL is ready"
break
else
echo "Waiting for PostgreSQL to be ready..."
sleep 2
fi
done
- name: Setting up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php }}
ini-values: max_input_vars=5000
coverage: none
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v4
with:
path: moodle
- name: Clone Plugin repository
uses: actions/checkout@v4
with:
repository: moodlehq/moodle-webinstaller-test
ref: main
path: webinstall
- name: Install Plugin Composer Dependencies
shell: bash
run: composer install
working-directory: webinstall
- name: Start PHP built-in server
shell: bash
run: |
nohup php -S localhost:8080 -t . > server.log 2>&1 &
echo "Waiting for PHP built-in server to be ready..."
for i in {1..5}; do
if nc -z localhost 8080; then
echo "PHP built-in server is ready"
break
else
echo "Waiting for PHP built-in server to be ready..."
sleep 2
fi
done
working-directory: moodle
- name: Install Puppeteer
shell: bash
run: npm install puppeteer
working-directory: webinstall
- name: Take screenshot of Moodle installation page
shell: bash
run: node screenshot.js ${{ inputs.php }}
working-directory: webinstall
- name: Run Behat tests
shell: bash
run: vendor/bin/behat tests/behat/install.feature
working-directory: webinstall
env:
MOODLE_SITE_URL: http://localhost:8080/moodle
DB_TYPE: pgsql
DB_HOST: localhost
DB_NAME: test
DB_USER: test
DB_PASS: test
- name: Print PHP built-in server logs
shell: bash
if: ${{ !cancelled() }}
run: cat server.log
working-directory: moodle
- name: Upload screenshot
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: screenshot-${{ inputs.php }}
path: webinstall/moodle${{ inputs.php }}.png