|
1 | 1 | name: Moodle Plugin CI |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
4 | 10 |
|
5 | 11 | jobs: |
6 | | - static: |
7 | | - runs-on: ubuntu-latest |
8 | | - |
9 | | - strategy: |
10 | | - matrix: |
11 | | - php: ['8.3'] |
12 | | - moodle-branch: ['MOODLE_405_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 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 | | - |
74 | | - - name: PHP Mess Detector |
75 | | - if: ${{ always() }} |
76 | | - run: moodle-plugin-ci phpmd |
77 | | - |
78 | | - - name: Moodle Code Checker |
79 | | - if: ${{ always() }} |
80 | | - run: moodle-plugin-ci codechecker |
81 | | - |
82 | | - - name: Moodle PHPDoc Checker |
83 | | - if: ${{ 1==2 }} |
84 | | - run: moodle-plugin-ci phpdoc |
85 | | - continue-on-error: true |
86 | | - |
87 | | - - name: Validating |
88 | | - if: ${{ always() }} |
89 | | - run: moodle-plugin-ci validate |
90 | | - |
91 | | - - name: Check upgrade savepoints |
92 | | - if: ${{ always() }} |
93 | | - run: moodle-plugin-ci savepoints |
94 | | - |
95 | | - - name: Mustache Lint |
96 | | - if: ${{ always() }} |
97 | | - run: moodle-plugin-ci mustache |
98 | | - |
99 | | - - name: Grunt |
100 | | - if: ${{ always() }} |
101 | | - run: moodle-plugin-ci grunt |
102 | | - |
103 | | - test: |
104 | | - runs-on: ubuntu-latest |
105 | | - needs: static |
106 | | - |
107 | | - strategy: |
108 | | - fail-fast: false |
109 | | - matrix: |
110 | | - php: ['8.3'] |
111 | | - moodle-branch: ['MOODLE_405_STABLE'] |
112 | | - database: ['mariadb', 'pgsql'] |
113 | | - include: |
114 | | - - php: '8.3' |
115 | | - moodle-branch: 'MOODLE_405_STABLE' |
116 | | - database: 'mariadb' |
117 | | - - php: '8.3' |
118 | | - moodle-branch: 'MOODLE_405_STABLE' |
119 | | - database: 'pgsql' |
120 | | - |
121 | | - steps: |
122 | | - - name: Start MariaDB |
123 | | - if: matrix.database == 'mariadb' |
124 | | - run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10 |
125 | | - |
126 | | - - name: Start PostgreSQL |
127 | | - if: matrix.database == 'pgsql' |
128 | | - run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:14 |
129 | | - |
130 | | - - name: Check out repository code |
131 | | - uses: actions/checkout@v3 |
132 | | - with: |
133 | | - path: plugin |
134 | | - |
135 | | - - name: Setup PHP ${{ matrix.php }} |
136 | | - uses: shivammathur/setup-php@v2 |
137 | | - with: |
138 | | - php-version: ${{ matrix.php }} |
139 | | - ini-values: max_input_vars=5000 |
140 | | - coverage: none |
141 | | - |
142 | | - - name: Get composer cache directory |
143 | | - id: composer-cache |
144 | | - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
145 | | - - name: Composer cache |
146 | | - uses: actions/cache@v3 |
147 | | - with: |
148 | | - path: ${{ steps.composer-cache.outputs.dir }} |
149 | | - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
150 | | - restore-keys: | |
151 | | - ${{ runner.os }}-composer- |
152 | | - - name: npm cache |
153 | | - uses: actions/cache@v3 |
154 | | - with: |
155 | | - path: ~/.npm |
156 | | - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
157 | | - restore-keys: | |
158 | | - ${{ runner.os }}-node- |
159 | | -
|
160 | | - - name: Initialise moodle-plugin-ci |
161 | | - run: | |
162 | | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 |
163 | | - echo $(cd ci/bin; pwd) >> $GITHUB_PATH |
164 | | - echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH |
165 | | - sudo locale-gen en_AU.UTF-8 |
166 | | - echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV |
167 | | -
|
168 | | - - name: Install moodle-plugin-ci |
169 | | - run: | |
170 | | - moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 |
171 | | - env: |
172 | | - DB: ${{ matrix.database }} |
173 | | - MOODLE_BRANCH: ${{ matrix.moodle-branch }} |
174 | | - |
175 | | - - name: PHPUnit tests |
176 | | - if: ${{ always() }} |
177 | | - run: moodle-plugin-ci phpunit |
178 | | - |
179 | | - - name: Behat features |
180 | | - if: ${{ always() }} |
181 | | - run: moodle-plugin-ci behat --auto-rerun 0 |
| 12 | + call-moodle-ci: |
| 13 | + name: "Run CI workflow for Learnweb plugins" |
| 14 | + uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-ci.yml@main |
0 commit comments