Skip to content

Moodle 42 stable

Moodle 42 stable #43

Workflow file for this run

name: Integration & Unit test
on:
pull_request:
branches:
- master
- MOODLE_42_STABLE
- MOODLE_43_STABLE
- MOODLE_44_STABLE
env:
php: 8.2
jobs:
PHPUnit:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
## Moodle 4.2+ with PHP 8.0
- os: ubuntu-22.04
php: 8.0
db: mysqli
moodle: MOODLE_402_STABLE
experimental: false
## Moodle 4.2+ with PHP 8.1
- os: ubuntu-22.04
php: 8.1
db: mysqli
moodle: MOODLE_402_STABLE
experimental: false
## Moodle 4.2+ with PHP 8.2
- os: ubuntu-22.04
php: 8.2
db: mysqli
moodle: MOODLE_402_STABLE
experimental: false
## Moodle 4.3+ with PHP 8.2
- os: ubuntu-22.04
php: 8.2
db: mysqli
moodle: MOODLE_403_STABLE
experimental: false
## Moodle 4.4+ with PHP 8.2
- os: ubuntu-22.04
php: 8.2
db: mysqli
moodle: MOODLE_404_STABLE
experimental: false
# Future supported versions
## Moodle development version with PHP 8.2
- os: ubuntu-22.04
php: 8.2
db: mysqli
moodle: main
experimental: true
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: johanmeiring/mysql-action@tmpfs-patch
with:
collation server: utf8mb4_unicode_ci
mysql version: 8.0
mysql database: test
mysql user: test
mysql password: test
use tmpfs: true
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
ini-values: 'max_input_vars=5000'
- name: Checking out code from moodle/moodle
uses: actions/checkout@v4
with:
repository: moodle/moodle
ref: ${{ matrix.moodle }}
- name: Check out code from ${{ github.repository }}
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/blocks/sharing_cart
ref: ${{ github.ref }}
- name: Lint module code
run:
find $GITHUB_WORKSPACE/blocks/sharing_cart -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
cp $GITHUB_WORKSPACE/.github/workflows/config-template.php $GITHUB_WORKSPACE/config.php
mkdir $GITHUB_WORKSPACE/../moodledata
sudo locale-gen en_AU.UTF-8
php $GITHUB_WORKSPACE/admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
run: $GITHUB_WORKSPACE/vendor/bin/phpunit -c $GITHUB_WORKSPACE/phpunit.xml --testsuite=block_sharing_cart_testsuite -v --testdox