Merge branch 'MDL-78684-402' of https://github.com/andelacruz/moodle into MOODLE_402_...
[moodle.git] / .github / workflows / push.yml
blobdc532e870d1f6561afbf048c239e96aa7cd5cb93
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]+*
11 env:
12   php: 8.2
14 jobs:
15   Grunt:
16     runs-on: ubuntu-22.04
18     steps:
19       - name: Checking out code
20         uses: actions/checkout@v3
22       - name: Configuring node & npm
23         uses: actions/setup-node@v3
24         with:
25           node-version-file: '.nvmrc'
27       - name: Installing node stuff
28         run: npm install
30       - name: Running grunt
31         run: npx grunt
33       - name: Looking for uncommitted changes
34         # Add all files to the git index and then run diff --cached to see all changes.
35         # This ensures that we get the status of all files, including new files.
36         # We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
37         run: |
38           git add .
39           git reset -- npm-shrinkwrap.json
40           git diff --cached --exit-code
42   PHPUnit:
43     runs-on: ${{ matrix.os }}
44     services:
45       exttests:
46         image: moodlehq/moodle-exttests
47         ports:
48           - 8080:80
49       redis:
50         image: redis
51         ports:
52           - 6379:6379
53     strategy:
54       fail-fast: false
55       matrix:
56         include:
57           # MySQL builds always run with the lowest PHP supported version.
58           - os: ubuntu-22.04
59             php: 8.0
60             extensions:
61             db: mysqli
62           # PostgreSQL builds always run with the highest PHP supported version.
63           - os: ubuntu-22.04
64             php: 8.2
65             db: pgsql
67     steps:
68       - name: Setting up DB mysql
69         if: ${{ matrix.db == 'mysqli' }}
70         uses: moodlehq/mysql-action@v1
71         with:
72           collation server: utf8mb4_bin
73           mysql version: 8.0
74           mysql database: test
75           mysql user: test
76           mysql password: test
77           use tmpfs: true
78           tmpfs size: '1024M'
79           extra conf: --skip-log-bin
81       - name: Setting up DB pgsql
82         if: ${{ matrix.db == 'pgsql' }}
83         uses: m4nu56/postgresql-action@v1
84         with:
85           postgresql version: 13
86           postgresql db: test
87           postgresql user: test
88           postgresql password: test
90       - name: Configuring git vars
91         uses: rlespinasse/github-slug-action@v4
93       - name: Setting up PHP ${{ matrix.php }}
94         uses: shivammathur/setup-php@v2
95         with:
96           php-version: ${{ matrix.php }}
97           extensions: ${{ matrix.extensions }}
98           ini-values: max_input_vars=5000
99           coverage: none
101       - name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
102         uses: actions/checkout@v3
104       - name: Setting up PHPUnit
105         env:
106           dbtype: ${{ matrix.db }}
107         run: |
108           echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
109           cp .github/workflows/config-template.php config.php
110           mkdir ../moodledata
111           sudo locale-gen en_AU.UTF-8
112           php admin/tool/phpunit/cli/init.php --no-composer-self-update
114       - name: Running PHPUnit tests
115         env:
116           dbtype: ${{ matrix.db }}
117           phpunit_options: ${{ secrets.phpunit_options }}
118         run: vendor/bin/phpunit $phpunit_options