Skip to content

Commit 8365611

Browse files
committed
Improve the GitHub Actions workflow for the tests
1 parent a64b24d commit 8365611

File tree

1 file changed

+42
-62
lines changed

1 file changed

+42
-62
lines changed

.github/workflows/tests.yaml

Lines changed: 42 additions & 62 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,96 +9,76 @@ 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.1'
22-
- '8.0'
23-
- '7.4'
24-
- '7.3'
2521
- '7.2'
26-
sentry_constraint: [false]
27-
dbal_constraint: [false]
28-
symfony_constraint: ['']
29-
experimental: [false]
30-
include:
31-
- description: 'DBAL 2'
32-
php: '7.4'
33-
dbal_constraint: '^2.13'
34-
- description: 'Symfony 5.0'
35-
php: '8.0'
36-
symfony_constraint: 5.0.*
37-
- description: 'Symfony 5.0'
38-
php: '7.4'
39-
symfony_constraint: 5.0.*
40-
- description: 'Symfony 4.4'
41-
php: '8.0'
42-
symfony_constraint: 4.4.*
43-
- description: 'Symfony 4.4'
44-
php: '7.4'
45-
symfony_constraint: 4.4.*
46-
- description: 'Symfony 3.4'
47-
php: '7.2'
48-
symfony_constraint: 3.4.*
49-
env:
50-
SYMFONY_DEPRECATIONS_HELPER: disabled
51-
- description: 'prefer lowest'
52-
php: '7.2'
53-
composer_option: '--prefer-lowest'
54-
symfony_constraint: ^3.4.44
55-
env:
56-
SYMFONY_DEPRECATIONS_HELPER: disabled
57-
58-
name: PHP ${{ matrix.php }} tests (${{ matrix.description }})
22+
- '7.3'
23+
- '7.4'
24+
- '8.0'
25+
- '8.1'
26+
symfony-version:
27+
- 3.4.*
28+
- 4.4.*
29+
- 5.2.*
30+
dependencies:
31+
- lowest
32+
- highest
33+
5934
steps:
6035
- name: Checkout
6136
uses: actions/checkout@v2
6237
with:
6338
fetch-depth: 2
6439

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

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

8060
- name: Remove Symfony Messenger
8161
run: composer remove --dev symfony/messenger --no-update
82-
if: matrix.symfony_constraint == '3.4.*' || matrix.composer_option == '--prefer-lowest'
62+
if: matrix.symfony-version == '3.4.*' || matrix.composer_option == '--prefer-lowest'
8363

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

87-
- name: Install dependencies
88-
run: composer update --no-progress --ansi ${{ matrix.composer_option }}
67+
- name: Install highest dependencies
68+
run: composer update --no-progress --no-interaction --prefer-dist
69+
if: ${{ matrix.dependencies == 'highest' }}
8970

90-
- name: Install Sentry
91-
run: composer require sentry/sentry dev-develop
92-
if: matrix.sentry_constraint == 'dev-develop'
71+
- name: Install lowest dependencies
72+
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
73+
if: ${{ matrix.dependencies == 'lowest' }}
9374

94-
- name: Run PHPUnit tests
95-
run: vendor/bin/phpunit --coverage-clover=coverage.xml
75+
- name: Run tests
76+
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
9677

97-
- name: Run codecov
78+
- name: Upload code coverage
9879
uses: codecov/codecov-action@v1
9980
with:
100-
file: './coverage.xml'
101-
fail_ci_if_error: true
81+
file: build/coverage-report.xml
10282

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

0 commit comments

Comments
 (0)