From 2d96632d6c12a7533c3b520a7ab40d33233724a0 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sun, 25 Aug 2024 21:12:24 +0200 Subject: [PATCH 1/2] Add PHP-CS-Fixer to CI --- .github/workflows/ci.yaml | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5bc459c..34aeeb9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,65 @@ env: REQUIRED_PHP_EXTENSIONS: "curl, json" jobs: + coding-standards: + name: "Coding Standards" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + php-version: + - "8.3" + + steps: + # workaround for missing secret in fork PRs - see https://github.com/actions/checkout/issues/298 + # see https://github.com/rectorphp/rector/commit/d395e1c28b8e6a56711dcc2e10490a82965850e4 + - if: github.actor != 'dependabot[bot]' + name: "Checkout" + uses: "actions/checkout@v4" + with: + ref: "${{ github.head_ref }}" + # Must be used to be able to commit changed files + token: "${{ secrets.SENSIOLABS_DE_BOT_TOKEN }}" + + # in forks, the token is not available - so we cannot use it + - if: github.actor == 'dependabot[bot]' + name: "Checkout" + uses: "actions/checkout@v4" + with: + ref: "${{ github.head_ref }}" + + - + name: "Install PHP with extensions" + uses: "shivammathur/setup-php@2.31.1" + with: + coverage: "none" + extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" + php-version: "${{ matrix.php-version }}" + tools: "composer:v2" + + - + name: "Install dependencies with composer" + uses: "ramsey/composer-install@3.0.0" + with: + composer-options: "--no-scripts" + + - + name: "Create cache directory for friendsofphp/php-cs-fixer" + run: "mkdir -p .build/php-cs-fixer" + + - + name: "Cache cache directory for friendsofphp/php-cs-fixer" + uses: "actions/cache@v4" + with: + path: ".build/php-cs-fixer" + key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}" + restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-" + + - + name: "Run friendsofphp/php-cs-fixer" + run: "vendor/bin/php-cs-fixer fix --diff --verbose" + composer-validate: name: "Validate composer.json" From b014fcbe201e853aec0aa9a095330c71bb792d23 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sun, 25 Aug 2024 21:14:18 +0200 Subject: [PATCH 2/2] - --- .github/workflows/ci.yaml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 34aeeb9..414bb7c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,30 +21,16 @@ jobs: - "8.3" steps: - # workaround for missing secret in fork PRs - see https://github.com/actions/checkout/issues/298 - # see https://github.com/rectorphp/rector/commit/d395e1c28b8e6a56711dcc2e10490a82965850e4 - - if: github.actor != 'dependabot[bot]' - name: "Checkout" - uses: "actions/checkout@v4" - with: - ref: "${{ github.head_ref }}" - # Must be used to be able to commit changed files - token: "${{ secrets.SENSIOLABS_DE_BOT_TOKEN }}" - - # in forks, the token is not available - so we cannot use it - - if: github.actor == 'dependabot[bot]' - name: "Checkout" - uses: "actions/checkout@v4" - with: - ref: "${{ github.head_ref }}" + - name: "Checkout code" + uses: actions/checkout@v3 - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@2.31.1" + uses: "shivammathur/setup-php@v2" with: coverage: "none" - extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" + extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" tools: "composer:v2" -