Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
name: CI

on: ['push', 'pull_request']
on:
push:
branches:
- '0.x'
- '0.next'
- '1.x'
pull_request:
branches:
- '*'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be noted that using * will not work if the branch name includes a /. If you're looking to match any branch name, you'd want to use **. Alternatively, remove the entire clause and just do:

  pull_request:

and I think that'll work the same way as doing:

  pull_request:
    branches:
      - '**'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that was just copied from our cakephp repo. I'll check it out.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant GH action docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

*: Matches zero or more characters, but does not match the / character. For example, Octo* matches Octocat.
**: Matches zero or more of any character.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm willing to bet that the original workflow for cake was copied from somewhere. I wish they'd document the defaults better. All I see is a comment explaining the default activity types that triggers, although it's logical that no branch filter means all branches.

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request

Looks like we need to clean this up for all repos.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, remove it alltogether, just keep the pull_request: part.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, when GH actions was original released, I remember a lot of the original examples and early repos would do *, as I remember hitting this issue in some of my early usages of GH actions. It's definitely not the most intuitive thing, especially as I think the vast majority of repos probably don't use / in branch names and so would never hit this case.


jobs:
testsuite:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '8.0', '8.1']
php-version: ['7.2', '7.4', '8.0', '8.1']
db-type: [sqlite, mysql, pgsql]
prefer-lowest: ['']
include:
- php-version: '8.2'
db-type: mysql
- php-version: '7.2'
db-type: 'mysql'
prefer-lowest: 'prefer-lowest'
db-type: mysql
prefer-lowest: prefer-lowest

steps:
- name: Setup MySQL latest
Expand Down Expand Up @@ -57,7 +67,7 @@ jobs:

- name: Composer install
run: |
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
if [[ ${{ matrix.php-version }} == '8.2' ]]; then
composer install --ignore-platform-req=php
elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --prefer-lowest --prefer-stable
Expand Down Expand Up @@ -89,27 +99,27 @@ jobs:
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export MYSQL_DSN='mysql://root:root@127.0.0.1/phinx'; fi
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export PGSQL_DSN='pgsql://postgres:postgres@127.0.0.1/phinx'; fi

if [[ ${{ matrix.php-version }} == '8.0' ]]; then
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
else
vendor/bin/phpunit
fi

- name: Prefer lowest check
if: matrix.prefer-lowest == 'prefer-lowest'
run: composer require --dev dereuromark/composer-prefer-lowest && vendor/bin/validate-prefer-lowest -m
run: composer require --dev dereuromark/composer-prefer-lowest && vendor/bin/validate-prefer-lowest -m

- name: Submit code coverage
if: matrix.php-version == '8.0'
if: matrix.php-version == '8.1'
uses: codecov/codecov-action@v3

testsuite-windows:
runs-on: windows-2019
name: Windows - PHP 7.4 & SQL Server
name: Windows - PHP 8.1 & SQL Server

env:
EXTENSIONS: pdo_sqlsrv
PHP_VERSION: '7.4'
PHP_VERSION: '8.1'

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -181,7 +191,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
php-version: '7.4'
coverage: none

- name: Get composer cache directory
Expand All @@ -205,4 +215,5 @@ jobs:
run: vendor/bin/phpcs --report=checkstyle -np app/ src/ tests/

- name: Run phpstan
if: always()
run: vendor/bin/phpstan.phar analyse --error-format=github