Skip to content

Commit cd2c838

Browse files
committed
Improve the GitHub Actions workflow for the tests
1 parent 274c8b2 commit cd2c838

File tree

1 file changed

+41
-61
lines changed

1 file changed

+41
-61
lines changed

.github/workflows/tests.yaml

Lines changed: 41 additions & 61 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,95 +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-
dbal_constraint: [false]
27-
symfony_constraint: ['']
28-
experimental: [false]
29-
include:
30-
- description: 'DBAL 2'
31-
php: '7.4'
32-
dbal_constraint: '^2.13'
33-
- description: 'Symfony 5.0'
34-
php: '8.0'
35-
symfony_constraint: 5.0.*
36-
- description: 'Symfony 5.0'
37-
php: '7.4'
38-
symfony_constraint: 5.0.*
39-
- description: 'Symfony 4.4'
40-
php: '8.0'
41-
symfony_constraint: 4.4.*
42-
- description: 'Symfony 4.4'
43-
php: '7.4'
44-
symfony_constraint: 4.4.*
45-
- description: 'Symfony 3.4'
46-
php: '7.2'
47-
symfony_constraint: 3.4.*
48-
env:
49-
SYMFONY_DEPRECATIONS_HELPER: disabled
50-
- description: 'prefer lowest'
51-
php: '7.2'
52-
composer_option: '--prefer-lowest'
53-
symfony_constraint: ^3.4.44
54-
env:
55-
SYMFONY_DEPRECATIONS_HELPER: disabled
56-
57-
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+
5833
steps:
5934
- name: Checkout
6035
uses: actions/checkout@v2
6136
with:
6237
fetch-depth: 2
6338

64-
- name: Cache
65-
uses: actions/cache@v2
66-
with:
67-
path: ~/.composer/cache/files
68-
key: ${{ matrix.php }}-${{ matrix.symfony_constraint }}-${{ matrix.composer_option }}
69-
7039
- name: Setup PHP
7140
uses: shivammathur/setup-php@v2
7241
with:
7342
php-version: ${{ matrix.php }}
7443
coverage: xdebug
7544

76-
- name: Install Symfony Flex
77-
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-
7858

7959
- name: Remove Symfony Messenger
8060
run: composer remove --dev symfony/messenger --no-update
81-
if: matrix.symfony_constraint == '3.4.*' || matrix.composer_option == '--prefer-lowest'
61+
if: matrix.symfony-version == '3.4.*' || matrix.composer_option == '--prefer-lowest'
8262

83-
- run: composer require --dev doctrine/dbal ${{ matrix.dbal_constraint }} --no-update
84-
if: matrix.dbal_constraint
63+
- name: Install Symfony Flex
64+
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
8565

86-
- name: Install dependencies
87-
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' }}
8869

89-
- name: Install Sentry
90-
run: composer require sentry/sentry dev-develop
91-
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' }}
9273

93-
- name: Run PHPUnit tests
94-
run: vendor/bin/phpunit --coverage-clover=coverage.xml
74+
- name: Run tests
75+
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
9576

96-
- name: Run codecov
77+
- name: Upload code coverage
9778
uses: codecov/codecov-action@v1
9879
with:
99-
file: './coverage.xml'
100-
fail_ci_if_error: true
80+
file: build/coverage-report.xml
10181

10282
missing-optional-packages-tests:
10383
name: Tests without optional packages

0 commit comments

Comments
 (0)