Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 398589a

Browse files
authored
Simplify CI file (async-aws#930)
* Simplify CI file * Always download flex
1 parent 16a7429 commit 398589a

1 file changed

Lines changed: 21 additions & 128 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,25 @@ on:
99
jobs:
1010

1111
build:
12-
name: Build
12+
name: Components tests
1313
runs-on: Ubuntu-20.04
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
php: ['7.2', '7.3', '7.4', '8.0']
18+
strategy: ['default']
19+
include:
20+
# Minimum supported dependencies with the oldest PHP version
21+
- php: '7.2'
22+
strategy: 'lowest'
1823

1924
steps:
2025
- name: Set up PHP
2126
uses: shivammathur/[email protected]
2227
with:
2328
php-version: ${{ matrix.php }}
2429
coverage: none
30+
tools: flex
2531

2632
- name: Checkout code
2733
uses: actions/checkout@v2
@@ -53,7 +59,8 @@ jobs:
5359
./vendor/bin/simple-phpunit install
5460
echo ::endgroup::
5561
56-
- name: Modify composer.json
62+
- name: Modify composer.json - default
63+
if: matrix.strategy != 'lowest'
5764
run: |
5865
CURRENT_DIR=$(pwd)
5966
for COMPONENT in $(find src/Service -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
@@ -73,7 +80,7 @@ jobs:
7380
cd "$CURRENT_DIR"
7481
for COMPONENT in $(find src/Integration -maxdepth 3 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
7582
do
76-
echo ::group::mi$COMPONENT
83+
echo ::group::$COMPONENT
7784
echo "$CURRENT_DIR/$COMPONENT"
7885
cd "$CURRENT_DIR/$COMPONENT"
7986
@@ -83,89 +90,8 @@ jobs:
8390
echo ::endgroup::
8491
done
8592
86-
- name: Download dependencies
87-
env:
88-
PHP_VERSION: ${{ matrix.php }}
89-
run: |
90-
CURRENT_DIR=$(pwd)
91-
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
92-
do
93-
echo ::group::$COMPONENT
94-
echo "$CURRENT_DIR/$COMPONENT"
95-
cd "$CURRENT_DIR/$COMPONENT"
96-
97-
localExit=0
98-
if [ $PHP_VERSION = '8.0' ]; then
99-
COMPOSER_OPTIONS=' --ignore-platform-req=php'
100-
fi
101-
composer update --no-interaction --prefer-dist --optimize-autoloader $COMPOSER_OPTIONS || localExit=1
102-
echo ::endgroup::
103-
if [ $localExit -ne 0 ]; then
104-
echo "::error::$COMPONENT error"
105-
exit $localExit
106-
fi
107-
done
108-
109-
- name: Run tests
110-
run: |
111-
ok=0
112-
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
113-
do
114-
echo ::group::$COMPONENT
115-
localExit=0
116-
./vendor/bin/simple-phpunit -c ./$COMPONENT 2>&1 || localExit=1
117-
ok=$(( $localExit || $ok ))
118-
echo ::endgroup::
119-
if [ $localExit -ne 0 ]; then
120-
echo "::error::$COMPONENT failed"
121-
fi
122-
done
123-
124-
exit $ok
125-
126-
lowest:
127-
name: Lowest dependencies
128-
runs-on: Ubuntu-20.04
129-
130-
steps:
131-
- name: Set up PHP
132-
uses: shivammathur/[email protected]
133-
with:
134-
php-version: 7.3
135-
coverage: none
136-
tools: flex
137-
138-
- name: Checkout code
139-
uses: actions/checkout@v2
140-
141-
- name: Initialize tests
142-
run: make initialize -j 4
143-
144-
- name: Get composer cache directory
145-
id: composer-cache
146-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
147-
148-
- name: Cache Composer
149-
uses: actions/cache@v2
150-
with:
151-
path: ${{ steps.composer-cache.outputs.dir }}
152-
key: composer-${{ github.sha }}
153-
restore-keys: composer-
154-
155-
- name: Download phpunit
156-
run: |
157-
rm composer.*
158-
composer init --no-interaction --name "async-aws/aws"
159-
160-
echo ::group::Download
161-
composer require symfony/phpunit-bridge
162-
echo ::endgroup::
163-
164-
echo ::group::Install
165-
./vendor/bin/simple-phpunit install
166-
echo ::endgroup::
167-
168-
- name: Modify composer.json
93+
- name: Modify composer.json - lowest
94+
if: matrix.strategy == 'lowest'
16995
run: |
17096
CURRENT_DIR=$(pwd)
17197
for COMPONENT in $(find src/Service -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
@@ -195,9 +121,9 @@ jobs:
195121
196122
- name: Download dependencies
197123
env:
198-
# Make sure we dont download awfully old Symfony versions.
199-
SYMFONY_REQUIRE: 4.4.*
200124
PHP_VERSION: ${{ matrix.php }}
125+
# Make sure we dont download awfully old Symfony versions.
126+
SYMFONY_REQUIRE: '>=4.4'
201127
run: |
202128
CURRENT_DIR=$(pwd)
203129
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
@@ -210,7 +136,7 @@ jobs:
210136
if [ $PHP_VERSION = '8.0' ]; then
211137
COMPOSER_OPTIONS=' --ignore-platform-req=php'
212138
fi
213-
composer update --no-interaction --prefer-dist --optimize-autoloader $COMPOSER_OPTIONS --prefer-lowest || localExit=1
139+
composer update --no-interaction --no-scripts --prefer-dist --optimize-autoloader ${{ matrix.strategy == 'lowest' && '--prefer-lowest' || '' }} $COMPOSER_OPTIONS || localExit=1
214140
echo ::endgroup::
215141
if [ $localExit -ne 0 ]; then
216142
echo "::error::$COMPONENT error"
@@ -220,7 +146,7 @@ jobs:
220146
221147
- name: Run tests
222148
env:
223-
SYMFONY_DEPRECATIONS_HELPER: 9999
149+
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.strategy == 'lowest' && '9999' || '' }}
224150
run: |
225151
ok=0
226152
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
@@ -240,6 +166,10 @@ jobs:
240166
root:
241167
name: Root tests
242168
runs-on: Ubuntu-20.04
169+
strategy:
170+
fail-fast: false
171+
matrix:
172+
minimum_stability: [dev, stable]
243173
steps:
244174
- name: Set up PHP
245175
uses: shivammathur/[email protected]
@@ -266,6 +196,7 @@ jobs:
266196

267197
- name: Download dependencies
268198
run: |
199+
composer config minimum-stability ${{ matrix.minimum_stability }}
269200
composer update --no-interaction --prefer-dist --optimize-autoloader
270201
271202
- name: Run tests
@@ -275,41 +206,3 @@ jobs:
275206
echo ::endgroup::
276207
./vendor/bin/simple-phpunit
277208
278-
dev:
279-
name: dev-master
280-
runs-on: Ubuntu-20.04
281-
steps:
282-
- name: Set up PHP
283-
uses: shivammathur/[email protected]
284-
with:
285-
php-version: 7.4
286-
coverage: none
287-
288-
- name: Checkout code
289-
uses: actions/checkout@v2
290-
291-
- name: Initialize tests
292-
run: make initialize -j 4
293-
294-
- name: Get composer cache directory
295-
id: composer-cache
296-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
297-
298-
- name: Cache Composer
299-
uses: actions/cache@v2
300-
with:
301-
path: ${{ steps.composer-cache.outputs.dir }}
302-
key: composer-${{ github.sha }}
303-
restore-keys: composer-
304-
305-
- name: Download dependencies
306-
run: |
307-
composer config minimum-stability dev
308-
composer update --no-interaction --optimize-autoloader
309-
310-
- name: Run tests
311-
run: |
312-
echo ::group::Install
313-
./vendor/bin/simple-phpunit install
314-
echo ::endgroup::
315-
./vendor/bin/simple-phpunit

0 commit comments

Comments
 (0)