Skip to content

Commit 5fae275

Browse files
committed
Improve the GitHub Actions workflow for the tests
1 parent 53c14a2 commit 5fae275

File tree

1 file changed

+42
-54
lines changed

1 file changed

+42
-54
lines changed

.github/workflows/tests.yaml

Lines changed: 42 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Continuous Integration
22

33
on:
44
pull_request: null
@@ -9,87 +9,75 @@ on:
99
- 3.5.x
1010

1111
jobs:
12-
Tests:
12+
tests:
13+
name: Tests
1314
runs-on: ubuntu-latest
14-
continue-on-error: ${{ matrix.experimental == true }}
1515
env:
16-
SYMFONY_REQUIRE: ${{matrix.symfony_constraint}}
16+
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
php:
21-
- '8.0'
22-
- '7.4'
23-
- '7.3'
2421
- '7.2'
25-
sentry_constraint: [false]
26-
symfony_constraint: ['']
27-
experimental: [false]
28-
include:
29-
- description: 'Symfony 5.0'
30-
php: '8.0'
31-
symfony_constraint: 5.0.*
32-
- description: 'Symfony 5.0'
33-
php: '7.4'
34-
symfony_constraint: 5.0.*
35-
- description: 'Symfony 4.4'
36-
php: '8.0'
37-
symfony_constraint: 4.4.*
38-
- description: 'Symfony 4.4'
39-
php: '7.4'
40-
symfony_constraint: 4.4.*
41-
- description: 'Symfony 3.4'
42-
php: '7.2'
43-
symfony_constraint: 3.4.*
44-
env:
45-
SYMFONY_DEPRECATIONS_HELPER: disabled
46-
- description: 'prefer lowest'
47-
php: '7.2'
48-
composer_option: '--prefer-lowest'
49-
env:
50-
SYMFONY_DEPRECATIONS_HELPER: disabled
51-
52-
name: PHP ${{ matrix.php }} tests (${{ matrix.description }})
22+
- '7.3'
23+
- '7.4'
24+
- '8.0'
25+
symfony-version:
26+
- 3.4.*
27+
- 4.4.*
28+
- 5.2.*
29+
dependencies:
30+
- lowest
31+
- highest
32+
5333
steps:
5434
- name: Checkout
5535
uses: actions/checkout@v2
5636
with:
5737
fetch-depth: 2
5838

59-
- name: Cache
60-
uses: actions/cache@v2
61-
with:
62-
path: ~/.composer/cache/files
63-
key: ${{ matrix.php }}-${{ matrix.symfony_constraint }}-${{ matrix.composer_option }}
64-
6539
- name: Setup PHP
6640
uses: shivammathur/setup-php@v2
6741
with:
6842
php-version: ${{ matrix.php }}
6943
coverage: xdebug
7044

71-
- name: Install Symfony Flex
72-
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
45+
- name: Setup Problem Matchers for PHPUnit
46+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
47+
48+
- name: Determine Composer cache directory
49+
id: composer-cache
50+
run: echo "::set-output name=directory::$(composer config cache-dir)"
51+
52+
- name: Cache Composer dependencies
53+
uses: actions/cache@v2
54+
with:
55+
path: ${{ steps.composer-cache.outputs.directory }}
56+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
57+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependencies }}-composer-
7358

7459
- name: Remove Symfony Messenger
7560
run: composer remove --dev symfony/messenger --no-update
76-
if: matrix.symfony_constraint == '3.4.*' || matrix.composer_option == '--prefer-lowest'
61+
if: matrix.symfony-version == '3.4.*' || matrix.composer_option == '--prefer-lowest'
62+
63+
- name: Install Symfony Flex
64+
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
7765

78-
- name: Install dependencies
79-
run: composer update --no-progress --ansi ${{ matrix.composer_option }}
66+
- name: Install highest dependencies
67+
run: composer update --no-progress --no-interaction --prefer-dist
68+
if: ${{ matrix.dependencies == 'highest' }}
8069

81-
- name: Install Sentry
82-
run: composer require sentry/sentry dev-develop
83-
if: matrix.sentry_constraint == 'dev-develop'
70+
- name: Install lowest dependencies
71+
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
72+
if: ${{ matrix.dependencies == 'lowest' }}
8473

85-
- name: Run PHPUnit tests
86-
run: vendor/bin/phpunit --coverage-clover=coverage.xml
74+
- name: Run tests
75+
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
8776

88-
- name: Run codecov
77+
- name: Upload code coverage
8978
uses: codecov/codecov-action@v1
9079
with:
91-
file: './coverage.xml'
92-
fail_ci_if_error: true
80+
file: build/coverage-report.xml
9381

9482
missing-optional-packages-tests:
9583
name: Tests without optional packages

0 commit comments

Comments
 (0)