biurad/flange

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
# GitHub Actions Documentation: https://docs.github.com/en/actions

name: build
on: [push, pull_request]

jobs:
  tests:
    strategy:
      fail-fast: false
      matrix:
        operating-system: [ubuntu-latest, windows-latest, macos-latest]
        php-versions: ['8.0', '8.1', '8.2']

    runs-on: ${{ matrix.operating-system }}

    steps:
      - name: Set git to use LF on Windows
        if: matrix.operating-system == 'windows-latest'
        run: |
          git config --global core.autocrlf false
          git config --global core.eol lf

      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, xml, ctype, iconv, curl, fileinfo
          coverage: xdebug
          tools: composer:v2

      - name: Get composer cache directory
        id: composercache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache composer dependencies
        uses: actions/cache@v3
        with:
          path: ${{ steps.composercache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Install dependencies
        run: composer install --no-progress --optimize-autoloader

      - name: Run unit tests (PHPUnit)
        run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml

      - name: "Upload coverage report to Codecov"
        uses: codecov/codecov-action@v2
        continue-on-error: true
        with:
          files: ./coverage.xml

      - name: "Upload coverage report to CodeClimate"
        uses: paambaati/codeclimate-action@v3.0.0
        continue-on-error: true
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

      - name: Check coding standards (PHP_CodeSniffer)
        run: vendor/bin/phpcs

      #- name: Statically analyze code (Phpstan)
      #  run: vendor/bin/phpstan analyse

      #- name: Statically analyze code (Psalm)
      #  run: vendor/bin/psalm --output-format=github --taint-analysis --shepherd --report=build/logs/psalm.sarif

      #- name: "Upload security analysis results to GitHub"
      #  uses: "github/codeql-action/upload-sarif@v1"
      #  with:
      #    sarif_file: "build/logs/psalm.sarif"

      - name: "Benchmark for Performance"
        if: matrix.operating-system == 'windows-latest'
        run: |
          composer require phpbench/phpbench -W
          vendor/bin/phpbench run --report=default --revs=1000 -l none