|
1 |
| -name: Moodle plugin CI |
| 1 | +name: Moodle Plugin CI |
| 2 | + |
2 | 3 | on: [push, pull_request]
|
3 | 4 |
|
4 | 5 | jobs:
|
5 | 6 | test:
|
6 |
| - runs-on: 'ubuntu-latest' |
7 |
| - strategy: |
8 |
| - fail-fast: false |
9 |
| - matrix: |
10 |
| - include: |
11 |
| - - php: '8.1' |
12 |
| - moodle-branch: 'MOODLE_402_STABLE' |
13 |
| - database: 'mariadb' |
14 |
| - - php: '8.1' |
15 |
| - moodle-branch: 'MOODLE_402_STABLE' |
16 |
| - database: 'mariadb' |
17 |
| - - php: '8.0' |
18 |
| - moodle-branch: 'MOODLE_402_STABLE' |
19 |
| - database: 'mariadb' |
20 |
| - - php: '8.0' |
21 |
| - moodle-branch: 'MOODLE_402_STABLE' |
22 |
| - database: 'mariadb' |
23 |
| - - php: '8.1' |
24 |
| - moodle-branch: 'MOODLE_401_STABLE' |
25 |
| - database: 'mariadb' |
26 |
| - - php: '8.1' |
27 |
| - moodle-branch: 'MOODLE_401_STABLE' |
28 |
| - database: 'mariadb' |
29 |
| - - php: '8.0' |
30 |
| - moodle-branch: 'MOODLE_401_STABLE' |
31 |
| - database: 'mariadb' |
32 |
| - - php: '8.0' |
33 |
| - moodle-branch: 'MOODLE_401_STABLE' |
34 |
| - database: 'mariadb' |
35 |
| - - php: '7.4' |
36 |
| - moodle-branch: 'MOODLE_401_STABLE' |
37 |
| - database: 'mariadb' |
38 |
| - - php: '7.4' |
39 |
| - moodle-branch: 'MOODLE_401_STABLE' |
40 |
| - database: 'mariadb' |
41 |
| - - php: '7.4' |
42 |
| - moodle-branch: 'MOODLE_400_STABLE' |
43 |
| - database: 'mariadb' |
44 |
| - - php: '7.4' |
45 |
| - moodle-branch: 'MOODLE_400_STABLE' |
46 |
| - database: 'mariadb' |
| 7 | + runs-on: ubuntu-22.04 |
47 | 8 |
|
48 | 9 | services:
|
49 | 10 | postgres:
|
50 |
| - image: postgres |
| 11 | + image: postgres:13 |
51 | 12 | env:
|
52 | 13 | POSTGRES_USER: 'postgres'
|
53 | 14 | POSTGRES_HOST_AUTH_METHOD: 'trust'
|
54 |
| - options: >- |
55 |
| - --health-cmd pg_isready |
56 |
| - --health-interval 10s |
57 |
| - --health-timeout 5s |
58 |
| - --health-retries 3 |
59 | 15 | ports:
|
60 | 16 | - 5432:5432
|
| 17 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 |
61 | 18 |
|
62 | 19 | mariadb:
|
63 |
| - image: mariadb:10.5 |
| 20 | + image: mariadb:10 |
64 | 21 | env:
|
65 | 22 | MYSQL_USER: 'root'
|
66 | 23 | MYSQL_ALLOW_EMPTY_PASSWORD: "true"
|
| 24 | + MYSQL_CHARACTER_SET_SERVER: "utf8mb4" |
| 25 | + MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" |
67 | 26 | ports:
|
68 | 27 | - 3306:3306
|
69 | 28 | options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
|
70 | 29 |
|
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + php: ['8.0'] |
| 34 | + moodle-branch: ['MOODLE_403_STABLE', 'MOODLE_404_STABLE'] |
| 35 | + database: [pgsql, mariadb] |
| 36 | + |
71 | 37 | steps:
|
72 |
| - - name: Checkout |
73 |
| - uses: actions/checkout@v3 |
| 38 | + - name: Check out repository code |
| 39 | + uses: actions/checkout@v4 |
74 | 40 | with:
|
75 | 41 | path: plugin
|
76 | 42 |
|
77 |
| - - name: Setup PHP |
| 43 | + - name: Setup PHP ${{ matrix.php }} |
78 | 44 | uses: shivammathur/setup-php@v2
|
79 | 45 | with:
|
80 | 46 | php-version: ${{ matrix.php }}
|
81 |
| - extensions: zip, gd, mbstring, pgsql, mysqli |
| 47 | + extensions: ${{ matrix.extensions }} |
| 48 | + ini-values: max_input_vars=5000 |
| 49 | + coverage: none |
82 | 50 |
|
83 |
| - - name: Deploy moodle-plugin-ci |
| 51 | + - name: Initialise moodle-plugin-ci |
84 | 52 | run: |
|
85 |
| - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 |
86 |
| - # Add dirs to $PATH |
| 53 | + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 |
87 | 54 | echo $(cd ci/bin; pwd) >> $GITHUB_PATH
|
88 | 55 | echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
|
89 |
| - # PHPUnit depends on en_AU.UTF-8 locale |
90 | 56 | sudo locale-gen en_AU.UTF-8
|
91 |
| - - name: Install Moodle |
92 |
| - # Need explicit IP to stop mysql client fail on attempt to use unix socket. |
| 57 | + echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV |
| 58 | +
|
| 59 | + - name: Install moodle-plugin-ci |
93 | 60 | run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
|
94 | 61 | env:
|
95 | 62 | DB: ${{ matrix.database }}
|
96 | 63 | MOODLE_BRANCH: ${{ matrix.moodle-branch }}
|
97 |
| - IGNORE_NAMES: 'mobile_*.mustache' |
98 |
| - IGNORE_PATHS: 'templates/local/mobile' |
99 | 64 |
|
100 |
| - - name: phplint |
101 |
| - if: ${{ always() }} |
| 65 | + - name: PHP Lint |
| 66 | + if: ${{ !cancelled() }} |
102 | 67 | run: moodle-plugin-ci phplint
|
103 | 68 |
|
104 |
| - - name: phpcpd |
105 |
| - if: ${{ always() }} |
106 |
| - run: moodle-plugin-ci phpcpd || true |
| 69 | + - name: PHP Copy/Paste Detector |
| 70 | + continue-on-error: true # This step will show errors but will not fail |
| 71 | + if: ${{ !cancelled() }} |
| 72 | + run: moodle-plugin-ci phpcpd |
107 | 73 |
|
108 |
| - - name: phpmd |
109 |
| - if: ${{ always() }} |
| 74 | + - name: PHP Mess Detector |
| 75 | + continue-on-error: true # This step will show errors but will not fail |
| 76 | + if: ${{ !cancelled() }} |
110 | 77 | run: moodle-plugin-ci phpmd
|
111 | 78 |
|
112 |
| - - name: codechecker |
113 |
| - if: ${{ always() }} |
114 |
| - run: moodle-plugin-ci codechecker |
| 79 | + - name: Moodle Code Checker |
| 80 | + if: ${{ !cancelled() }} |
| 81 | + run: moodle-plugin-ci phpcs --max-warnings 0 |
115 | 82 |
|
116 |
| - - name: validate |
117 |
| - if: ${{ always() }} |
| 83 | + - name: Moodle PHPDoc Checker |
| 84 | + if: ${{ !cancelled() }} |
| 85 | + run: moodle-plugin-ci phpdoc --max-warnings 0 |
| 86 | + |
| 87 | + - name: Validating |
| 88 | + if: ${{ !cancelled() }} |
118 | 89 | run: moodle-plugin-ci validate
|
119 | 90 |
|
120 |
| - - name: savepoints |
121 |
| - if: ${{ always() }} |
| 91 | + - name: Check upgrade savepoints |
| 92 | + if: ${{ !cancelled() }} |
122 | 93 | run: moodle-plugin-ci savepoints
|
123 | 94 |
|
124 |
| - - name: mustache |
125 |
| - if: ${{ always() }} |
| 95 | + - name: Mustache Lint |
| 96 | + if: ${{ !cancelled() }} |
126 | 97 | run: moodle-plugin-ci mustache
|
127 | 98 |
|
128 |
| - - name: grunt |
129 |
| - if: ${{ always() }} |
130 |
| - run: moodle-plugin-ci grunt |
| 99 | + - name: Grunt |
| 100 | + if: ${{ !cancelled() }} |
| 101 | + run: moodle-plugin-ci grunt --max-lint-warnings 0 |
131 | 102 |
|
132 |
| - - name: phpunit |
133 |
| - if: ${{ always() }} |
134 |
| - run: moodle-plugin-ci phpunit |
| 103 | + - name: PHPUnit tests |
| 104 | + if: ${{ !cancelled() }} |
| 105 | + run: moodle-plugin-ci phpunit --fail-on-warning |
135 | 106 |
|
136 |
| - - name: behat |
137 |
| - if: ${{ always() }} |
| 107 | + - name: Behat features |
| 108 | + if: ${{ !cancelled() }} |
138 | 109 | run: moodle-plugin-ci behat --profile chrome
|
| 110 | + |
| 111 | + - name: Mark cancelled jobs as failed. |
| 112 | + if: ${{ cancelled() }} |
| 113 | + run: exit 1 |
0 commit comments