From f82e9af1e24bf45c25f70e74b0ff13a2d0173820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 22 Jan 2021 11:18:18 +0100 Subject: [PATCH 1/3] Add workflow for PHP-CS-Fixer --- .github/workflows/php-cs-fixer.yml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/php-cs-fixer.yml diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml new file mode 100644 index 0000000..bbad947 --- /dev/null +++ b/.github/workflows/php-cs-fixer.yml @@ -0,0 +1,54 @@ +name: "PHP-CS-Fixer checks" + +on: + pull_request: + push: + +jobs: + php-cs-fixer: + name: "PHP-CS-Fixer" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + php-version: + - "7.1" + - "7.2" + - "7.3" + - "7.4" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + tools: composer:v2, cs2pr + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache dependencies" + uses: "actions/cache@v2" + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress" + + + - name: "Lint PHP files" + run: "find src -name *.php | xargs -n 1 php -l" + + - name: "Check coding standards" + run: "vendor/bin/php-cs-fixer fix -v --dry-run" From bf9a21773d25eb09646a70a255ce9fd5c91b150d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 22 Jan 2021 11:23:43 +0100 Subject: [PATCH 2/3] Add checks for composer.json structure --- .github/workflows/composer-json-lint.yml | 53 ++++++++++++++++++++++++ composer.json | 12 +++--- 2 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/composer-json-lint.yml diff --git a/.github/workflows/composer-json-lint.yml b/.github/workflows/composer-json-lint.yml new file mode 100644 index 0000000..f3a810e --- /dev/null +++ b/.github/workflows/composer-json-lint.yml @@ -0,0 +1,53 @@ +name: "Lint composer.json" + +on: + pull_request: + push: + +jobs: + composer-lint: + name: "Lint composer.json" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + php-version: + - "7.4" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + tools: composer:v2, composer-normalize, composer-require-checker + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache dependencies" + uses: "actions/cache@v2" + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress" + + - name: "Validate composer.json" + run: "composer validate --strict" + + - name: "Normalize composer.json" + run: "composer-normalize --dry-run" + + - name: "Check composer.json explicit dependencies" + run: "composer-require-checker check" diff --git a/composer.json b/composer.json index 7f0d1f2..f8664fb 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,22 @@ { "name": "mollie/php-coding-standards", + "type": "library", "description": "Contains PHP coding standards like rules for PHP-CS-Fixer that serves for purpose of standardization.", "license": "BSD-2-Clause", - "type": "library", "authors": [ { "name": "Mollie B.V.", "email": "info@mollie.com" } ], + "require": { + "php": "^7.1.3", + "friendsofphp/php-cs-fixer": "^2.16" + }, "autoload": { "psr-4": { "Mollie\\PhpCodingStandards\\": "src/" } }, - "minimum-stability": "stable", - "require": { - "php": "^7.1.3", - "friendsofphp/php-cs-fixer": "^2.16" - } + "minimum-stability": "stable" } From 41846da5325a976bf26b0221e68d1e43a5be3425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 22 Jan 2021 11:26:51 +0100 Subject: [PATCH 3/3] Remove Travis for good --- .travis.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3b059a4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: php - -dist: xenial - -matrix: - fast_finish: true - allow_failures: - - php: 7.4snapshot - - php: nightly - include: - - php: 7.1 - - php: 7.2 - - php: 7.3 - - php: 7.4snapshot - - php: nightly - -sudo: false - -cache: - directories: - - "$HOME/.composer/cache" - -env: - - COMPOSER_NO_INTERACTION=1 - -install: - - travis_retry composer install --no-suggest - -script: - - composer validate --strict - - find src -name *.php | xargs -n 1 php -l - - vendor/bin/php-cs-fixer fix -v --dry-run