10 runs-on: windows-latest
13 - name: Set git to use LF
15 git config --global core.autocrlf false
16 git config --global core.eol lf
18 - name: Checking out code
19 uses: actions/checkout@v4
21 - name: Configuring node & npm
22 uses: actions/setup-node@v4
24 node-version-file: '.nvmrc'
26 - name: Installing node stuff
32 - name: Looking for uncommitted changes
33 # Add all files to the git index and then run diff --cached to see all changes.
34 # This ensures that we get the status of all files, including new files.
35 # We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
38 git reset -- npm-shrinkwrap.json
39 git diff --cached --exit-code
42 runs-on: ${{ matrix.os }}
50 # Ideally we should use mysql/mariadb, but they are 4x slower without tweaks and configuration
51 # so let's run only postgres (1.5h vs 6h) only, If some day we want to improve the mysql runs,
52 # this is the place to enable them.
55 extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium
59 extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium
62 - name: Setting up DB mysql
63 if: ${{ matrix.db == 'mysqli' }}
64 uses: shogo82148/actions-setup-mysql@v1
70 - name: Creating DB mysql
71 if: ${{ matrix.db == 'mysqli' }}
72 run: mysql --host 127.0.0.1 -utest -ptest -e 'CREATE DATABASE IF NOT EXISTS test COLLATE = utf8mb4_bin;';
74 - name: Setting up DB pgsql
75 if: ${{ matrix.db == 'pgsql' }}
77 # TODO: Remove these conf. modifications when php74 or php80 are lowest.
78 # Change to old md5 auth, because php73 does not support it.
79 # #password_encryption = scram-sha-256
80 (Get-Content "$env:PGDATA\postgresql.conf"). `
81 replace('#password_encryption = scram-sha-256', 'password_encryption = md5') | `
82 Set-Content "$env:PGDATA\postgresql.conf"
83 (Get-Content "$env:PGDATA\pg_hba.conf"). `
84 replace('scram-sha-256', 'md5') | `
85 Set-Content "$env:PGDATA\pg_hba.conf"
86 $pgService = Get-Service -Name postgresql*
87 Set-Service -InputObject $pgService -Status running -StartupType automatic
88 Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
89 & $env:PGBIN\psql --command="CREATE USER test PASSWORD 'test'" --command="\du"
91 - name: Creating DB pgsql
92 if: ${{ matrix.db == 'pgsql' }}
94 & $env:PGBIN\createdb --owner=test test
95 $env:PGPASSWORD = 'test'
96 & $env:PGBIN\psql --username=test --host=localhost --list test
98 - name: Configuring git vars
99 uses: rlespinasse/github-slug-action@v4
101 - name: Setting up PHP ${{ matrix.php }}
102 uses: shivammathur/setup-php@v2
104 php-version: ${{ matrix.php }}
105 extensions: ${{ matrix.extensions }}
106 ini-values: max_input_vars=5000
109 - name: Set git to use LF
111 git config --global core.autocrlf false
112 git config --global core.eol lf
114 - name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
115 uses: actions/checkout@v4
117 # Needs to be done after php is available, git configured and Moodle checkout has happened.
118 - name: Setting up moodle-exttests service
120 git clone https://github.com/moodlehq/moodle-exttests.git
121 nssm install php-built-in C:\tools\php\php.exe -S localhost:8080 -t D:\a\moodle\moodle\moodle-exttests
122 nssm start php-built-in
124 - name: Setting up redis service
126 choco install redis-64 --version 3.0.503 --no-progress
127 nssm install redis redis-server
130 - name: Setting up PHPUnit
132 dbtype: ${{ matrix.db }}
135 echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
136 cp .github/workflows/config-template.php config.php
138 php admin/tool/phpunit/cli/init.php --no-composer-self-update
140 - name: Running PHPUnit tests
142 dbtype: ${{ matrix.db }}
143 phpunit_options: ${{ secrets.phpunit_options }}
144 run: vendor/bin/phpunit $phpunit_options