Skip to content

Commit 5f11348

Browse files
committed
minor #192 Simplifying CI matrix (weaverryan)
This PR was squashed before being merged into the main branch. Discussion ---------- Simplifying CI matrix Hi! Goals: A) Test all php versions using "higest" deps B) Test lowest php version on "lowest" deps C) Test highest php version on "dev" deps This matrix, I hope, strikes a good balance between being reasonably small and covering the most important combinations. Cheers! Commits ------- 5713034 Simplifying CI matrix
2 parents fb5079e + 5713034 commit 5f11348

File tree

2 files changed

+50
-155
lines changed

2 files changed

+50
-155
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,195 +1,91 @@
11
name: Bundle CI
22
on:
33
push:
4+
branches: ['main']
45
pull_request:
56
schedule:
67
- cron: '0 */12 * * *'
78

89
jobs:
9-
composer-validate:
10-
name: Validate composer.json
10+
static-analysis:
11+
name: Static Analysis
1112
runs-on: ubuntu-18.04
1213

1314
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v2.0.0
15+
- name: "Checkout code"
16+
uses: "actions/checkout@v2"
1617

17-
- name: Validate
18-
run: composer validate --no-check-lock --strict
18+
- name: "Install PHP"
19+
uses: "shivammathur/setup-php@v2"
20+
with:
21+
coverage: "none"
22+
php-version: "8.0"
1923

20-
php-cs-fixer:
21-
name: Lint Bundle Source
22-
runs-on: ubuntu-18.04
24+
- name: "Validate composer.json"
25+
run: "composer validate --strict --no-check-lock"
2326

24-
steps:
25-
- name: Set PHP Version
26-
run: sudo update-alternatives --set php /usr/bin/php7.4
27-
- name: Checkout
28-
uses: actions/[email protected]
27+
- name: "Composer install"
28+
uses: "ramsey/composer-install@v1"
29+
with:
30+
composer-options: "--prefer-stable"
31+
dependency-versions: 'highest'
2932

3033
- name: Install PHP-CS-Fixer
3134
run: composer global require friendsofphp/php-cs-fixer --prefer-dist --no-progress
3235

33-
- name: Enforce coding standards
34-
run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config $GITHUB_WORKSPACE/.php-cs-fixer.dist.php --diff --dry-run
35-
36-
psalm:
37-
name: Psalm Static Analysis
38-
runs-on: ubuntu-18.04
39-
40-
steps:
41-
- name: Set PHP Version
42-
run: sudo update-alternatives --set php /usr/bin/php7.4
43-
44-
- name: Checkout
45-
uses: actions/[email protected]
46-
47-
- name: Install dependencies
48-
run: composer install --prefer-dist --no-progress
49-
50-
- name: Analyze Source
36+
- name: Running Pslam
5137
run: vendor/bin/psalm -c $GITHUB_WORKSPACE/psalm.xml
5238

53-
stable-tests:
54-
name: Symfony Stable
39+
- name: Running php-cs-fixer
40+
run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config $GITHUB_WORKSPACE/.php-cs-fixer.dist.php --diff --dry-run
41+
42+
tests:
43+
name: "Tests ${{ matrix.php-version }} ${{ matrix.dependency-versions }} deps ${{ matrix.dependency-versions }}"
5544
runs-on: ubuntu-18.04
5645

5746
strategy:
5847
fail-fast: false
5948
matrix:
60-
php-versions: ['7.2', '7.3', '7.4', '8.0']
61-
symfony-version: ['4.4.*', '5.2.*']
49+
# normal, highest, non-dev installs
50+
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']
51+
composer-options: ['--prefer-stable']
52+
dependency-versions: ['highest']
53+
include:
54+
# testing lowest PHP version with lowest dependencies
55+
- php-version: '7.2.5'
56+
dependency-versions: 'lowest'
57+
composer-options: '--prefer-lowest'
58+
59+
# testing dev versions with highest PHP
60+
- php-version: '8.0'
61+
dependency-versions: 'highest'
62+
composer-options: '' # allow dev deps
6263

6364
steps:
64-
- name: Set PHP Version
65-
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}
66-
67-
# - name: Disable Xdebug
68-
# run: sudo rm /etc/php/${{ matrix.php-versions }}/cli/conf.d/20-xdebug.ini
69-
70-
- name: Get PHP Version
71-
run: |
72-
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
73-
echo "::set-output name=version::$ver"
74-
id: php-ver
75-
76-
- name: Using PHP Version from matrix
77-
run: |
78-
echo "Runner is not using PHP Version defined in the php-versions matrix."
79-
php -v
80-
exit 1
81-
if: steps.php-ver.outputs.version != matrix.php-versions
65+
- name: "Checkout code"
66+
uses: "actions/checkout@v2"
8267

83-
- name: Checkout
84-
uses: actions/[email protected]
68+
- name: "Install PHP"
69+
uses: "shivammathur/setup-php@v2"
70+
with:
71+
coverage: "none"
72+
php-version: "${{ matrix.php-version }}"
8573

8674
- name: Install Global Dependencies
8775
run: |
8876
composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-main
8977
90-
- name: Install dependencies
91-
run: |
92-
composer config minimum-stability stable
93-
composer update --prefer-dist --no-progress
94-
env:
95-
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
96-
97-
- name: Unit Tests
98-
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
99-
if: always()
100-
101-
- name: Functional Tests
102-
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
103-
if: always()
104-
105-
- name: Integration Tests
106-
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
107-
if: always()
108-
109-
dev-main-tests:
110-
name: Symfony Main
111-
runs-on: ubuntu-18.04
112-
113-
strategy:
114-
fail-fast: false
115-
matrix:
116-
php-versions: ['7.2', '7.3', '7.4', '8.0']
117-
118-
steps:
119-
- name: Set PHP Version
120-
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}
121-
122-
- name: Get PHP Version
123-
run: |
124-
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
125-
echo "::set-output name=version::$ver"
126-
id: php-ver
127-
128-
- name: Using PHP Version from matrix
129-
run: |
130-
echo "Runner is not using PHP Version defined in the php-versions matrix."
131-
php -v
132-
exit 1
133-
if: steps.php-ver.outputs.version != matrix.php-versions
134-
135-
- name: Checkout
136-
uses: actions/[email protected]
137-
138-
- name: Install dependencies
139-
run: composer update --prefer-dist --no-progress
140-
141-
- name: Unit Tests
142-
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
143-
if: always()
144-
145-
- name: Functional Tests
146-
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
147-
if: always()
148-
149-
- name: Integration Tests
150-
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
151-
if: always()
152-
153-
lowest-version-tests:
154-
name: Lowest dependencies
155-
runs-on: ubuntu-18.04
156-
157-
strategy:
158-
fail-fast: false
159-
matrix:
160-
php-versions: ['7.2', '7.3', '7.4', '8.0']
161-
162-
steps:
163-
- name: Set PHP Version
164-
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}
165-
166-
- name: Get PHP Version
167-
run: |
168-
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
169-
echo "::set-output name=version::$ver"
170-
id: php-ver
171-
172-
- name: Using PHP Version from matrix
173-
run: |
174-
echo "Runner is not using PHP Version defined in the php-versions matrix."
175-
php -v
176-
exit 1
177-
if: steps.php-ver.outputs.version != matrix.php-versions
178-
179-
- name: Checkout
180-
uses: actions/[email protected]
181-
182-
- name: Install dependencies
183-
run: composer update --prefer-lowest --prefer-dist --no-progress
78+
- name: "Composer install"
79+
uses: "ramsey/composer-install@v1"
80+
with:
81+
dependency-versions: "${{ matrix.dependency-versions }}"
82+
composer-options: "--prefer-dist --no-progress"
18483

18584
- name: Unit Tests
18685
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
187-
if: always()
18886

18987
- name: Functional Tests
19088
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
191-
if: always()
19289

19390
- name: Integration Tests
19491
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
195-
if: always()

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
},
1414
"require-dev": {
1515
"doctrine/orm": "^2.7",
16-
"friendsofphp/php-cs-fixer": "^3.0",
1716
"symfony/framework-bundle": "^4.4 | ^5.0 | ^6.0",
18-
"symfony/phpunit-bridge": "^5.0",
17+
"symfony/phpunit-bridge": "^5.0 | ^6.0",
1918
"vimeo/psalm": "^4.3",
2019
"doctrine/doctrine-bundle": "^2.0.3"
2120
},

0 commit comments

Comments
 (0)