9 - v[0-9]+.[0-9]+.[0-9]+*
12 phpunit_extra_options:
13 description: Additional options to apply to PHPUnit
25 - name: Checking out code
26 uses: actions/checkout@v4
28 - name: Configuring node & npm
29 uses: actions/setup-node@v4
31 node-version-file: '.nvmrc'
33 - name: Installing node stuff
39 - name: Looking for uncommitted changes
40 # Add all files to the git index and then run diff --cached to see all changes.
41 # This ensures that we get the status of all files, including new files.
42 # We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
45 git reset -- npm-shrinkwrap.json
46 git diff --cached --exit-code
49 runs-on: ${{ matrix.os }}
52 image: moodlehq/moodle-exttests
72 - name: Setting up DB mysql
73 if: ${{ matrix.db == 'mysqli' }}
74 uses: moodlehq/mysql-action@v1
76 collation server: utf8mb4_bin
83 extra conf: --skip-log-bin
85 - name: Setting up DB pgsql
86 if: ${{ matrix.db == 'pgsql' }}
87 uses: m4nu56/postgresql-action@v1
89 postgresql version: 12
92 postgresql password: test
94 - name: Configuring git vars
95 uses: rlespinasse/github-slug-action@v4
97 - name: Setting up PHP ${{ matrix.php }}
98 uses: shivammathur/setup-php@v2
100 php-version: ${{ matrix.php }}
101 extensions: ${{ matrix.extensions }}
102 ini-values: max_input_vars=5000
105 - name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
106 uses: actions/checkout@v4
108 - name: Setting up PHPUnit
110 dbtype: ${{ matrix.db }}
112 echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
113 cp .github/workflows/config-template.php config.php
115 sudo locale-gen en_AU.UTF-8
116 php admin/tool/phpunit/cli/init.php --no-composer-self-update
118 - name: Running PHPUnit tests
120 dbtype: ${{ matrix.db }}
121 phpunit_options: ${{ secrets.phpunit_options }}
122 run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}