From 16a986dba5828c224a4457b551eb6caae04aba8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 22:17:24 +0000 Subject: [PATCH 1/3] chore: Update workflows, switch to phpcsstandards/php_codesniffer See: https://github.com/squizlabs/PHP_CodeSniffer/issues/3932 --- .github/workflows/coding-standards.yml | 17 ++++++++--------- .github/workflows/phpmd.yml | 17 ++++++++--------- .github/workflows/phpunit.yml | 20 ++++++++++---------- .github/workflows/test-flight.yml | 16 ++++++++-------- composer.json | 2 +- 5 files changed, 35 insertions(+), 37 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 65729db..0d4f4a8 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -2,26 +2,25 @@ name: "Check Coding Standards" on: pull_request: - push: jobs: coding-standards: name: "Check Coding Standards" - runs-on: "ubuntu-latest" + runs-on: ubuntu-latest steps: - - name: "Checkout" - uses: "actions/checkout@v3" + - name: Checkout + uses: actions/checkout@v4 - - name: "Setup PHP" - uses: "shivammathur/setup-php@v2" + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: php-version: "7.4" tools: composer:v2, cs2pr - - name: "Install dependencies" - run: "composer install --no-interaction --no-progress --no-suggest" + - name: Install dependencies + run: composer install --no-interaction --no-progress - - name: "Run phpcs" + - name: Run phpcs run: vendor/bin/phpcs -q --report=checkstyle | cs2pr diff --git a/.github/workflows/phpmd.yml b/.github/workflows/phpmd.yml index fca81c9..4854690 100644 --- a/.github/workflows/phpmd.yml +++ b/.github/workflows/phpmd.yml @@ -2,26 +2,25 @@ name: "Check phpmd" on: pull_request: - push: jobs: coding-standards: name: "Check phpmd" - runs-on: "ubuntu-latest" + runs-on: ubuntu-latest steps: - - name: "Checkout" - uses: "actions/checkout@v3" + - name: Checkout + uses: actions/checkout@v4 - - name: "Setup PHP" - uses: "shivammathur/setup-php@v2" + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: php-version: "7.4" tools: composer:v2 - - name: "Install dependencies" - run: "composer require phpmd/phpmd --no-interaction --no-progress --no-suggest" + - name: Install dependencies + run: composer require phpmd/phpmd --no-interaction --no-progress - - name: "Run phpmd" + - name: Run phpmd run: vendor/bin/phpmd classes/ text cleancode,codesize,controversial,design,naming,unusedcode diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 8fe3fc9..29b5fec 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -8,7 +8,7 @@ jobs: phpunit: name: PHPUnit tests on PHP ${{ matrix.php-version }} - runs-on: "ubuntu-latest" + runs-on: ubuntu-latest strategy: matrix: @@ -21,19 +21,19 @@ jobs: - "8.2" steps: - - name: "Checkout" - uses: "actions/checkout@v3" + - name: Checkout + uses: actions/checkout@v4 - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - name: Install PHP + uses: shivammathur/setup-php@v2 with: coverage: "pcov" php-version: "${{ matrix.php-version }}" ini-values: memory_limit=-1 tools: composer:v2 - - name: "Cache dependencies" - uses: "actions/cache@v2" + - name: Cache dependencies + uses: actions/cache@v3 with: path: | ~/.composer/cache @@ -41,8 +41,8 @@ jobs: key: "php-${{ matrix.php-version }}" restore-keys: "php-${{ matrix.php-version }}" - - name: "Install dependencies" - run: "composer install --no-interaction --no-progress --no-suggest" + - name: Install dependencies + run: composer install --no-interaction --no-progress - - name: "Tests" + - name: Tests run: vendor/bin/phpunit diff --git a/.github/workflows/test-flight.yml b/.github/workflows/test-flight.yml index dd84e25..ee7fa92 100644 --- a/.github/workflows/test-flight.yml +++ b/.github/workflows/test-flight.yml @@ -8,23 +8,23 @@ jobs: coding-standards: name: "Check test-flight" - runs-on: "ubuntu-latest" + runs-on: ubuntu-latest steps: - - name: "Checkout" - uses: "actions/checkout@v3" + - name: Checkout + uses: actions/checkout@v4 - - name: "Setup PHP" - uses: "shivammathur/setup-php@v2" + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: php-version: "7.4" tools: composer:v2 ini-values: "zend.assertions=1" - - name: "Install dependencies" - run: "composer require cundd/test-flight --no-interaction --no-progress --no-suggest" + - name: Install dependencies + run: composer require cundd/test-flight --no-interaction --no-progress - - name: "Run test-flight" + - name: Run test-flight run: | vendor/bin/test-flight README.md vendor/bin/test-flight classes/ diff --git a/composer.json b/composer.json index ada71fe..f21066e 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { "phpunit/phpunit": "^8.5.13 || ^9.5", - "squizlabs/php_codesniffer": "^3.5" + "phpcsstandards/php_codesniffer": "^3.5" }, "archive": { "exclude": ["/tests"] From 9b7bf467dfdc0acfed72ad650bca83eaf931d86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 22:18:53 +0000 Subject: [PATCH 2/3] update triggers --- .github/workflows/phpunit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 29b5fec..4f86a52 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -2,7 +2,8 @@ name: "PHPUnit tests" on: pull_request: - push: + schedule: + - cron: "0 0 * * *" jobs: phpunit: From 829ee373cf75caf7b3e92d7bbfad15d64067c623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 22:19:26 +0000 Subject: [PATCH 3/3] concurrency cancel-in-progress --- .github/workflows/phpunit.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 4f86a52..db07427 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 0 * * *" +concurrency: + group: ${{ github.head_ref || 'cron' }} + cancel-in-progress: true + jobs: phpunit: name: PHPUnit tests on PHP ${{ matrix.php-version }}