-
-
Notifications
You must be signed in to change notification settings - Fork 152
162 lines (138 loc) · 4.95 KB
/
ci.yml
File metadata and controls
162 lines (138 loc) · 4.95 KB
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
name: CI
on:
pull_request: ~
push:
branches:
- master
jobs:
build:
name: Components tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5']
strategy: ['default']
include:
# Minimum supported dependencies with the oldest PHP version
- php: '8.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@v5
- 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@v4
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' | grep -v '.template' | 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
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' | grep -v '.template' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
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' | grep -v '.template' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
localExit=0
composer update --no-interaction --no-scripts --prefer-dist --optimize-autoloader ${{ matrix.strategy == 'lowest' && '--prefer-lowest' || '' }} $COMPOSER_OPTIONS || localExit=1
echo ::endgroup::
if [ $localExit -ne 0 ]; then
echo "::error::$COMPONENT error"
exit $localExit
fi
done
- name: Run tests
env:
PHPUNIT_FLAGS: ${{ matrix.strategy == 'lowest' && '--do-not-fail-on-deprecation' || '' }}
run: |
ok=0
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | grep -v '.template' | sort)
do
echo ::group::$COMPONENT
localExit=0
cd "$CURRENT_DIR/$COMPONENT"
./vendor/bin/phpunit $PHPUNIT_FLAGS 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.4
coverage: none
- name: Checkout code
uses: actions/checkout@v5
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@v4
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 update --no-interaction --prefer-dist --optimize-autoloader
- name: Run tests
run: ./vendor/bin/phpunit