Skip to content

Commit a7929e7

Browse files
committed
Add github action
1 parent a9198cd commit a7929e7

File tree

3 files changed

+211
-0
lines changed

3 files changed

+211
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Sylius/core-team

.github/dependabot.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "10:00"
8+
open-pull-requests-limit: 10
9+
ignore:
10+
- dependency-name: vimeo/psalm
11+
versions:
12+
- 4.5.0
13+
- 4.5.1
14+
- 4.5.2
15+
- 4.6.0
16+
- 4.6.1
17+
- 4.6.2
18+
- 4.6.3
19+
- 4.7.0
20+
- 4.7.1
21+
- dependency-name: phpstan/phpstan
22+
versions:
23+
- 0.12.70
24+
- 0.12.71
25+
- 0.12.73
26+
- 0.12.75
27+
- 0.12.76
28+
- 0.12.77
29+
- 0.12.78
30+
- 0.12.80
31+
- 0.12.81
32+
- 0.12.83
33+
- 0.12.84
34+
- dependency-name: sylius-labs/coding-standard
35+
versions:
36+
- 4.0.2
37+
- dependency-name: phpstan/phpstan-doctrine
38+
versions:
39+
- 0.12.32
40+
- dependency-name: phpstan/phpstan-webmozart-assert
41+
versions:
42+
- 0.12.10
43+
- 0.12.11

.github/workflows/build.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'dependabot/**'
7+
pull_request: ~
8+
release:
9+
types: [created]
10+
schedule:
11+
-
12+
cron: "0 1 * * 6" # Run at 1am every Saturday
13+
workflow_dispatch: ~
14+
15+
jobs:
16+
tests:
17+
runs-on: ubuntu-latest
18+
19+
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
php: ["8.3"]
25+
symfony: ["^7.3"]
26+
sylius: ["^2.1"]
27+
node: ["22.x"]
28+
mysql: ["8.4"]
29+
30+
env:
31+
APP_ENV: test
32+
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
33+
34+
steps:
35+
-
36+
uses: actions/checkout@v4
37+
38+
-
39+
name: Setup PHP
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: "${{ matrix.php }}"
43+
extensions: intl
44+
tools: flex,symfony
45+
coverage: none
46+
47+
-
48+
name: Setup Node
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: "${{ matrix.node }}"
52+
53+
-
54+
name: Shutdown default MySQL
55+
run: sudo service mysql stop
56+
57+
-
58+
name: Setup MySQL
59+
uses: mirromutth/mysql-action@v1.1
60+
with:
61+
mysql version: "${{ matrix.mysql }}"
62+
mysql root password: "root"
63+
64+
-
65+
name: Output PHP version for Symfony CLI
66+
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version
67+
68+
-
69+
name: Install certificates
70+
run: symfony server:ca:install
71+
72+
-
73+
name: Get Composer cache directory
74+
id: composer-cache
75+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
76+
77+
-
78+
name: Cache Composer
79+
uses: actions/cache@v4
80+
with:
81+
path: ${{ steps.composer-cache.outputs.dir }}
82+
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
83+
restore-keys: |
84+
${{ runner.os }}-php-${{ matrix.php }}-composer-
85+
86+
-
87+
name: Configure global composer
88+
run: |
89+
composer global config --no-plugins allow-plugins.symfony/flex true
90+
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.2.2"
91+
92+
-
93+
name: Restrict Symfony version
94+
if: matrix.symfony != ''
95+
run: |
96+
composer config extra.symfony.require "${{ matrix.symfony }}"
97+
98+
-
99+
name: Restrict Sylius version
100+
if: matrix.sylius != ''
101+
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
102+
103+
-
104+
name: Install PHP dependencies
105+
run: composer install --no-interaction
106+
107+
-
108+
name: Validate composer.json
109+
run: composer validate --ansi --strict
110+
111+
-
112+
name: Run PHPStan
113+
run: vendor/bin/phpstan analyse
114+
115+
-
116+
name: Run ECS
117+
run: vendor/bin/ecs check
118+
119+
-
120+
name: Run unit tests
121+
run: vendor/bin/phpunit --colors=always
122+
123+
-
124+
name: Validate container
125+
run: vendor/bin/console lint:container
126+
127+
-
128+
name: Get Yarn cache directory
129+
id: yarn-cache
130+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
131+
132+
-
133+
name: Cache Yarn
134+
uses: actions/cache@v4
135+
with:
136+
path: ${{ steps.yarn-cache.outputs.dir }}
137+
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
138+
restore-keys: |
139+
${{ runner.os }}-node-${{ matrix.node }}-yarn-
140+
141+
-
142+
name: Install JS dependencies
143+
run: (cd vendor/sylius/test-application && yarn install)
144+
145+
-
146+
name: Prepare test application database
147+
run: |
148+
vendor/bin/console doctrine:database:create -vvv
149+
vendor/bin/console doctrine:migrations:migrate -n -vvv -q
150+
151+
-
152+
name: Validate database schema
153+
run: vendor/bin/console doctrine:schema:validate
154+
155+
-
156+
name: Prepare test application assets
157+
run: |
158+
vendor/bin/console assets:install -vvv
159+
(cd vendor/sylius/test-application && yarn build)
160+
161+
-
162+
name: Prepare test application cache
163+
run: vendor/bin/console cache:warmup -vvv
164+
165+
-
166+
name: Load fixtures in test application
167+
run: vendor/bin/console sylius:fixtures:load -n

0 commit comments

Comments
 (0)