-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Update actions #38
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,55 +1,52 @@ | ||||||||||
--- | ||||||||||
name: Unit tests | ||||||||||
|
||||||||||
on: | ||||||||||
push: | ||||||||||
paths: | ||||||||||
- '**.php' | ||||||||||
- 'composer.json' | ||||||||||
branches: | ||||||||||
- 'master' | ||||||||||
tags: | ||||||||||
- '*' | ||||||||||
- '!v1' | ||||||||||
- '!v2' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer keeping the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That doesn't make much sense Imho. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Care to elaborate? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above.
Suggested change
|
||||||||||
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 }} | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My assumption was that most users will have a dependency to |
||||||||||
|
||||||||||
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 |
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine 👍