Skip to content

Commit fc9f4ee

Browse files
CI: Update for Moodle 4.5
1 parent 78cbeb5 commit fc9f4ee

File tree

3 files changed

+23
-210
lines changed

3 files changed

+23
-210
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: 4 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,7 @@
11
name: Moodle Plugin CI
2-
3-
on: [push, pull_request]
2+
on: [ push, pull_request ]
43

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

187
jobs:
19-
release-at-moodle-org:
20-
runs-on: ubuntu-latest
21-
env:
22-
PLUGIN: block_groups
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+
call-moodle-release-workflow:
9+
uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-release.yml@main
10+
with:
11+
plugin-name: 'block_groups'
12+
secrets: inherit

0 commit comments

Comments
 (0)