|
| 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 | + generate-and-test-client: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + name: Generate and test client |
| 13 | + container: |
| 14 | + image: ghcr.io/wyrihaximusnet/php:8.2-nts-alpine-dev-root |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + with: |
| 18 | + fetch-depth: '0' |
| 19 | + persist-credentials: 'false' |
| 20 | + - uses: "ramsey/composer-install@v2" |
| 21 | + - run: make generate-example-client-one |
| 22 | + - name: Tar example files |
| 23 | + run: tar -czf example.tar ./example |
| 24 | + - name: Upload Generated Client |
| 25 | + uses: actions/upload-artifact@v3 |
| 26 | + with: |
| 27 | + name: example-single-client |
| 28 | + path: ./example.tar |
| 29 | + supported-versions-matrix: |
| 30 | + name: Supported Versions Matrix |
| 31 | + runs-on: ubuntu-latest |
| 32 | + outputs: |
| 33 | + version: ${{ steps.supported-versions-matrix.outputs.version }} |
| 34 | + upcoming: ${{ steps.supported-versions-matrix.outputs.upcoming }} |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v3 |
| 37 | + - id: supported-versions-matrix |
| 38 | + uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 |
| 39 | + with: |
| 40 | + upcomingReleases: true |
| 41 | + supported-checks-matrix: |
| 42 | + name: Supported Checks Matrix |
| 43 | + runs-on: ubuntu-latest |
| 44 | + needs: |
| 45 | + - generate-and-test-client |
| 46 | + outputs: |
| 47 | + check: ${{ steps.supported-checks-matrix.outputs.check }} |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + - name: Download Generated Client |
| 51 | + uses: actions/download-artifact@v3 |
| 52 | + with: |
| 53 | + name: example-single-client |
| 54 | + path: ./ |
| 55 | + - name: UnTar example files |
| 56 | + run: tar -xzf example.tar |
| 57 | + - id: supported-checks-matrix |
| 58 | + name: Generate check |
| 59 | + run: | |
| 60 | + cd example/generated |
| 61 | + printf "Checks found: %s\r\n" $(make task-list-ci) |
| 62 | + printf "::set-output name=check::%s" $(make task-list-ci) |
| 63 | + qa: |
| 64 | + name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
| 69 | + composer: [lowest, locked, highest] |
| 70 | + check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }} |
| 71 | + needs: |
| 72 | + - supported-checks-matrix |
| 73 | + - supported-versions-matrix |
| 74 | + - generate-and-test-client |
| 75 | + runs-on: ubuntu-latest |
| 76 | + container: |
| 77 | + image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-dev-root |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v3 |
| 80 | + with: |
| 81 | + fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags |
| 82 | + - run: git config --global --add safe.directory $GITHUB_WORKSPACE # Do this ourself because `actions/checkout@v3 doesn't succeed in doing this |
| 83 | + - name: Download Generated Client |
| 84 | + uses: actions/download-artifact@v3 |
| 85 | + with: |
| 86 | + name: example-single-client |
| 87 | + path: ./ |
| 88 | + - name: UnTar example files |
| 89 | + run: tar -xzf example.tar |
| 90 | + - uses: ramsey/composer-install@v2 |
| 91 | + with: |
| 92 | + working-directory: "example/generated/" |
| 93 | + ignore-cache: "yes" |
| 94 | + - run: | |
| 95 | + cd example/generated |
| 96 | + make ${{ matrix.check }} || true |
| 97 | + if: needs.supported-versions-matrix.outputs.upcoming == matrix.php |
| 98 | + env: |
| 99 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 100 | + COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
| 101 | + - run: | |
| 102 | + cd example/generated |
| 103 | + make ${{ matrix.check }} |
| 104 | + if: needs.supported-versions-matrix.outputs.upcoming != matrix.php |
| 105 | + env: |
| 106 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 107 | + COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
| 108 | + check-mark: |
| 109 | + name: ✔️ |
| 110 | + needs: |
| 111 | + - qa |
| 112 | + runs-on: ubuntu-latest |
| 113 | + steps: |
| 114 | + - run: echo "✔️" |
0 commit comments