Merge branch 'MOODLE_311_STABLE_MDL-59115' of https://github.com/mattporritt/moodle...
[moodle.git] / .github / workflows / push.yml
blobc85fd54b84e8905dca876ce47a6c78a7dc084f6e
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.0
14 jobs:
15   Grunt:
16     runs-on: ubuntu-18.04
18     steps:
19       - name: Checking out code
20         uses: actions/checkout@v2
22       - name: Configuring node & npm
23         shell: bash -l {0}
24         run: nvm install
26       - name: Installing node stuff
27         run: npm install
29       - name: Running grunt
30         run: npx grunt
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.
36         run: |
37           git add .
38           git reset -- npm-shrinkwrap.json
39           git diff --cached --exit-code
41   PHPUnit:
42     runs-on: ${{ matrix.os }}
43     services:
44       exttests:
45         image: moodlehq/moodle-exttests
46         ports:
47           - 8080:80
48       redis:
49         image: redis
50         ports:
51           - 6379:6379
52     strategy:
53       fail-fast: false
54       matrix:
55         include:
56           - os: ubuntu-18.04
57             php: 7.3
58             extensions:
59             db: mysqli
60           - os: ubuntu-18.04
61             php: 8.0
62             db: pgsql
63             extensions: xmlrpc-beta
65     steps:
66       - name: Setting up DB mysql
67         if: ${{ matrix.db == 'mysqli' }}
68         uses: johanmeiring/mysql-action@tmpfs-patch
69         with:
70           collation server: utf8mb4_bin
71           mysql version: 5.7
72           mysql database: test
73           mysql user: test
74           mysql password: test
75           use tmpfs: true
77       - name: Setting up DB pgsql
78         if: ${{ matrix.db == 'pgsql' }}
79         uses: m4nu56/postgresql-action@v1
80         with:
81           postgresql version: 9.6
82           postgresql db: test
83           postgresql user: test
84           postgresql password: test
86       - name: Configuring git vars
87         uses: rlespinasse/github-slug-action@v3.x
89       - name: Setting up PHP ${{ matrix.php }}
90         uses: shivammathur/setup-php@v2
91         with:
92           php-version: ${{ matrix.php }}
93           extensions: ${{ matrix.extensions }}
94           ini-values: max_input_vars=5000
95           coverage: none
97       - name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
98         uses: actions/checkout@v2
100       - name: Setting up PHPUnit
101         env:
102           dbtype: ${{ matrix.db }}
103         run: |
104           echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
105           cp .github/workflows/config-template.php config.php
106           mkdir ../moodledata
107           sudo locale-gen en_AU.UTF-8
108           php admin/tool/phpunit/cli/init.php --no-composer-self-update
110       - name: Running PHPUnit tests
111         env:
112           dbtype: ${{ matrix.db }}
113         run: vendor/bin/phpunit -v