hippomundo/laravel-sitemap

View on GitHub
.github/workflows/workflow.yml

Summary

Maintainability
Test Coverage
name: PHP tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  php-tests:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        php-versions: ['8.1']

    name: PHP ${{ matrix.php-versions }} tests

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-versions }}
        extensions: mbstring, intl
        ini-values: post_max_size=256M, short_open_tag=On
        coverage: xdebug
        tools: php-cs-fixer, phpunit

    - name: Validate composer.json and composer.lock
      run: composer validate

    - name: Install dependencies
      run: composer install --prefer-dist --no-progress --no-suggest

    - name: Migrate configuration
      run: vendor/bin/phpunit --migrate-configuration

    - name: Execute PHPUnit tests
      run: vendor/bin/phpunit --configuration phpunit.xml --coverage-text

    - name: Upload coverage results to Codeclimate
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      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
        vendor/bin/phpunit tests --coverage-clover build/logs/clover.xml
        ./cc-test-reporter after-build -t clover --exit-code $?