From 1fcf37f1ed659425702f3e343dab1d70a3e9eccd Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 13 Nov 2024 17:58:26 +0100 Subject: [PATCH 1/2] GH Actions/quicktest: fiddle the PHP versions Installing on PHP 5.4 with Composer on Windows runs into issues a lot of time. Considering PHP 5.4 is ancient, let's just side-step this problem by using PHP 5.5. Also see PHPCSStandards/composer-installer 213 for a little more context (yes, I've seen this issue before). --- .github/workflows/quicktest.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index 953b19724e..dcd9e74522 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -28,7 +28,18 @@ jobs: strategy: matrix: os: ['ubuntu-latest', 'windows-latest'] - php: ['5.4', '7.2', 'latest'] + php: ['7.2', 'latest'] + + include: + - php: '5.4' + os: 'ubuntu-latest' + custom_ini: false + # Installing on Windows with PHP 5.4 runs into all sorts of problems with Composer. + # See this issue for more context (yes, I've seen this problem before): + # @link https://github.com/PHPCSStandards/composer-installer/pull/213 + - php: '5.5' + os: 'windows-latest' + custom_ini: false name: "QuickTest: PHP ${{ matrix.php }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})" From 512647f71ae791dfbb1b703bd1e5f578578d63d1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 13 Nov 2024 18:36:24 +0100 Subject: [PATCH 2/2] GH Actions: don't convert line endings By default the `actions/checkout` runner uses the default git settings for line ending normalization, which is `true`. For Windows, this means that `lf` line endings in files get converted to `crlf` on checkout. In the case of PHPCS, this is problematic as this means that the integration test, which runs PHPCS over the code in PHPCS itself, would fail on hundreds of `End of line character is invalid; expected "\n" but found "\r\n"` CS errors. Now, this line ending normalization can be undone via some config in `.gitattributes`, but that could negatively impact contributors who may prefer to have the line ending conversion when working on files in their local editors. So instead of that, this commit just turns it off in CI alone. The `core.autocrlf input` setting should leave the line-endings "as-is" when it gets checked out. Refs: * https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace * https://github.com/actions/checkout/issues/135 * https://github.com/actions/checkout/issues/226 --- .github/workflows/quicktest.yml | 3 +++ .github/workflows/test.yml | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index dcd9e74522..ed24bec539 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -44,6 +44,9 @@ jobs: name: "QuickTest: PHP ${{ matrix.php }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})" steps: + - name: Prepare git to leave line endings alone + run: git config --global core.autocrlf input + - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 93fb9a79ec..6645cb7f7f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -118,6 +118,9 @@ jobs: continue-on-error: ${{ matrix.php == '8.5' }} steps: + - name: Prepare git to leave line endings alone + run: git config --global core.autocrlf input + - name: Checkout code uses: actions/checkout@v4 @@ -229,6 +232,9 @@ jobs: name: "Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})" steps: + - name: Prepare git to leave line endings alone + run: git config --global core.autocrlf input + - name: Checkout code uses: actions/checkout@v4