-
-
Notifications
You must be signed in to change notification settings - Fork 131
174 lines (150 loc) · 5.54 KB
/
ci.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on:
pull_request: ~
push:
branches:
- master
jobs:
build:
name: Components tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
strategy: ['default']
include:
# Minimum supported dependencies with the oldest PHP version
- php: '7.2'
strategy: 'lowest'
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex
- name: Checkout code
uses: actions/checkout@v3
- name: Initialize tests
run: make initialize -j 4
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer
uses: actions/cache@v3
if: steps.composer-cache.outputs.dir
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ github.sha }}
restore-keys: composer-
- name: Modify composer.json - default
run: |
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src/Service -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
sed -i -re 's/"require": \{/"repositories": [{"type": "path","url": "..\/..\/Core", "options": {"versions": {"async-aws\/core": "dev-master"}}, "canonical": ${{matrix.strategy != 'lowest' && 'true' || 'false'}} }],"require": \{/' composer.json
composer config minimum-stability dev
composer config prefer-stable true
composer require --dev --no-update symfony/phpunit-bridge
cat composer.json
echo ::endgroup::
done
cd "$CURRENT_DIR"
for COMPONENT in $(find src/Integration -maxdepth 3 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
sed -i -re 's/"require": \{/"conflict": \{"phpunit\/phpunit": ">=10.0"\},"require": \{/' composer.json
composer config minimum-stability dev
composer config prefer-stable true
cat composer.json
echo ::endgroup::
done
- name: Download dependencies
env:
PHP_VERSION: ${{ matrix.php }}
# Make sure we don't download awfully old Symfony versions.
SYMFONY_REQUIRE: '>=4.4'
run: |
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
localExit=0
composer require symfony/phpunit-bridge --no-update --no-install
composer update --no-interaction --no-scripts --prefer-dist --optimize-autoloader ${{ matrix.strategy == 'lowest' && '--prefer-lowest' || '' }} $COMPOSER_OPTIONS || localExit=1
./vendor/bin/simple-phpunit install
echo ::endgroup::
if [ $localExit -ne 0 ]; then
echo "::error::$COMPONENT error"
exit $localExit
fi
done
- name: Run tests
env:
OVERRIDE_SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.strategy == 'lowest' && 'max[self]=9999' || '' }}
run: |
ok=0
if [ -n "$OVERRIDE_SYMFONY_DEPRECATIONS_HELPER" ]; then
export SYMFONY_DEPRECATIONS_HELPER=$OVERRIDE_SYMFONY_DEPRECATIONS_HELPER
fi
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
localExit=0
cd "$CURRENT_DIR/$COMPONENT"
./vendor/bin/simple-phpunit 2>&1 || localExit=1
ok=$(( $localExit || $ok ))
echo ::endgroup::
if [ $localExit -ne 0 ]; then
echo "::error::$COMPONENT failed"
fi
done
exit $ok
root:
name: Root tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
minimum_stability: [dev, stable]
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Initialize tests
run: make initialize -j 4
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ github.sha }}
restore-keys: composer-
- name: Download dependencies
run: |
composer config minimum-stability ${{ matrix.minimum_stability }}
composer require --dev --no-update "phpunit/phpunit=9.6.*"
composer update --no-interaction --prefer-dist --optimize-autoloader
- name: Run tests
run: |
echo ::group::Install
./vendor/bin/simple-phpunit install
echo ::endgroup::
./vendor/bin/simple-phpunit