Skip to content

Commit 4b461bb

Browse files
committed
CI: Use centralized workflows and update for Moodle 4.5
1 parent e75a91b commit 4b461bb

File tree

3 files changed

+22
-199
lines changed

3 files changed

+22
-199
lines changed

.github/workflows/config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"main-moodle": "MOODLE_405_STABLE",
3+
"main-php": "8.3",
4+
"moodle-php": {
5+
"MOODLE_401_STABLE": ["7.4", "8.1"],
6+
"MOODLE_402_STABLE": ["8.0", "8.2"],
7+
"MOODLE_403_STABLE": ["8.0", "8.2"],
8+
"MOODLE_404_STABLE": ["8.1", "8.3"],
9+
"MOODLE_405_STABLE": ["8.1", "8.2", "8.3"]
10+
},
11+
"moodle-plugin-ci": "4.4.5"
12+
}

.github/workflows/moodle-ci.yml

Lines changed: 3 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,7 @@
11
name: Moodle Plugin CI
2-
32
on: [push, pull_request]
43

54
jobs:
6-
static:
7-
runs-on: ubuntu-latest
8-
9-
strategy:
10-
matrix:
11-
php: ['8.2']
12-
moodle-branch: ['MOODLE_404_STABLE']
13-
database: ['pgsql']
14-
15-
steps:
16-
- name: Start PostgreSQL
17-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14
18-
19-
- name: Check out repository code
20-
uses: actions/checkout@v4
21-
with:
22-
path: plugin
23-
24-
- name: Setup PHP ${{ matrix.php }}
25-
uses: shivammathur/setup-php@v2
26-
with:
27-
php-version: ${{ matrix.php }}
28-
ini-values: max_input_vars=5000
29-
coverage: none
30-
31-
- name: Initialise moodle-plugin-ci
32-
run: |
33-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
34-
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
35-
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
36-
sudo locale-gen en_AU.UTF-8
37-
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
38-
39-
- name: Install moodle-plugin-ci
40-
run: |
41-
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 --no-init
42-
env:
43-
DB: ${{ matrix.database }}
44-
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
45-
46-
- name: PHP Lint
47-
if: ${{ always() }}
48-
run: moodle-plugin-ci phplint
49-
50-
- name: PHP Mess Detector
51-
if: ${{ always() }}
52-
run: moodle-plugin-ci phpmd
53-
54-
- name: Moodle Code Checker
55-
if: ${{ always() }}
56-
run: moodle-plugin-ci codechecker
57-
58-
- name: Moodle PHPDoc Checker
59-
if: ${{ always() }}
60-
run: moodle-plugin-ci phpdoc
61-
62-
- name: Validating
63-
if: ${{ always() }}
64-
run: moodle-plugin-ci validate
65-
66-
- name: Check upgrade savepoints
67-
if: ${{ always() }}
68-
run: moodle-plugin-ci savepoints
69-
70-
- name: Mustache Lint
71-
if: ${{ always() }}
72-
run: moodle-plugin-ci mustache
73-
74-
- name: Grunt
75-
if: ${{ always() }}
76-
run: moodle-plugin-ci grunt
77-
78-
test:
79-
runs-on: ubuntu-latest
80-
needs: static
81-
82-
strategy:
83-
fail-fast: false
84-
matrix:
85-
php: ['8.0', '8.1', '8.2']
86-
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
87-
database: ['mariadb', 'pgsql']
88-
exclude:
89-
- php: '8.0'
90-
moodle-branch: 'MOODLE_404_STABLE'
91-
- php: '8.2'
92-
moodle-branch: 'MOODLE_401_STABLE'
93-
include:
94-
- php: '7.4'
95-
moodle-branch: 'MOODLE_401_STABLE'
96-
database: 'pgsql'
97-
- php: '7.4'
98-
moodle-branch: 'MOODLE_401_STABLE'
99-
database: 'mariadb'
100-
101-
steps:
102-
- name: Start MariaDB
103-
if: matrix.database == 'mariadb'
104-
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10
105-
106-
- name: Start PostgreSQL
107-
if: matrix.database == 'pgsql'
108-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14
109-
110-
- name: Check out repository code
111-
uses: actions/checkout@v4
112-
with:
113-
path: plugin
114-
115-
- name: Setup PHP ${{ matrix.php }}
116-
uses: shivammathur/setup-php@v2
117-
with:
118-
php-version: ${{ matrix.php }}
119-
ini-values: max_input_vars=5000
120-
coverage: none
121-
122-
- name: Initialise moodle-plugin-ci
123-
run: |
124-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
125-
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
126-
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
127-
sudo locale-gen en_AU.UTF-8
128-
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
129-
130-
- name: Install moodle-plugin-ci
131-
run: |
132-
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
133-
env:
134-
DB: ${{ matrix.database }}
135-
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
136-
137-
- name: PHPUnit tests
138-
if: ${{ always() }}
139-
run: moodle-plugin-ci phpunit
140-
141-
- name: Behat features
142-
if: ${{ always() }}
143-
run: moodle-plugin-ci behat --profile chrome --auto-rerun 0
144-
145-
# This step allows to upload Behat faildump (screenshots) as workflow artifact,
146-
# so it can be downloaded and inspected. You don't need this step if you
147-
# are not running Behat test. Artifact will be retained for 7 days.
148-
- name: Upload Behat Faildump
149-
if: ${{ failure() && steps.behat.outcome == 'failure' }}
150-
uses: actions/upload-artifact@v4
151-
with:
152-
name: Behat Faildump (${{ join(matrix.*, ', ') }})
153-
path: ${{ github.workspace }}/moodledata/behat_dump
154-
retention-days: 7
155-
if-no-files-found: ignore
5+
run-moodle-ci:
6+
name: "Run the Moodle CI pipeline"
7+
uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-ci.yml@main
Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,13 @@
1-
#
2-
# Whenever a new tag starting with "v" is pushed, add the tagged version
3-
# to the Moodle Plugins directory at https://moodle.org/plugins
4-
#
5-
# revision: 2021070201
6-
# Changed to be released on Github release with the release notes.
7-
#
8-
name: Releasing in the Plugins directory
1+
name: Moodle Plugin Release
92

103
on:
114
release:
125
types: [published]
136

14-
defaults:
15-
run:
16-
shell: bash
17-
187
jobs:
19-
release-at-moodle-org:
20-
runs-on: ubuntu-latest
21-
env:
22-
PLUGIN: mod_groupmembers
23-
CURL: curl -s
24-
ENDPOINT: https://moodle.org/webservice/rest/server.php
25-
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
26-
FUNCTION: local_plugins_add_version
27-
28-
steps:
29-
- name: Call the service function
30-
id: add-version
31-
run: |
32-
TAGNAME="${{ github.event.release.tag_name }}"
33-
BODY="${{ github.event.release.body }}"
34-
ZIPURL="${{ github.event.release.zipball_url }}"
35-
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
36-
--data-urlencode "wsfunction=${FUNCTION}" \
37-
--data-urlencode "moodlewsrestformat=json" \
38-
--data-urlencode "frankenstyle=${PLUGIN}" \
39-
--data-urlencode "zipurl=${ZIPURL}" \
40-
--data-urlencode "vcssystem=git" \
41-
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
42-
--data-urlencode "vcstag=${TAGNAME}" \
43-
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
44-
--data-urlencode "altdownloadurl=${ZIPURL}" \
45-
--data-urlencode "releasenotes=${BODY}" \
46-
--data-urlencode "releasenotesformat=4")
47-
echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
48-
- name: Evaluate the response
49-
id: evaluate-response
50-
env:
51-
RESPONSE: ${{ steps.add-version.outputs.response }}
52-
run: |
53-
jq <<< ${RESPONSE}
54-
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
8+
publish-release-on-moodle:
9+
name: "Publish new release in Moodle plugins directory"
10+
uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-release.yml@main
11+
with:
12+
plugin-name: 'mod_groupmembers'
13+
secrets: inherit

0 commit comments

Comments
 (0)