|
| 1 | +name: schema-registry-ci |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | +jobs: |
| 8 | + build-source: |
| 9 | + runs-on: ubuntu-20.04 |
| 10 | + steps: |
| 11 | + - |
| 12 | + name: Checkout |
| 13 | + uses: actions/checkout@v2 |
| 14 | + - |
| 15 | + name: Install phars |
| 16 | + run: | |
| 17 | + make install-phars |
| 18 | + - |
| 19 | + name: Upload source directory |
| 20 | + uses: actions/upload-artifact@v2 |
| 21 | + with: |
| 22 | + name: source |
| 23 | + path: . |
| 24 | + php-xdebug-docker: |
| 25 | + needs: |
| 26 | + - build-source |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + php: |
| 30 | + - |
| 31 | + version: 7.4 |
| 32 | + xdebug: 2.9.8 |
| 33 | + - |
| 34 | + version: 7.3 |
| 35 | + xdebug: 2.9.8 |
| 36 | + - |
| 37 | + version: rc |
| 38 | + xdebug: 3.0.0beta1 |
| 39 | + runs-on: ubuntu-20.04 |
| 40 | + steps: |
| 41 | + - |
| 42 | + name: Download sources |
| 43 | + uses: actions/download-artifact@v2 |
| 44 | + with: |
| 45 | + name: source |
| 46 | + - |
| 47 | + name: Set up Docker Buildx |
| 48 | + uses: docker/setup-buildx-action@v1 |
| 49 | + - |
| 50 | + name: Build |
| 51 | + uses: docker/build-push-action@v2 |
| 52 | + with: |
| 53 | + context: . |
| 54 | + file: ./Dockerfile |
| 55 | + load: true |
| 56 | + tags: schema-registry-client:${{ matrix.php.version }} |
| 57 | + build-args: | |
| 58 | + PHP_VERSION=${{ matrix.php.version }} |
| 59 | + XDEBUG_VERSION=${{ matrix.php.xdebug }} |
| 60 | + - |
| 61 | + name: Inspect docker image |
| 62 | + run: | |
| 63 | + docker image inspect schema-registry-client:${{ matrix.php.version }} |
| 64 | + - |
| 65 | + name: Save docker image |
| 66 | + run: | |
| 67 | + docker save schema-registry-client:${{ matrix.php.version }} -o schema-registry-client-${{ matrix.php.version }}.tgz |
| 68 | + - |
| 69 | + name: Upload docker image |
| 70 | + uses: actions/upload-artifact@v2 |
| 71 | + with: |
| 72 | + name: schema-registry-client-${{ matrix.php.version }} |
| 73 | + path: schema-registry-client-${{ matrix.php.version }}.tgz |
| 74 | + ci-checks: |
| 75 | + runs-on: ubuntu-20.04 |
| 76 | + needs: |
| 77 | + - php-xdebug-docker |
| 78 | + strategy: |
| 79 | + matrix: |
| 80 | + php: |
| 81 | + - |
| 82 | + version: 7.3 |
| 83 | + composer: --prefer-lowest |
| 84 | + - |
| 85 | + version: 7.4 |
| 86 | + composer: --prefer-lowest |
| 87 | + - |
| 88 | + version: rc |
| 89 | + composer: --prefer-lowest |
| 90 | + - |
| 91 | + version: 7.3 |
| 92 | + composer: --prefer-stable |
| 93 | + - |
| 94 | + version: 7.4 |
| 95 | + composer: --prefer-stable |
| 96 | + - |
| 97 | + version: rc |
| 98 | + composer: --prefer-stable |
| 99 | + steps: |
| 100 | + - |
| 101 | + name: Download sources |
| 102 | + uses: actions/download-artifact@v2 |
| 103 | + with: |
| 104 | + name: source |
| 105 | + - |
| 106 | + name: Set up Docker Buildx |
| 107 | + uses: docker/setup-buildx-action@v1 |
| 108 | + - |
| 109 | + name: Download docker image |
| 110 | + uses: actions/download-artifact@v2 |
| 111 | + with: |
| 112 | + name: schema-registry-client-${{ matrix.php.version }} |
| 113 | + - |
| 114 | + name: Load docker image |
| 115 | + run: | |
| 116 | + docker load -i schema-registry-client-${{ matrix.php.version }}.tgz |
| 117 | + - |
| 118 | + name: Install vendors |
| 119 | + run: | |
| 120 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 121 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \ |
| 122 | + composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }} |
| 123 | + - |
| 124 | + name: Run Static analysis |
| 125 | + if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }} |
| 126 | + run: | |
| 127 | + chmod a+x bin/phpstan.phar bin/php-cs-fixer.phar |
| 128 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 129 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \ |
| 130 | + bin/phpstan.phar analyse |
| 131 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 132 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \ |
| 133 | + bin/php-cs-fixer.phar fix --config=.php_cs.dist --diff -v --dry-run --path-mode=intersection --allow-risky=yes \ |
| 134 | + src test |
| 135 | + - |
| 136 | + name: Run PHPUnit |
| 137 | + if: ${{ !(matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable') }} |
| 138 | + run: | |
| 139 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 140 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \ |
| 141 | + vendor/bin/phpunit --exclude-group integration |
| 142 | + - |
| 143 | + name: Run PHPUnit with Coverage Report |
| 144 | + if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }} |
| 145 | + run: | |
| 146 | + mkdir -p build |
| 147 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 148 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \ |
| 149 | + vendor/bin/phpunit --exclude-group integration --coverage-clover=build/coverage.clover --coverage-text |
| 150 | + - name: Publish code coverage |
| 151 | + if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }} |
| 152 | + uses: paambaati/codeclimate-action@v2.7.4 |
| 153 | + env: |
| 154 | + CC_TEST_REPORTER_ID: ${{secrets.CODE_CLIMATE_REPORTER_ID}} |
| 155 | + with: |
| 156 | + coverageLocations: | |
| 157 | + ${{github.workspace}}/build/coverage.clover:clover |
| 158 | + confluent-integration: |
| 159 | + runs-on: ubuntu-20.04 |
| 160 | + needs: |
| 161 | + - php-xdebug-docker |
| 162 | + strategy: |
| 163 | + matrix: |
| 164 | + confluent: |
| 165 | + - |
| 166 | + version: latest |
| 167 | + - |
| 168 | + version: 4.1.4 |
| 169 | + - |
| 170 | + version: 5.5.2 |
| 171 | + steps: |
| 172 | + - |
| 173 | + name: Download sources |
| 174 | + uses: actions/download-artifact@v2 |
| 175 | + with: |
| 176 | + name: source |
| 177 | + - |
| 178 | + name: Set up Docker Buildx |
| 179 | + uses: docker/setup-buildx-action@v1 |
| 180 | + - |
| 181 | + name: Download docker image |
| 182 | + uses: actions/download-artifact@v2 |
| 183 | + with: |
| 184 | + name: schema-registry-client-7.4 |
| 185 | + - |
| 186 | + name: Load docker image |
| 187 | + run: | |
| 188 | + docker load -i schema-registry-client-7.4.tgz |
| 189 | + - |
| 190 | + name: Install vendors |
| 191 | + run: | |
| 192 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 193 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:7.4 \ |
| 194 | + composer update --no-interaction --no-scripts --no-ansi --prefer-stable |
| 195 | + - |
| 196 | + name: Run PHPUnit Integration |
| 197 | + env: |
| 198 | + CONFLUENT_VERSION: ${{ matrix.confluent.version }} |
| 199 | + run: | |
| 200 | + chmod a+x bin/wait-for-all.sh bin/wait-for-it.sh |
| 201 | + make platform |
| 202 | + docker run -i --rm --net=host --sig-proxy=true --pid=host \ |
| 203 | + -e ENABLE_INTEGRATION_TEST=1 -e TEST_SCHEMA_REGISTRY_HOST=172.68.0.103 -e TEST_SCHEMA_REGISTRY_PORT=8081 \ |
| 204 | + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:7.4 \ |
| 205 | + vendor/bin/phpunit --group integration |
0 commit comments