name: Code checks

on:
  push:
    branches: [ main ]
  pull_request: null

jobs:
  ecs:
    runs-on: ubuntu-latest
    continue-on-error: true
    strategy:
      matrix:
        php: [ '8.0' ]
    name: PHP ${{ matrix.php }}
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: none
      - run: composer install --prefer-dist --no-progress --no-suggest
      - run: composer create-project nette/coding-standard temp/coding-standard --no-progress
      - name: copy preset-sniffer
        uses: canastro/copy-file-action@master
        with:
          source: ".coding-standard/project.xml"
          target: "temp/coding-standard/preset-sniffer/project.xml"
      - name: copy preset-fixer
        uses: canastro/copy-file-action@master
        with:
          source: ".coding-standard/project.php"
          target: "temp/coding-standard/preset-fixer/project.php"
      - run: php temp/coding-standard/ecs check src tests --preset project
