-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (114 loc) · 6.36 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: "Build"
on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
branches:
- '**'
jobs:
run-standards-with-tests:
name: Check code meets standards and tests pass (by localhost config)
runs-on: ubuntu-latest
env:
PHP_VERSION: '7.2'
steps:
- uses: actions/checkout@v2
- name: Setup PHP ${{ env.PHP_VERSION }} and composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none # disable xdebug, pcov
tools: composer:v2
- name: Set composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: job-standards-with-tests-${{ env.PHP_VERSION }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: job-standards-with-tests-${{ env.PHP_VERSION }}-composer-
- name: Install dependencies
run: composer install
- name: Run standarts and tests
run: vendor/bin/phing build-ci
run-only-tests:
name: Run only tests on PHP ${{ matrix.php }} on ${{ matrix.os }} with ${{ matrix.deps-level }} ${{ matrix.symfony }} dependency level
runs-on: ${{ matrix.os }}
env:
COMPOSER_ALL_DEV_DEPENDENCIES_WITHOUT_PHPUNIT: phing/phing php-parallel-lint/php-parallel-lint phpstan/phpstan phpstan/phpstan-phpunit shopsys/coding-standards symfony/var-dumper
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
deps-level: [ 'lowest', 'highest' ]
symfony: [ '^4.2.0', '^5.0', '^6.0', '^7.0' ]
exclude:
# symfony/console fails on "YamlStandards\Command\YamlCommandTest::testCorrectRunCommandForFix -> Trying to access array offset on value of type int" and I think it's not necessary fix it, so I skip it
- php: '7.4'
deps-level: 'lowest'
# symfony/config fails on "vendor/symfony/config/Definition/BaseNode.php:502 -> strpos(): Non-string needles will be interpreted as strings in the future.
# Use an explicit chr() call to preserve the current behavior" but PHP 7.3 for MacOS was already skipped with Travis CI
- php: '7.3'
os: 'macos-latest'
# don't run check symfony versions without supported php
- php: '7.2'
symfony: '^6.0'
- php: '7.3'
symfony: '^6.0'
- php: '7.4'
symfony: '^6.0'
- php: '7.2'
symfony: '^7.0'
- php: '7.3'
symfony: '^7.0'
- php: '7.4'
symfony: '^7.0'
- php: '8.0'
symfony: '^7.0'
- php: '8.1'
symfony: '^7.0'
steps:
- name: Configure git to avoid issues with line endings
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php }} and composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none # disable xdebug, pcov
tools: composer:v2
- name: Require Symfony at version ${{ matrix.symfony }}
run: composer require --no-update "symfony/console:${{ matrix.symfony }}" "symfony/config:${{ matrix.symfony }}" "symfony/yaml:${{ matrix.symfony }}"
- name: Add caret to composer.json for symfony libraries for windows build
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
$symfonyVersionWithoutCaret = "${{ matrix.symfony }}".substring(1)
(Get-Content composer.json) | ForEach-Object { $_.replace('"symfony/console": "' + $symfonyVersionWithoutCaret + '"', '"symfony/console": "${{ matrix.symfony }}"') } | Set-Content composer.json
(Get-Content composer.json) | ForEach-Object { $_.replace('"symfony/config": "' + $symfonyVersionWithoutCaret + '"', '"symfony/config": "${{ matrix.symfony }}"') } | Set-Content composer.json
(Get-Content composer.json) | ForEach-Object { $_.replace('"symfony/yaml": "' + $symfonyVersionWithoutCaret + '"', '"symfony/yaml": "${{ matrix.symfony }}"') } | Set-Content composer.json
- name: Set composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: job-only-tests-${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps-level }}-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: job-only-tests-${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps-level }}-${{ matrix.symfony }}-composer-
# composer check with "--no-dev" option require-dev dependency too
- name: Remove all dev-dependencies except for phpunit
run: composer remove --no-update --dev ${{ env.COMPOSER_ALL_DEV_DEPENDENCIES_WITHOUT_PHPUNIT }}
- name: Install lowest dependencies
if: ${{ matrix.deps-level == 'lowest' }}
run: composer update --prefer-lowest
- name: Install highest dependencies
if: ${{ matrix.deps-level == 'highest' }}
run: composer update
- name: Run tests
run: vendor/bin/phpunit --colors=always --testsuite Unit