Skip to content

Commit d8b308f

Browse files
CI: Move to Github
1 parent c9d21f8 commit d8b308f

File tree

4 files changed

+171
-163
lines changed

4 files changed

+171
-163
lines changed

.github/workflows/moodle-ci.yml

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

.gitlab-ci.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

codecov.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)