Skip to content

Update actions #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
79 changes: 38 additions & 41 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,52 @@
---
name: Unit tests

on:
push:
paths:
- '**.php'
- 'composer.json'
Comment on lines +6 to +8
Copy link
Owner

Choose a reason for hiding this comment

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

That seems unnecessarily restrictive. I can already see a maintainer in a far-distant future (probably me) wonder why a pipeline didn't run after modifying the phpunit.xml, or adding a fixture JSON file, etc. I'm fine with non-code changes triggering an extra (potentially superflous) build for the sake of simplicity.

Suggested change
paths:
- '**.php'
- 'composer.json'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fine 👍

branches:
- 'master'
tags:
- '*'
- '!v1'
- '!v2'
Copy link
Owner

Choose a reason for hiding this comment

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

I'd prefer keeping the tags configuration, here.

Suggested change
- '!v2'
- '!v2'
tags:
- '*'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That doesn't make much sense Imho.

Copy link
Owner

Choose a reason for hiding this comment

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

Care to elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's just absolutely no need to perform another test upon tag creation. Creating a tag requires a push or a merged PR and in both cases, the tests have already been performed.

pull_request:
paths:
- '**.php'
- 'composer.json'
Comment on lines +14 to +16
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above.

Suggested change
paths:
- '**.php'
- 'composer.json'

branches:
- '*'
- '!v1'
- '!v2'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.3', '7.4']
phpunit: ['8.0', '9.0']
composer-arg: ['']
include:
- php: '8.0'
phpunit: '9.0'
composer-arg: 'ignore-platform-req=php'
exclude:
- php: '8.0'
phpunit: '8.0'
- php: '7.2'
phpunit: '9.0'
runs-on: ubuntu-latest
php: [ '7.2', '7.3', '7.4', '8.0' ]
continue-on-error: ${{ matrix.php == '8.0' }}
name: PHP ${{ matrix.php }}, PHPUnit ${{ matrix.phpunit }}
name: PHP ${{ matrix.php }}
Copy link
Owner

Choose a reason for hiding this comment

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

Since this library not just uses PHPUnit as dependency, but is in itself also intended as an addon for PHPUnit, I'd like to keep testing against multiple versions of PHPUnit (at least those that are supported by this lib, which tend to correlate with the officially supported versions).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is, to let composer decide, which PHPUnit version to use, depending on the current PHP version. It should cover most versions, without explicitly declaring them.

Copy link
Owner

Choose a reason for hiding this comment

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

My assumption was that most users will have a dependency to phpunit/phpunit declared directly in the require-dev section of their composer.json, and will then require-dev any assertion libraries (like this one) on top/in addition to their existing PHPUnit requirements.


steps:
- uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, json
coverage: pcov
tools: composer:v2
- name: Validate composer.json and composer.lock
run: composer validate

- name: Declare required PHPUnit version
run: |
composer require --no-update --dev phpunit/phpunit ~${{ matrix.phpunit }}

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --${{ matrix.composer-arg }}

#- name: Run type checker
# run: ./vendor/bin/psalm

- name: Run unit tests
run: ./vendor/bin/phpunit --testdox
- name: Git checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json

- name: Validate composer.json
run: composer validate

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Run unit tests
run: ./vendor/bin/phpunit
41 changes: 22 additions & 19 deletions .github/workflows/php_coverage.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
name: Unit tests
---
name: Code Coverage

on:
push:
branches:
- 'master'

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Git checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: 7.4
extensions: mbstring, intl, json
coverage: pcov
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.3.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.codeClimateReporterID }}
with:
coverageCommand: ./vendor/bin/phpunit --coverage-clover=clover.xml
debug: true
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: json
coverage: pcov

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.7.4
env:
CC_TEST_REPORTER_ID: ${{ secrets.codeClimateReporterID }}
with:
coverageCommand: ./vendor/bin/phpunit --coverage-clover=clover.xml
debug: true