diff --git a/.github/workflows/symfony.yml b/.github/workflows/lint-and-tests.yml similarity index 52% rename from .github/workflows/symfony.yml rename to .github/workflows/lint-and-tests.yml index 0146b15..b58ab89 100644 --- a/.github/workflows/symfony.yml +++ b/.github/workflows/lint-and-tests.yml @@ -1,4 +1,4 @@ -name: Symfony CI +name: Lint and Tests on: push: @@ -10,9 +10,90 @@ permissions: contents: read jobs: - symfony: - name: CI + php-setup: + name: PHP Setup runs-on: ubuntu-latest + outputs: + vendor-path: ${{ steps.upload.outputs.artifact-path }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, xml, intl, curl, iconv, pdo_pgsql, sodium, zip, http + + - name: Cache Composer dependencies + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader + + - name: Upload vendor folder + uses: actions/upload-artifact@v3 + with: + name: php-vendor + path: vendor + id: upload + + + phpstan: + name: PHPStan + runs-on: ubuntu-latest + needs: php-setup + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download PHP vendor + uses: actions/download-artifact@v3 + with: + name: php-vendor + path: vendor + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - name: Run PHPStan + run: vendor/bin/phpstan analyse + + + cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-latest + needs: [ php-setup, phpstan ] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download PHP vendor + uses: actions/download-artifact@v3 + with: + name: php-vendor + path: vendor + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - name: Run PHP-CS-Fixer + run: vendor/bin/php-cs-fixer fix --dry-run --diff + + + tests: + name: Tests + runs-on: ubuntu-latest + needs: [ php-setup, cs-fixer, phpstan ] services: postgres: image: postgres @@ -29,13 +110,11 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Cache Composer dependencies - uses: actions/cache@v3 + - name: Download PHP vendor + uses: actions/download-artifact@v3 with: + name: php-vendor path: vendor - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - name: Set up PHP uses: shivammathur/setup-php@v2 @@ -43,15 +122,6 @@ jobs: php-version: '8.3' extensions: mbstring, xml, intl, curl, iconv, pdo_pgsql, sodium, zip, http - - name: Install backend dependencies - run: composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader - - - name: Run PHP-CS-Fixer - run: vendor/bin/php-cs-fixer fix --dry-run --diff - - - name: Run PHPStan - run: vendor/bin/phpstan analyse - - name: Prepare database run: bin/console --env=test doctrine:database:create && bin/console --env=test doctrine:migrations:migrate @@ -64,6 +134,12 @@ jobs: - name: Run PHPUnit run: vendor/bin/phpunit --coverage-text + eslint: + name: ESLint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 - name: Cache Node modules uses: actions/cache@v3 with: