|
| 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 | +package-name: |
| 11 | +name:Package Name |
| 12 | +runs-on:ubuntu-latest |
| 13 | +outputs: |
| 14 | +package-name:${{ steps.package-name.outputs.package-name }} |
| 15 | +steps: |
| 16 | + -uses:actions/checkout@v1 |
| 17 | + -id:package-name |
| 18 | +run:| |
| 19 | + printf "::set-output name=package-name::[\"%s\"]" $(docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.name' "${GITHUB_WORKSPACE}/composer.json") |
| 20 | +supported-versions-matrix: |
| 21 | +name:Supported Versions Matrix |
| 22 | +runs-on:ubuntu-latest |
| 23 | +outputs: |
| 24 | +version:${{ steps.supported-versions-matrix.outputs.version }} |
| 25 | +upcoming:${{ steps.supported-versions-matrix.outputs.upcoming }} |
| 26 | +steps: |
| 27 | + -uses:actions/checkout@v1 |
| 28 | + -id:supported-versions-matrix |
| 29 | +uses:WyriHaximus/github-action-composer-php-versions-in-range@v1 |
| 30 | +with: |
| 31 | +upcomingReleases:true |
| 32 | +generate-checks-strategy: |
| 33 | +name:Generate Checks |
| 34 | +runs-on:ubuntu-latest |
| 35 | +outputs: |
| 36 | +check:${{ steps.generate-checks-strategy.outputs.check }} |
| 37 | +steps: |
| 38 | + -uses:actions/checkout@v1 |
| 39 | + -id:generate-checks-strategy |
| 40 | +name:Generate check |
| 41 | +run:| |
| 42 | + printf "Checks found: %s\r\n" $(make task-list-ci) |
| 43 | + printf "::set-output name=check::%s" $(make task-list-ci) |
| 44 | +composer-install: |
| 45 | +strategy: |
| 46 | +fail-fast:false |
| 47 | +matrix: |
| 48 | +php:${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 49 | +composer:[current, highest] |
| 50 | +needs: |
| 51 | + -supported-versions-matrix |
| 52 | +runs-on:ubuntu-latest |
| 53 | +container: |
| 54 | +image:wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-slim-dev-root |
| 55 | +steps: |
| 56 | + -uses:actions/checkout@v1 |
| 57 | + -name:Cache composer packages |
| 58 | +uses:actions/cache@v1 |
| 59 | +with: |
| 60 | +path:./vendor/ |
| 61 | +key:${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 62 | + -name:Install Dependencies |
| 63 | +run:composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
| 64 | +if:matrix.composer == 'lowest' |
| 65 | + -name:Install Dependencies |
| 66 | +run:composer install --ansi --no-progress --no-interaction --prefer-dist -o |
| 67 | +if:matrix.composer == 'current' |
| 68 | + -name:Install Dependencies |
| 69 | +run:composer update --ansi --no-progress --no-interaction --prefer-dist -o |
| 70 | +if:matrix.composer == 'highest' |
| 71 | +can-require: |
| 72 | +name:Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }} |
| 73 | +strategy: |
| 74 | +fail-fast:false |
| 75 | +matrix: |
| 76 | +php:${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 77 | +package-name:${{ fromJson(needs.package-name.outputs.package-name) }} |
| 78 | +needs: |
| 79 | + -package-name |
| 80 | + -supported-versions-matrix |
| 81 | +runs-on:ubuntu-latest |
| 82 | +container: |
| 83 | +image:ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
| 84 | +steps: |
| 85 | + -uses:actions/checkout@v2 |
| 86 | +with: |
| 87 | +path:checked_out_package |
| 88 | + -name:Set Up composer.json |
| 89 | +run:| |
| 90 | + echo "{\"repositories\": [{\"name\": \"${{ matrix.package-name }}\",\"type\": \"path\",\"url\": \"./checked_out_package\"}]}" > composer.json |
| 91 | + -name:Require package |
| 92 | +if:needs.supported-versions-matrix.outputs.upcoming != matrix.php |
| 93 | +run:| |
| 94 | + composer config --no-plugins "allow-plugins.*/*"true |
| 95 | + composer require "${{ matrix.package-name }}:dev-${GITHUB_SHA}" --no-progress --ansi --no-interaction --prefer-dist -o -vvv || composer require "${{ matrix.package-name }}:dev-${GITHUB_REF_NAME}" --no-progress --ansi --no-interaction --prefer-dist -o -vvv |
| 96 | +qa: |
| 97 | +strategy: |
| 98 | +fail-fast:false |
| 99 | +matrix: |
| 100 | +php:${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 101 | +composer:[current, highest] |
| 102 | +check:${{ fromJson(needs.generate-checks-strategy.outputs.check) }} |
| 103 | +needs: |
| 104 | + -supported-versions-matrix |
| 105 | + -composer-install |
| 106 | + -generate-checks-strategy |
| 107 | +runs-on:ubuntu-latest |
| 108 | +container: |
| 109 | +image:wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-slim-dev-root |
| 110 | +steps: |
| 111 | + -uses:actions/checkout@v1 |
| 112 | + -name:Cache composer packages |
| 113 | +uses:actions/cache@v1 |
| 114 | +with: |
| 115 | +path:./vendor/ |
| 116 | +key:${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 117 | + -name:Install Dependencies |
| 118 | +run:composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
| 119 | +if:matrix.composer == 'lowest' |
| 120 | + -name:Install Dependencies |
| 121 | +run:composer install --ansi --no-progress --no-interaction --prefer-dist -o |
| 122 | +if:matrix.composer == 'current' |
| 123 | + -name:Install Dependencies |
| 124 | +run:composer update --ansi --no-progress --no-interaction --prefer-dist -o |
| 125 | +if:matrix.composer == 'highest' |
| 126 | + -name:Fetch Tags |
| 127 | +run:git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true |
| 128 | +if:matrix.check == 'backward-compatibility-check' |
| 129 | + -run:make cs-fix || true |
| 130 | + -run:make ${{ matrix.check }} || true |
| 131 | +if:needs.supported-versions-matrix.outputs.upcoming == matrix.php |
| 132 | +env: |
| 133 | +COVERALLS_REPO_TOKEN:${{ secrets.COVERALLS_REPO_TOKEN }} |
| 134 | +COVERALLS_RUN_LOCALLY:${{ secrets.COVERALLS_RUN_LOCALLY }} |
| 135 | + -run:make ${{ matrix.check }} |
| 136 | +if:needs.supported-versions-matrix.outputs.upcoming != matrix.php |
| 137 | +env: |
| 138 | +COVERALLS_REPO_TOKEN:${{ secrets.COVERALLS_REPO_TOKEN }} |
| 139 | +COVERALLS_RUN_LOCALLY:${{ secrets.COVERALLS_RUN_LOCALLY }} |