Moodle release 4.1.10
[moodle.git] / .github / workflows / push.yml
blobfca52fac227b99169e5c53f743d4844e731a80df
1 name: Core
3 on:
4   push:
5     branches-ignore:
6       - master
7       - MOODLE_[0-9]+_STABLE
8     tags-ignore:
9       - v[0-9]+.[0-9]+.[0-9]+*
10   workflow_dispatch:
11     inputs:
12       phpunit_extra_options:
13         description: Additional options to apply to PHPUnit
14         required: false
15         default: ''
17 env:
18   php: 8.1
20 jobs:
21   Grunt:
22     runs-on: ubuntu-22.04
24     steps:
25       - name: Checking out code
26         uses: actions/checkout@v4
28       - name: Configuring node & npm
29         uses: actions/setup-node@v4
30         with:
31           node-version-file: '.nvmrc'
33       - name: Installing node stuff
34         run: npm install
36       - name: Running grunt
37         run: npx grunt
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.
43         run: |
44           git add .
45           git reset -- npm-shrinkwrap.json
46           git diff --cached --exit-code
48   PHPUnit:
49     runs-on: ${{ matrix.os }}
50     services:
51       exttests:
52         image: moodlehq/moodle-exttests
53         ports:
54           - 8080:80
55       redis:
56         image: redis
57         ports:
58           - 6379:6379
59     strategy:
60       fail-fast: false
61       matrix:
62         include:
63           - os: ubuntu-22.04
64             php: 7.4
65             extensions:
66             db: mysqli
67           - os: ubuntu-22.04
68             php: 8.1
69             db: pgsql
71     steps:
72       - name: Setting up DB mysql
73         if: ${{ matrix.db == 'mysqli' }}
74         uses: moodlehq/mysql-action@v1
75         with:
76           collation server: utf8mb4_bin
77           mysql version: 5.7
78           mysql database: test
79           mysql user: test
80           mysql password: test
81           use tmpfs: true
82           tmpfs size: '1024M'
83           extra conf: --skip-log-bin
85       - name: Setting up DB pgsql
86         if: ${{ matrix.db == 'pgsql' }}
87         uses: m4nu56/postgresql-action@v1
88         with:
89           postgresql version: 12
90           postgresql db: test
91           postgresql user: test
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
99         with:
100           php-version: ${{ matrix.php }}
101           extensions: ${{ matrix.extensions }}
102           ini-values: max_input_vars=5000
103           coverage: none
105       - name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
106         uses: actions/checkout@v4
108       - name: Setting up PHPUnit
109         env:
110           dbtype: ${{ matrix.db }}
111         run: |
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
114           mkdir ../moodledata
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
119         env:
120           dbtype: ${{ matrix.db }}
121           phpunit_options: ${{ secrets.phpunit_options }}
122         run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}