Skip to content

Commit 7ae852a

Browse files
committed
first commit
0 parents  commit 7ae852a

File tree

7 files changed

+1064
-0
lines changed

7 files changed

+1064
-0
lines changed

.github/workflows/moodle-ci.yml

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

.github/workflows/moodle-release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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
9+
10+
on:
11+
release:
12+
types: [published]
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
jobs:
19+
release-at-moodle-org:
20+
runs-on: ubuntu-latest
21+
env:
22+
PLUGIN: townsquareextension_zoom
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

0 commit comments

Comments
 (0)