wol-soft/php-json-schema-model-generator

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
name: CI

on: [push, pull_request]

jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php: ['8.0', '8.1', '8.2', '8.3']

    name: PHP ${{ matrix.php }} tests
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: mbstring, json
          coverage: xdebug

      - name: Install dependencies
        run: composer install

      - name: Prepare codeclimate test reporter
        if: ${{ matrix.php == '8.2' }}
        run: |
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
          chmod +x ./cc-test-reporter
          ./cc-test-reporter before-build

      - name: Execute tests
        run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --testdox

      - name: Upload the reports to coveralls.io
        if: ${{ matrix.php == '8.2' }}
        run: |
          composer global require php-coveralls/php-coveralls
          php-coveralls -v
        env:
          COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Upload the reports to codeclimate
        if: ${{ matrix.php == '8.2' }}
        run: sudo ./cc-test-reporter after-build -r $CC_TEST_REPORTER_ID
        env:
          CC_TEST_REPORTER_ID: 5e32818628fac9eb11d34e2b35289f88169610cc4a98c6f170c74923342284f1