|
| 1 | +name: Moodle plugin CI |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + test: |
| 6 | + runs-on: 'ubuntu-latest' |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | + include: |
| 11 | + - php: '7.4' |
| 12 | + moodle-branch: 'MOODLE_401_STABLE' |
| 13 | + database: 'mariadb' |
| 14 | + - php: '8.0' |
| 15 | + moodle-branch: 'MOODLE_401_STABLE' |
| 16 | + database: 'pgsql' |
| 17 | + - php: '8.0' |
| 18 | + moodle-branch: 'MOODLE_402_STABLE' |
| 19 | + database: 'mariadb' |
| 20 | + |
| 21 | + services: |
| 22 | + postgres: |
| 23 | + image: postgres |
| 24 | + env: |
| 25 | + POSTGRES_USER: 'postgres' |
| 26 | + POSTGRES_HOST_AUTH_METHOD: 'trust' |
| 27 | + options: >- |
| 28 | + --health-cmd pg_isready |
| 29 | + --health-interval 10s |
| 30 | + --health-timeout 5s |
| 31 | + --health-retries 3 |
| 32 | + ports: |
| 33 | + - 5432:5432 |
| 34 | + |
| 35 | + mariadb: |
| 36 | + image: mariadb:10 |
| 37 | + env: |
| 38 | + MYSQL_USER: 'root' |
| 39 | + MYSQL_ALLOW_EMPTY_PASSWORD: "true" |
| 40 | + ports: |
| 41 | + - 3306:3306 |
| 42 | + options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v2 |
| 47 | + with: |
| 48 | + path: plugin |
| 49 | + |
| 50 | + - name: Install node |
| 51 | + uses: actions/setup-node@v1 |
| 52 | + with: |
| 53 | + node-version: ${{ matrix.node }} |
| 54 | + |
| 55 | + - name: Setup PHP |
| 56 | + uses: shivammathur/setup-php@v2 |
| 57 | + with: |
| 58 | + php-version: ${{ matrix.php }} |
| 59 | + extensions: zip, gd, mbstring, pgsql, mysqli |
| 60 | + ini-values: max_input_vars=5000 |
| 61 | + coverage: none |
| 62 | + |
| 63 | + - name: Deploy moodle-plugin-ci |
| 64 | + run: | |
| 65 | + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 |
| 66 | + # Add dirs to $PATH |
| 67 | + echo $(cd ci/bin; pwd) >> $GITHUB_PATH |
| 68 | + echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH |
| 69 | + # PHPUnit depends on en_AU.UTF-8 locale |
| 70 | + sudo locale-gen en_AU.UTF-8 |
| 71 | + - name: Install Moodle |
| 72 | + # Need explicit IP to stop mysql client fail on attempt to use unix socket. |
| 73 | + run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 |
| 74 | + env: |
| 75 | + DB: ${{ matrix.database }} |
| 76 | + MOODLE_BRANCH: ${{ matrix.moodle-branch }} |
| 77 | + IGNORE_PATHS: 'tool/printable/classes/bfpdf.php' |
| 78 | + |
| 79 | + - name: phplint |
| 80 | + if: ${{ always() }} |
| 81 | + run: moodle-plugin-ci phplint |
| 82 | + |
| 83 | + - name: phpcpd |
| 84 | + if: ${{ always() }} |
| 85 | + run: moodle-plugin-ci phpcpd || true |
| 86 | + |
| 87 | + - name: phpmd |
| 88 | + if: ${{ always() }} |
| 89 | + run: moodle-plugin-ci phpmd |
| 90 | + |
| 91 | + - name: codechecker |
| 92 | + if: ${{ always() }} |
| 93 | + run: moodle-plugin-ci codechecker |
| 94 | + |
| 95 | + - name: Moodle PHPDoc Checker |
| 96 | + if: ${{ always() }} |
| 97 | + run: moodle-plugin-ci phpdoc |
| 98 | + |
| 99 | + - name: validate |
| 100 | + if: ${{ always() }} |
| 101 | + run: moodle-plugin-ci validate |
| 102 | + |
| 103 | + - name: savepoints |
| 104 | + if: ${{ always() }} |
| 105 | + run: moodle-plugin-ci savepoints |
| 106 | + |
| 107 | + - name: mustache |
| 108 | + if: ${{ always() }} |
| 109 | + run: moodle-plugin-ci mustache |
| 110 | + |
| 111 | + - name: grunt |
| 112 | + if: ${{ always() }} |
| 113 | + run: moodle-plugin-ci grunt |
| 114 | + |
| 115 | + - name: phpunit |
| 116 | + if: ${{ always() }} |
| 117 | + run: moodle-plugin-ci phpunit |
| 118 | + |
| 119 | + - name: behat |
| 120 | + if: ${{ always() }} |
| 121 | + run: moodle-plugin-ci behat --profile chrome |
0 commit comments