From 6c0047e998ca72d8df64efd63b5c55b7879ec407 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 26 Dec 2021 05:32:26 +0100 Subject: [PATCH 1/3] GH Actions: always use --no-interaction for Composer Adding `--no-interaction` to "plain" Composer commands to potentially prevent CI hanging if, for whatever reason, interaction would be needed in the future. --- .github/workflows/check-cs.yml | 2 +- .github/workflows/run-tests.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-cs.yml b/.github/workflows/check-cs.yml index 450f291..f03398d 100644 --- a/.github/workflows/check-cs.yml +++ b/.github/workflows/check-cs.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | - composer update --prefer-dist --no-suggest --no-progress + composer update --prefer-dist --no-suggest --no-progress --no-interaction - name: Check Code Style run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3f74358..018f616 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -56,21 +56,21 @@ jobs: # Remove the coding standards package as it has a higher minimum PHP # requirement and would prevent running the tests on older PHP versions. - name: 'Composer: remove CS dependency' - run: composer remove --dev --no-update dms/coding-standard + run: composer remove --dev --no-update dms/coding-standard --no-interaction - name: 'Composer: update PHPUnit for testing lowest' if: ${{ matrix.dependency-version == 'prefer-lowest' }} - run: composer require --no-update phpunit/phpunit:"^9.0" + run: composer require --no-update phpunit/phpunit:"^9.0" --no-interaction - name: Install dependencies - normal if: ${{ matrix.php < 8.1 }} run: | - composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress + composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction - name: Install dependencies - ignore platform reqs if: ${{ matrix.php >= 8.1 }} run: | - composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --ignore-platform-reqs + composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --ignore-platform-reqs --no-interaction - name: Execute Unit Tests run: vendor/bin/phpunit From ec8fc2d661e9bb1f92b70cd2b151cbe3ffe0c68e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 26 Dec 2021 05:32:55 +0100 Subject: [PATCH 2/3] GH Actions: auto-cancel previous builds for same branch Previously, in Travis, when the same branch was pushed again and the "Auto cancellation" option on the "Settings" page had been turned on (as it was for most repos), any still running builds for the same branch would be stopped in favour of starting the build for the newly pushed version of the branch. To enable this behaviour in GH Actions, a `concurrency` configuration needs to be added to each workflow for which this should applied to. More than anything, this is a way to be kind to GitHub by not wasting resources which they so kindly provide to us for free. Refs: * https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ * https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency --- .github/workflows/check-cs.yml | 6 ++++++ .github/workflows/run-tests.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/check-cs.yml b/.github/workflows/check-cs.yml index f03398d..18a74c9 100644 --- a/.github/workflows/check-cs.yml +++ b/.github/workflows/check-cs.yml @@ -10,6 +10,12 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: fix-style: name: Fix Code Style diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 018f616..87cb3d5 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,6 +10,12 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: php-tests: runs-on: ubuntu-latest From 0fc6b6247f81e52923d542eb26b6d9a792f4e356 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 26 Dec 2021 05:34:55 +0100 Subject: [PATCH 3/3] GH Actions: update for the release of PHP 8.1 Don't allow PHP 8.1 to fail anymore and start testing against PHP 8.2. --- .github/workflows/run-tests.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 87cb3d5..f355e7e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: - php: ['8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4'] + php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4'] dependency-version: ['prefer-stable'] experimental: [false] @@ -39,8 +39,11 @@ jobs: - php: '8.0' dependency-version: 'prefer-lowest' experimental: false - - php: '8.1' + dependency-version: 'prefer-lowest' + experimental: false + + - php: '8.2' dependency-version: 'prefer-stable' experimental: true @@ -69,12 +72,12 @@ jobs: run: composer require --no-update phpunit/phpunit:"^9.0" --no-interaction - name: Install dependencies - normal - if: ${{ matrix.php < 8.1 }} + if: ${{ matrix.php < 8.2 }} run: | composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction - name: Install dependencies - ignore platform reqs - if: ${{ matrix.php >= 8.1 }} + if: ${{ matrix.php >= 8.2 }} run: | composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --ignore-platform-reqs --no-interaction