Skip to content

Web Installation Testing #171

Web Installation Testing

Web Installation Testing #171

Workflow file for this run

name: Moodle web installation testing
on:
workflow_dispatch:
inputs:
repository:
description: 'Repository to clone'
required: true
branch:
description: 'Branch to clone'
required: true
env:
php: 8.2
jobs:
behat:
runs-on: ubuntu-latest
env:
MOODLE_SITE_URL: http://localhost:8080/moodle
DB_TYPE: pgsql
DB_HOST: localhost
DB_NAME: test
DB_USER: test
DB_PASS: test
steps:
- name: Print repository and branch
run: |
echo "Repository: ${{ github.event.inputs.repository }}"
echo "Branch: ${{ github.event.inputs.branch }}"
- 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
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: 8.3
ini-values: max_input_vars=5000
coverage: none
# - name: Clone Moodle repository
# run: git clone https://git.in.moodle.com/moodle/integration.git moodle
# - name: Clone moodle site repository and branch
# uses: actions/checkout@v4
# with:
# repository: ${{ github.event.inputs.repository }}
# ref: ${{ github.event.inputs.branch }}
# path: moodle
- name: Clone moodle site repository and branch
run: git clone -b ${{ github.event.inputs.branch }} ${{ github.event.inputs.repository }} moodle
- name: Clone Plugin repository
uses: actions/checkout@v4
with:
repository: lameze/moodle-webinstall
ref: main
path: webinstall
- name: Install Plugin Composer Dependencies
run: composer install
working-directory: webinstall
- name: Start PHP built-in server
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
run: npm install puppeteer
working-directory: webinstall
- name: Take screenshot of Moodle installation page
run: node screenshot.js
working-directory: webinstall
- name: Run Behat tests
run: vendor/bin/behat tests/behat/install.feature
working-directory: webinstall
- name: Print PHP built-in server logs
if: always()
run: cat server.log
working-directory: moodle
- name: Upload screenshot
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshot
path: webinstall/moodle.png