Skip to content

Commit 2e91aeb

Browse files
Update for Moodle 4.5 (#199)
* Codestyle fixes * CI: Use centralized workflow and update for Moodle 4.5 * Codestyle and PHP Docs * update version number * exclude unsupported version --------- Co-authored-by: TamaroWalter <[email protected]>
1 parent e41e61c commit 2e91aeb

27 files changed

+105
-292
lines changed

.github/workflows/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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_403_STABLE": ["8.0", "8.2"],
7+
"MOODLE_404_STABLE": ["8.1", "8.3"],
8+
"MOODLE_405_STABLE": ["8.1", "8.2", "8.3"]
9+
},
10+
"moodle-plugin-ci": "4.5.5"
11+
}

.github/workflows/moodle-ci.yml

Lines changed: 6 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -1,195 +1,9 @@
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-
strategy:
10-
matrix:
11-
php: ['8.3']
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@v3
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: Get composer cache directory
32-
id: composer-cache
33-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
34-
35-
- name: Composer cache
36-
uses: actions/cache@v3
37-
with:
38-
path: ${{ steps.composer-cache.outputs.dir }}
39-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
40-
restore-keys: |
41-
${{ runner.os }}-composer-
42-
43-
- name: npm cache
44-
uses: actions/cache@v3
45-
with:
46-
path: ~/.npm
47-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
48-
restore-keys: |
49-
${{ runner.os }}-node-
50-
51-
- name: Initialise moodle-plugin-ci
52-
run: |
53-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci 4.5.4
54-
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
55-
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
56-
sudo locale-gen en_AU.UTF-8
57-
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
58-
59-
- name: Install moodle-plugin-ci
60-
run: |
61-
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 --no-init
62-
env:
63-
DB: ${{ matrix.database }}
64-
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
65-
66-
- name: PHP Lint
67-
if: ${{ always() }}
68-
run: moodle-plugin-ci phplint
69-
70-
- name: PHP Copy/Paste Detector
71-
if: ${{ always() }}
72-
run: moodle-plugin-ci phpcpd
73-
continue-on-error: true
74-
75-
- name: PHP Mess Detector
76-
if: ${{ always() }}
77-
run: moodle-plugin-ci phpmd
78-
79-
- name: Moodle Code Checker
80-
if: ${{ always() }}
81-
run: moodle-plugin-ci codechecker
82-
83-
- name: Moodle PHPDoc Checker
84-
if: ${{ always() }}
85-
run: moodle-plugin-ci phpdoc
86-
continue-on-error: true
87-
88-
- name: Validating
89-
if: ${{ always() }}
90-
run: moodle-plugin-ci validate
91-
92-
- name: Check upgrade savepoints
93-
if: ${{ always() }}
94-
run: moodle-plugin-ci savepoints
95-
96-
- name: Mustache Lint
97-
if: ${{ always() }}
98-
run: moodle-plugin-ci mustache
99-
continue-on-error: true
100-
101-
- name: Grunt
102-
if: ${{ always() }}
103-
run: moodle-plugin-ci grunt
104-
continue-on-error: true
105-
106-
test:
107-
runs-on: ubuntu-latest
108-
needs: static
109-
110-
strategy:
111-
fail-fast: false
112-
matrix:
113-
php: ['8.0', '8.1', '8.2', '8.3']
114-
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
115-
database: ['mariadb', 'pgsql']
116-
exclude:
117-
- php: '8.0'
118-
moodle-branch: 'MOODLE_404_STABLE'
119-
- php: '8.2'
120-
moodle-branch: 'MOODLE_401_STABLE'
121-
- php: '8.3'
122-
moodle-branch: 'MOODLE_401_STABLE'
123-
- php: '8.3'
124-
moodle-branch: 'MOODLE_402_STABLE'
125-
- php: '8.3'
126-
moodle-branch: 'MOODLE_403_STABLE'
127-
include:
128-
- php: '7.4'
129-
moodle-branch: 'MOODLE_401_STABLE'
130-
database: 'pgsql'
131-
- php: '7.4'
132-
moodle-branch: 'MOODLE_401_STABLE'
133-
database: 'mariadb'
134-
135-
steps:
136-
- name: Start MariaDB
137-
if: matrix.database == 'mariadb'
138-
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10
139-
140-
- name: Start PostgreSQL
141-
if: matrix.database == 'pgsql'
142-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14
143-
144-
- name: Check out repository code
145-
uses: actions/checkout@v3
146-
with:
147-
path: plugin
148-
149-
- name: Setup PHP ${{ matrix.php }}
150-
uses: shivammathur/setup-php@v2
151-
with:
152-
php-version: ${{ matrix.php }}
153-
ini-values: max_input_vars=5000
154-
coverage: none
155-
156-
- name: Get composer cache directory
157-
id: composer-cache
158-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
159-
- name: Composer cache
160-
uses: actions/cache@v3
161-
with:
162-
path: ${{ steps.composer-cache.outputs.dir }}
163-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
164-
restore-keys: |
165-
${{ runner.os }}-composer-
166-
- name: npm cache
167-
uses: actions/cache@v3
168-
with:
169-
path: ~/.npm
170-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
171-
restore-keys: |
172-
${{ runner.os }}-node-
173-
174-
- name: Initialise moodle-plugin-ci
175-
run: |
176-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci 4.5.4
177-
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
178-
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
179-
sudo locale-gen en_AU.UTF-8
180-
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
181-
182-
- name: Install moodle-plugin-ci
183-
run: |
184-
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
185-
env:
186-
DB: ${{ matrix.database }}
187-
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
188-
189-
- name: PHPUnit tests
190-
if: ${{ always() }}
191-
run: moodle-plugin-ci phpunit
192-
193-
- name: Behat features
194-
if: ${{ always() }}
195-
run: moodle-plugin-ci behat --auto-rerun 0
5+
call:
6+
name: ""
7+
uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-ci.yml@main
8+
with:
9+
allow-mustache-lint-error: true

.github/workflows/moodle-release.yml

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: mod_moodleoverflow
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@Q}" \
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: 'mod_moodleoverflow'
12+
secrets: inherit

amd/build/activityhelp.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/activityhelp.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)