Skip to content

Commit 643b39d

Browse files
author
Rens Sikma
committed
Merge branch 'add-workflow' into 'master'
Add github workflow See merge request training/lab-tools/moodle-local_oauth!6
2 parents 082bc5b + 6735d41 commit 643b39d

File tree

167 files changed

+20135
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+20135
-102
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: Moodle Plugin CI
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-22.04
9+
10+
services:
11+
postgres:
12+
image: postgres:14
13+
env:
14+
POSTGRES_USER: 'postgres'
15+
POSTGRES_HOST_AUTH_METHOD: 'trust'
16+
ports:
17+
- 5432:5432
18+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
19+
20+
mariadb:
21+
image: mariadb:10
22+
env:
23+
MYSQL_USER: 'root'
24+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
25+
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
26+
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
27+
ports:
28+
- 3306:3306
29+
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
php: ['8.1', '8.3']
35+
moodle-branch: ['MOODLE_405_STABLE']
36+
database: [pgsql, mariadb]
37+
38+
steps:
39+
- name: Check out repository code
40+
uses: actions/checkout@v4
41+
with:
42+
path: plugin
43+
44+
- name: Setup PHP ${{ matrix.php }}
45+
uses: shivammathur/setup-php@v2
46+
with:
47+
php-version: ${{ matrix.php }}
48+
extensions: ${{ matrix.extensions }}
49+
ini-values: max_input_vars=5000
50+
# If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug".
51+
# If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems).
52+
coverage: none
53+
54+
- name: Initialise moodle-plugin-ci
55+
run: |
56+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
57+
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
58+
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
59+
sudo locale-gen en_AU.UTF-8
60+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
61+
62+
- name: Install moodle-plugin-ci
63+
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
64+
env:
65+
DB: ${{ matrix.database }}
66+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
67+
# Uncomment this to run Behat tests using the Moodle App.
68+
# MOODLE_APP: 'true'
69+
70+
- name: PHP Lint
71+
if: ${{ !cancelled() }}
72+
run: moodle-plugin-ci phplint ./plugin
73+
74+
- name: PHP Mess Detector
75+
continue-on-error: true # This step will show errors but will not fail
76+
if: ${{ !cancelled() }}
77+
run: moodle-plugin-ci phpmd ./plugin
78+
79+
- name: Moodle Code Checker
80+
if: ${{ !cancelled() }}
81+
run: moodle-plugin-ci phpcs --max-warnings 0 ./plugin
82+
83+
- name: Moodle PHPDoc Checker
84+
if: ${{ !cancelled() }}
85+
run: moodle-plugin-ci phpdoc --max-warnings 0 ./plugin
86+
87+
- name: Validating
88+
if: ${{ !cancelled() }}
89+
run: moodle-plugin-ci validate ./plugin
90+
91+
- name: Check upgrade savepoints
92+
if: ${{ !cancelled() }}
93+
run: moodle-plugin-ci savepoints ./plugin
94+
95+
- name: Mustache Lint
96+
if: ${{ !cancelled() }}
97+
run: moodle-plugin-ci mustache ./plugin
98+
99+
# no javascript used in this pluing
100+
# - name: Grunt
101+
# if: ${{ !cancelled() }}
102+
# run: moodle-plugin-ci grunt --max-lint-warnings 0 ./plugin
103+
104+
- name: PHPUnit tests
105+
if: ${{ !cancelled() }}
106+
run: moodle-plugin-ci phpunit --fail-on-warning ./plugin
107+
108+
- name: Behat features
109+
id: behat
110+
if: ${{ !cancelled() }}
111+
run: moodle-plugin-ci behat --profile chrome ./plugin
112+
113+
- name: Upload Behat Faildump
114+
if: ${{ failure() && steps.behat.outcome == 'failure' }}
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: Behat Faildump (${{ join(matrix.*, ', ') }})
118+
path: ${{ github.workspace }}/moodledata/behat_dump
119+
retention-days: 7
120+
if-no-files-found: ignore
121+
122+
- name: Mark cancelled jobs as failed.
123+
if: ${{ cancelled() }}
124+
run: exit 1

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/vendor/
21
.well-known/

.gitlab-ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ default:
3636
- export PATH="/opt/moodle-plugin-ci/bin:/opt/moodle-plugin-ci/vendor/bin:$PATH"
3737
# TODO not always needed
3838
# install moodle
39-
# - moodle-plugin-ci install --db-host db
39+
# - moodle-plugin-ci install --db-host db
4040
# - '{ php -S 0.0.0.0:8000 -t "$CI_PROJECT_DIR/moodle" >/dev/null 2>&1 & }'
4141

4242
# install dependencies:
@@ -74,8 +74,6 @@ validate:
7474
stage: test
7575
# image: moodlehq/moodle-php-apache:7
7676
image: moodlehq/moodle-php-apache:8.1
77-
# variables:
78-
# MOODLE_BRANCH: 'MOODLE_310_STABLE'
7977
script:
8078
- composer install
8179
# - validate-version # TODO complains about CHANGELOG.md, even if it exist double check

0 commit comments

Comments
 (0)