Skip to content

Commit cc9b4bc

Browse files
committed
Split CI builds to run faster
1 parent 1fa08dc commit cc9b4bc

File tree

4 files changed

+423
-201
lines changed

4 files changed

+423
-201
lines changed

.github/workflows/build.yml

+23-201
Original file line numberDiff line numberDiff line change
@@ -1,211 +1,33 @@
11
name: Build
22

33
on:
4-
push:
5-
branches-ignore:
6-
- "dependabot/**"
7-
paths-ignore:
8-
- "*.md"
94
pull_request:
105
paths-ignore:
6+
- "adr/**"
7+
- "docs/**"
118
- "*.md"
12-
release:
13-
types: [created]
14-
schedule:
15-
-
16-
cron: "0 1 * * 6" # Run at 1am every Saturday
179
workflow_dispatch: ~
10+
push:
11+
branches-ignore:
12+
- 'dependabot/**'
13+
- 'upmerge/**'
1814

19-
jobs:
20-
tests:
21-
runs-on: ubuntu-latest
22-
23-
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Node ${{ matrix.node }}"
24-
25-
timeout-minutes: 90
26-
27-
strategy:
28-
fail-fast: false
29-
matrix:
30-
php: ["8.3"]
31-
symfony: ["^6.4", "^7.1"]
32-
node: ["20.x"]
33-
mysql: ["8.4"]
34-
35-
env:
36-
APP_ENV: test_cached
37-
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
38-
39-
steps:
40-
-
41-
uses: actions/checkout@v4
42-
43-
-
44-
name: Setup PHP
45-
uses: shivammathur/setup-php@v2
46-
with:
47-
php-version: "${{ matrix.php }}"
48-
extensions: intl, mbstring
49-
tools: symfony
50-
coverage: none
51-
52-
-
53-
name: Restrict Symfony version
54-
if: matrix.symfony != ''
55-
run: |
56-
composer global config --no-plugins allow-plugins.symfony/flex true
57-
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
58-
composer config extra.symfony.require "${{ matrix.symfony }}"
59-
60-
-
61-
name: Setup Node
62-
uses: actions/setup-node@v4
63-
with:
64-
node-version: "${{ matrix.node }}"
65-
66-
-
67-
name: Shutdown default MySQL
68-
run: sudo service mysql stop
69-
70-
-
71-
name: Setup MySQL
72-
uses: mirromutth/[email protected]
73-
with:
74-
mysql version: "${{ matrix.mysql }}"
75-
mysql root password: "root"
76-
77-
-
78-
name: Output PHP version for Symfony CLI
79-
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version
80-
81-
-
82-
name: Install certificates
83-
run: symfony server:ca:install
84-
85-
-
86-
name: Run Chrome Headless
87-
run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &
88-
89-
-
90-
name: Run webserver
91-
run: symfony server:start --port=8080 --dir=public --daemon
92-
93-
-
94-
name: Restrict Symfony version
95-
if: matrix.symfony != ''
96-
run: composer config extra.symfony.require "${{ matrix.symfony }}"
97-
98-
-
99-
name: Get Composer cache directory
100-
id: composer-cache
101-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
102-
103-
-
104-
name: Cache Composer
105-
uses: actions/cache@v4
106-
with:
107-
path: ${{ steps.composer-cache.outputs.dir }}
108-
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
109-
restore-keys: |
110-
${{ runner.os }}-php-${{ matrix.php }}-composer-
111-
112-
-
113-
name: Install PHP dependencies
114-
run: composer install --no-interaction
115-
116-
-
117-
name: Get Yarn cache directory
118-
id: yarn-cache
119-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
120-
121-
-
122-
name: Cache Yarn
123-
uses: actions/cache@v4
124-
with:
125-
path: ${{ steps.yarn-cache.outputs.dir }}
126-
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
127-
restore-keys: |
128-
${{ runner.os }}-node-${{ matrix.node }}-yarn-
129-
130-
-
131-
name: Install JS dependencies
132-
run: yarn install
133-
134-
-
135-
name: Prepare test application database
136-
run: |
137-
APP_DEBUG=1 bin/console doctrine:database:create -vvv
138-
bin/console doctrine:migrations:migrate -n -vvv
139-
140-
-
141-
name: Prepare test application assets
142-
run: |
143-
bin/console assets:install public -vvv
144-
yarn encore production
145-
146-
-
147-
name: Prepare test application cache
148-
run: bin/console cache:warmup -vvv
149-
150-
-
151-
name: Prepare Messenger transport (Doctrine)
152-
run: bin/console messenger:setup-transports -vvv
153-
154-
-
155-
name: Load fixtures
156-
run: bin/console sylius:fixtures:load -n
157-
158-
-
159-
name: Validate composer.json
160-
run: composer validate --ansi --strict --no-check-all
161-
# Restore before Sylius 2.0 release
162-
# run: composer validate --ansi --strict --no-check-publish
163-
164-
-
165-
name: Run security check
166-
run: symfony security:check
167-
168-
-
169-
name: Check coding standard
170-
run: vendor/bin/ecs check src
171-
172-
-
173-
name: Run PHPStan
174-
run: vendor/bin/phpstan analyse -c phpstan.dist.neon -l max src/
175-
176-
-
177-
name: Validate database schema
178-
run: bin/console doctrine:schema:validate
179-
180-
-
181-
name: Run PHPUnit
182-
run: vendor/bin/phpunit --colors=always
183-
184-
-
185-
name: Install Behat driver
186-
run: vendor/bin/bdi detect drivers
187-
188-
-
189-
name: Run non-UI Behat
190-
run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" --rerun
191-
192-
-
193-
name: Run non-JS Behat
194-
run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun
195-
196-
-
197-
name: Run Behat (Chromedriver)
198-
run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun
15+
concurrency:
16+
group: ci-${{ github.workflow }}-${{ github.ref }}-minimal
17+
cancel-in-progress: true
19918

200-
-
201-
name: Run Behat (Panther)
202-
run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@ui" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@ui" --rerun
19+
permissions:
20+
contents: read
20321

204-
-
205-
name: Upload Behat logs
206-
uses: actions/upload-artifact@v4
207-
if: failure()
208-
with:
209-
name: "Behat logs (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }})"
210-
path: etc/build/
211-
if-no-files-found: ignore
22+
jobs:
23+
static-checks:
24+
name: Static checks
25+
uses: ./.github/workflows/ci_static-checks.yaml
26+
with:
27+
type: minimal
28+
e2e-mysql:
29+
name: End-to-end tests (MySQL)
30+
needs: static-checks
31+
uses: ./.github/workflows/ci_e2e-mysql.yaml
32+
with:
33+
type: minimal

0 commit comments

Comments
 (0)