|
| 1 | +name: Moodle Plugin CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master' ] |
| 6 | + pull_request: |
| 7 | + branches: [ 'master' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + selftest: |
| 11 | + name: CI test (make validate) |
| 12 | + runs-on: ubuntu-18.04 |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Check out repository code |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: Setup PHP 7.3 |
| 19 | + uses: shivammathur/setup-php@v2 |
| 20 | + with: |
| 21 | + php-version: 7.3 |
| 22 | + |
| 23 | + - name: Initialise |
| 24 | + run: make init |
| 25 | + |
| 26 | + - name: Validate |
| 27 | + run: make validate |
| 28 | + |
| 29 | + citest: |
| 30 | + name: CI test |
| 31 | + needs: selftest |
| 32 | + runs-on: ubuntu-18.04 |
| 33 | + |
| 34 | + services: |
| 35 | + postgres: |
| 36 | + image: postgres:9.6 |
| 37 | + env: |
| 38 | + POSTGRES_USER: 'postgres' |
| 39 | + POSTGRES_HOST_AUTH_METHOD: 'trust' |
| 40 | + # Health check to wait for postgres to start. |
| 41 | + ports: |
| 42 | + - 5432:5432 |
| 43 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 |
| 44 | + |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + include: |
| 49 | + - php: '7.4' |
| 50 | + moodle-branch: 'master' |
| 51 | + - php: '7.4' |
| 52 | + moodle-branch: 'MOODLE_311_STABLE' |
| 53 | + - php: '7.4' |
| 54 | + moodle-branch: 'MOODLE_310_STABLE' |
| 55 | + - php: '7.4' |
| 56 | + moodle-branch: 'MOODLE_39_STABLE' |
| 57 | + - php: '7.4' |
| 58 | + moodle-branch: 'MOODLE_38_STABLE' |
| 59 | + - php: '7.2' |
| 60 | + moodle-branch: 'MOODLE_35_STABLE' |
| 61 | + - php: '7.0' |
| 62 | + moodle-branch: 'MOODLE_35_STABLE' |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Check out repository code |
| 66 | + uses: actions/checkout@v2 |
| 67 | + |
| 68 | + - name: Install node |
| 69 | + uses: actions/setup-node@v1 |
| 70 | + with: |
| 71 | + node-version: '14.15.0' |
| 72 | + |
| 73 | + - name: Setup PHP ${{ matrix.php }} |
| 74 | + uses: shivammathur/setup-php@v2 |
| 75 | + with: |
| 76 | + php-version: ${{ matrix.php }} |
| 77 | + extensions: pgsql, zip, gd, xmlrpc, soap |
| 78 | + coverage: none |
| 79 | + |
| 80 | + - name: Initialise moodle-plugin-ci |
| 81 | + run: | |
| 82 | + make init |
| 83 | + cp -R tests/Fixture/moodle-local_travis ../moodle-local_travis |
| 84 | + echo $(cd bin; pwd) >> $GITHUB_PATH |
| 85 | + echo $(cd vendor/bin; pwd) >> $GITHUB_PATH |
| 86 | + echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_travis; pwd) >> $GITHUB_ENV |
| 87 | + # PHPUnit depends on en_AU.UTF-8 locale |
| 88 | + sudo locale-gen en_AU.UTF-8 |
| 89 | +
|
| 90 | + - name: Install moodle-plugin-ci |
| 91 | + run: moodle-plugin-ci install -vvv |
| 92 | + env: |
| 93 | + DB: 'pgsql' |
| 94 | + MOODLE_BRANCH: ${{ matrix.moodle-branch }} |
| 95 | + IGNORE_PATHS: 'ignore' |
| 96 | + IGNORE_NAMES: 'ignore_name.php' |
| 97 | + MUSTACHE_IGNORE_NAMES: 'broken.mustache' |
| 98 | + |
| 99 | + - name: Run Integration tests |
| 100 | + env: |
| 101 | + MOODLE_BRANCH: ${{ matrix.moodle-branch }} |
| 102 | + run: | |
| 103 | + make test-phpunit |
| 104 | + moodle-plugin-ci phplint |
| 105 | + moodle-plugin-ci phpcpd |
| 106 | + moodle-plugin-ci phpmd |
| 107 | + moodle-plugin-ci codechecker |
| 108 | + moodle-plugin-ci validate |
| 109 | + moodle-plugin-ci savepoints |
| 110 | + moodle-plugin-ci mustache |
| 111 | + moodle-plugin-ci grunt || [ \ |
| 112 | + "$MOODLE_BRANCH" != 'master' -a \ |
| 113 | + "$MOODLE_BRANCH" != 'MOODLE_310_STABLE' -a \ |
| 114 | + "$MOODLE_BRANCH" != 'MOODLE_39_STABLE' ] |
| 115 | + moodle-plugin-ci phpdoc |
| 116 | + moodle-plugin-ci phpunit --coverage-text |
| 117 | + moodle-plugin-ci behat --profile default |
| 118 | + moodle-plugin-ci behat --profile chrome |
0 commit comments