|
| 1 | +name: Continuous Integration |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'main' |
| 6 | + - 'master' |
| 7 | + - 'refs/heads/v[0-9]+.[0-9]+.[0-9]+' |
| 8 | + pull_request: |
| 9 | +jobs: |
| 10 | + supported-versions-matrix: |
| 11 | + name: Supported Versions Matrix |
| 12 | + runs-on: ubuntu-latest |
| 13 | + needs: |
| 14 | + - lint-yaml |
| 15 | + - lint-json |
| 16 | + outputs: |
| 17 | + version: ${{ steps.supported-versions-matrix.outputs.version }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v1 |
| 20 | + - id: supported-versions-matrix |
| 21 | + uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 |
| 22 | + supported-checks-matrix: |
| 23 | + name: Supported Checks Matrix |
| 24 | + runs-on: ubuntu-latest |
| 25 | + needs: |
| 26 | + - lint-yaml |
| 27 | + - composer-install |
| 28 | + outputs: |
| 29 | + check: ${{ steps.supported-checks-matrix.outputs.check }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v1 |
| 32 | + - id: supported-checks-matrix |
| 33 | + name: Generate check |
| 34 | + run: | |
| 35 | + printf "Checks found: %s\r\n" $(make task-list-ci) |
| 36 | + printf "::set-output name=check::%s" $(make task-list-ci) |
| 37 | + composer-install: |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 42 | + composer: [lowest, current, highest] |
| 43 | + needs: |
| 44 | + - lint-yaml |
| 45 | + - lint-json |
| 46 | + - supported-versions-matrix |
| 47 | + runs-on: ubuntu-latest |
| 48 | + container: |
| 49 | + image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v1 |
| 52 | + - name: Cache composer packages |
| 53 | + uses: actions/cache@v1 |
| 54 | + with: |
| 55 | + path: ./vendor/ |
| 56 | + key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 57 | + - name: Install Dependencies |
| 58 | + run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
| 59 | + if: matrix.composer == 'lowest' |
| 60 | + - name: Install Dependencies |
| 61 | + run: composer install --ansi --no-progress --no-interaction --prefer-dist -o |
| 62 | + if: matrix.composer == 'current' |
| 63 | + - name: Install Dependencies |
| 64 | + run: composer update --ansi --no-progress --no-interaction --prefer-dist -o |
| 65 | + if: matrix.composer == 'highest' |
| 66 | + qa: |
| 67 | + name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (Linux) |
| 68 | + strategy: |
| 69 | + fail-fast: false |
| 70 | + matrix: |
| 71 | + php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 72 | + composer: [lowest, current, highest] |
| 73 | + check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }} |
| 74 | + needs: |
| 75 | + - lint-yaml |
| 76 | + - lint-json |
| 77 | + - composer-install |
| 78 | + - supported-checks-matrix |
| 79 | + - supported-versions-matrix |
| 80 | + runs-on: ubuntu-latest |
| 81 | + container: |
| 82 | + image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v1 |
| 85 | + - name: Cache composer packages |
| 86 | + uses: actions/cache@v1 |
| 87 | + with: |
| 88 | + path: ./vendor/ |
| 89 | + key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 90 | + - name: Install Dependencies |
| 91 | + run: (test -f vendor && true ) || composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
| 92 | + if: matrix.composer == 'lowest' |
| 93 | + - name: Install Dependencies |
| 94 | + run: (test -f vendor && true ) || composer install --ansi --no-progress --no-interaction --prefer-dist -o |
| 95 | + if: matrix.composer == 'current' |
| 96 | + - name: Install Dependencies |
| 97 | + run: (test -f vendor && true ) || composer update --ansi --no-progress --no-interaction --prefer-dist -o |
| 98 | + if: matrix.composer == 'highest' |
| 99 | + - name: Fetch Tags |
| 100 | + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true |
| 101 | + if: matrix.check == 'backward-compatibility-check' |
| 102 | + - run: make ${{ matrix.check }} |
| 103 | + env: |
| 104 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 105 | + COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
| 106 | + unittests-directly-on-os: |
| 107 | + name: Run unit tests on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (${{ matrix.os }}) |
| 108 | + strategy: |
| 109 | + fail-fast: false |
| 110 | + matrix: |
| 111 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 112 | + php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 113 | + composer: [lowest, current, highest] |
| 114 | + needs: |
| 115 | + - lint-yaml |
| 116 | + - lint-json |
| 117 | + - composer-install |
| 118 | + - supported-versions-matrix |
| 119 | + runs-on: ${{ matrix.os }} |
| 120 | + steps: |
| 121 | + - uses: actions/checkout@v1 |
| 122 | + - name: Setup PHP, extensions and composer with shivammathur/setup-php |
| 123 | + uses: shivammathur/setup-php@v2 |
| 124 | + with: |
| 125 | + php-version: ${{ matrix.php }} |
| 126 | + coverage: xdebug, pcov |
| 127 | + - name: Cache composer packages |
| 128 | + uses: actions/cache@v1 |
| 129 | + with: |
| 130 | + path: ./vendor/ |
| 131 | + key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 132 | + - name: Install Dependencies |
| 133 | + run: (test -f vendor && true ) || composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
| 134 | + if: matrix.composer == 'lowest' |
| 135 | + - name: Install Dependencies |
| 136 | + run: (test -f vendor && true ) || composer install --ansi --no-progress --no-interaction --prefer-dist -o |
| 137 | + if: matrix.composer == 'current' |
| 138 | + - name: Install Dependencies |
| 139 | + run: (test -f vendor && true ) || composer update --ansi --no-progress --no-interaction --prefer-dist -o |
| 140 | + if: matrix.composer == 'highest' |
| 141 | + - name: Fetch Tags |
| 142 | + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true |
| 143 | + if: matrix.check == 'backward-compatibility-check' |
| 144 | + - run: | |
| 145 | + ./vendor/bin/phpunit -c ./etc/qa/phpunit.xml |
| 146 | + env: |
| 147 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 148 | + COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
| 149 | + lint-yaml: |
| 150 | + name: Lint YAML |
| 151 | + runs-on: ubuntu-latest |
| 152 | + steps: |
| 153 | + - uses: actions/checkout@v1 |
| 154 | + - name: yaml-lint |
| 155 | + uses: ibiqlik/action-yamllint@v3 |
| 156 | + with: |
| 157 | + config_data: | |
| 158 | + extends: default |
| 159 | + ignore: | |
| 160 | + /.git/ |
| 161 | + rules: |
| 162 | + line-length: disable |
| 163 | + document-start: disable |
| 164 | + truthy: disable |
| 165 | + lint-json: |
| 166 | + name: Lint JSON |
| 167 | + runs-on: ubuntu-latest |
| 168 | + steps: |
| 169 | + - uses: actions/checkout@v1 |
| 170 | + - name: json-syntax-check |
| 171 | + uses: limitusus/json-syntax-check@v1 |
| 172 | + with: |
| 173 | + pattern: "\\.json$" |
| 174 | + check-mark: |
| 175 | + name: ✔️ |
| 176 | + needs: |
| 177 | + - lint-yaml |
| 178 | + - lint-json |
| 179 | + - qa |
| 180 | + - unittests-directly-on-os |
| 181 | + runs-on: ubuntu-latest |
| 182 | + steps: |
| 183 | + - run: echo "✔️" |
0 commit comments