|
1 | 1 | name: Moodle Plugin CI |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + moodle-core-branch: |
| 9 | + description: 'Moodle core branch to test against (if not provided, the branch will be auto-detected)' |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + repository_dispatch: |
| 13 | + types: [moodle-plugin-ci] |
4 | 14 |
|
5 | 15 | jobs: |
6 | | - test: |
7 | | - runs-on: ubuntu-22.04 |
8 | | - |
9 | | - services: |
10 | | - postgres: |
11 | | - image: postgres:14 |
12 | | - env: |
13 | | - POSTGRES_USER: 'postgres' |
14 | | - POSTGRES_HOST_AUTH_METHOD: 'trust' |
15 | | - ports: |
16 | | - - 5432:5432 |
17 | | - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 |
18 | | - |
19 | | - mariadb: |
20 | | - image: mariadb:10 |
21 | | - env: |
22 | | - MYSQL_USER: 'root' |
23 | | - MYSQL_ALLOW_EMPTY_PASSWORD: "true" |
24 | | - MYSQL_CHARACTER_SET_SERVER: "utf8mb4" |
25 | | - MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" |
26 | | - ports: |
27 | | - - 3306:3306 |
28 | | - options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 |
29 | | - |
30 | | - strategy: |
31 | | - fail-fast: false |
32 | | - matrix: |
33 | | - php: ['8.2', '8.3', '8.4'] |
34 | | - moodle-branch: ['MOODLE_500_STABLE'] |
35 | | - database: [pgsql, mariadb] |
36 | | - |
37 | | - steps: |
38 | | - - name: Check out repository code |
39 | | - uses: actions/checkout@v4 |
40 | | - with: |
41 | | - path: plugin |
42 | | - |
43 | | - - name: Setup PHP ${{ matrix.php }} |
44 | | - uses: shivammathur/setup-php@v2 |
45 | | - with: |
46 | | - php-version: ${{ matrix.php }} |
47 | | - extensions: ${{ matrix.extensions }} |
48 | | - ini-values: max_input_vars=5000 |
49 | | - coverage: none |
50 | | - |
51 | | - - name: Initialise moodle-plugin-ci |
52 | | - run: | |
53 | | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^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: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 |
61 | | - env: |
62 | | - DB: ${{ matrix.database }} |
63 | | - MOODLE_BRANCH: ${{ matrix.moodle-branch }} |
64 | | - |
65 | | - - name: PHP Lint |
66 | | - if: ${{ !cancelled() }} |
67 | | - run: moodle-plugin-ci phplint |
68 | | - |
69 | | - - name: PHP Mess Detector |
70 | | - continue-on-error: true # This step will show errors but will not fail |
71 | | - if: ${{ !cancelled() }} |
72 | | - run: moodle-plugin-ci phpmd |
73 | | - |
74 | | - - name: Moodle Code Checker |
75 | | - if: ${{ !cancelled() }} |
76 | | - run: moodle-plugin-ci phpcs --max-warnings 0 |
77 | | - |
78 | | - - name: Boost Union Code Checker |
79 | | - uses: JJ/github-pr-contains-action@releases/v14 |
80 | | - if: ${{ !cancelled() }} |
81 | | - with: |
82 | | - github-token: ${{github.token}} |
83 | | - diffDoesNotContain: "theme->settings->" |
84 | | - |
85 | | - - name: Moodle PHPDoc Checker |
86 | | - if: ${{ !cancelled() }} |
87 | | - run: moodle-plugin-ci phpdoc --max-warnings 0 |
88 | | - |
89 | | - - name: Validating |
90 | | - if: ${{ !cancelled() }} |
91 | | - run: moodle-plugin-ci validate |
92 | | - |
93 | | - - name: Check upgrade savepoints |
94 | | - if: ${{ !cancelled() }} |
95 | | - run: moodle-plugin-ci savepoints |
96 | | - |
97 | | - - name: Mustache Lint |
98 | | - continue-on-error: true # This step will show errors but will not fail |
99 | | - if: ${{ !cancelled() }} |
100 | | - run: moodle-plugin-ci mustache |
101 | | - |
102 | | - - name: Grunt |
103 | | - if: ${{ !cancelled() }} |
104 | | - run: moodle-plugin-ci grunt --max-lint-warnings 0 |
105 | | - |
106 | | - - name: PHPUnit tests |
107 | | - if: ${{ !cancelled() }} |
108 | | - run: moodle-plugin-ci phpunit --fail-on-warning |
109 | | - |
110 | | - - name: Raise Behat timeout (Required for theme_boost_union_general.feature) |
111 | | - if: ${{ !cancelled() }} |
112 | | - run: moodle-plugin-ci add-config '$CFG->behat_increasetimeout = 3;' |
113 | | - |
114 | | - - name: Behat features |
115 | | - id: behat |
116 | | - if: ${{ !cancelled() }} |
117 | | - run: moodle-plugin-ci behat --profile chrome --suite boost_union |
118 | | - |
119 | | - - name: Upload Behat Faildump |
120 | | - if: ${{ failure() && steps.behat.outcome == 'failure' }} |
121 | | - uses: actions/upload-artifact@v4 |
122 | | - with: |
123 | | - name: Behat Faildump (${{ join(matrix.*, ', ') }}) |
124 | | - path: ${{ github.workspace }}/moodledata/behat_dump |
125 | | - retention-days: 7 |
126 | | - if-no-files-found: ignore |
127 | | - |
128 | | - - name: Mark cancelled jobs as failed. |
129 | | - if: ${{ cancelled() }} |
130 | | - run: exit 1 |
| 16 | + moodle-plugin-ci: |
| 17 | + uses: moodle-an-hochschulen/moodle-workflows/.github/workflows/moodle-plugin-ci.yml@main |
| 18 | + with: |
| 19 | + moodle-core-branch: ${{ inputs.moodle-core-branch || github.event.client_payload.moodle-core-branch }} |
| 20 | + pr-check-diff-does-not-contain: "theme->settings->" |
| 21 | + behat-suite: "boost_union" |
| 22 | + behat-timeout: 3 # Required for theme_boost_union_general.feature |
| 23 | + mustache-continue-on-error: true |
0 commit comments