Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit b8a5e12

Browse files
authored
Merge pull request #2 from em411/feature/github-actions
Add github actions
2 parents 0e77439 + 7bbc26b commit b8a5e12

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed

.github/workflows/build.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
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-18.04
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.0", "7.4"]
25+
symfony: ["^4.4", "^5.2"]
26+
sylius: ["~1.9.0", "~1.10.0"]
27+
node: ["10.x"]
28+
mysql: ["8.0"]
29+
30+
exclude:
31+
- sylius: ~1.9.0
32+
php: 8.0
33+
34+
- sylius: ~1.10.0
35+
symfony: 4.4
36+
37+
env:
38+
APP_ENV: test
39+
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
40+
41+
steps:
42+
-
43+
uses: actions/checkout@v2
44+
45+
-
46+
name: Setup PHP
47+
uses: shivammathur/setup-php@v2
48+
with:
49+
php-version: "${{ matrix.php }}"
50+
extensions: intl
51+
tools: symfony
52+
coverage: none
53+
54+
-
55+
name: Setup Node
56+
uses: actions/setup-node@v1
57+
with:
58+
node-version: "${{ matrix.node }}"
59+
60+
-
61+
name: Shutdown default MySQL
62+
run: sudo service mysql stop
63+
64+
-
65+
name: Setup MySQL
66+
uses: mirromutth/[email protected]
67+
with:
68+
mysql version: "${{ matrix.mysql }}"
69+
mysql root password: "root"
70+
71+
-
72+
name: Output PHP version for Symfony CLI
73+
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version
74+
75+
-
76+
name: Install certificates
77+
run: symfony server:ca:install
78+
79+
-
80+
name: Run Chrome Headless
81+
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 &
82+
83+
-
84+
name: Run webserver
85+
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)
86+
87+
-
88+
name: Get Composer cache directory
89+
id: composer-cache
90+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
91+
92+
-
93+
name: Cache Composer
94+
uses: actions/cache@v2
95+
with:
96+
path: ${{ steps.composer-cache.outputs.dir }}
97+
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
98+
restore-keys: |
99+
${{ runner.os }}-php-${{ matrix.php }}-composer-
100+
101+
-
102+
name: Restrict Symfony version
103+
if: matrix.symfony != ''
104+
run: |
105+
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
106+
composer config extra.symfony.require "${{ matrix.symfony }}"
107+
108+
-
109+
name: Restrict Sylius version
110+
if: matrix.sylius != ''
111+
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
112+
113+
-
114+
name: Install PHP dependencies
115+
run: composer install --no-interaction --no-scripts
116+
117+
-
118+
name: Get Yarn cache directory
119+
id: yarn-cache
120+
run: echo "::set-output name=dir::$(yarn cache dir)"
121+
122+
-
123+
name: Cache Yarn
124+
uses: actions/cache@v2
125+
with:
126+
path: ${{ steps.yarn-cache.outputs.dir }}
127+
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
128+
restore-keys: |
129+
${{ runner.os }}-node-${{ matrix.node }}-yarn-
130+
131+
-
132+
name: Install JS dependencies
133+
run: (cd tests/Application && yarn install)
134+
135+
-
136+
name: Prepare test application database
137+
run: |
138+
(cd tests/Application && bin/console doctrine:database:create -vvv)
139+
(cd tests/Application && bin/console doctrine:schema:create -vvv)
140+
141+
-
142+
name: Prepare test application assets
143+
run: |
144+
(cd tests/Application && bin/console assets:install public -vvv)
145+
(cd tests/Application && yarn build)
146+
147+
-
148+
name: Prepare test application cache
149+
run: (cd tests/Application && bin/console cache:warmup -vvv)
150+
151+
-
152+
name: Load fixtures in test application
153+
run: (cd tests/Application && bin/console sylius:fixtures:load -n)
154+
155+
-
156+
name: Validate composer.json
157+
run: composer validate --ansi --strict
158+
159+
-
160+
name: Validate database schema
161+
run: (cd tests/Application && bin/console doctrine:schema:validate)
162+
163+
-
164+
name: Run PHPSpec
165+
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
166+
167+
-
168+
name: Run Behat
169+
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
170+
171+
-
172+
name: Upload Behat logs
173+
uses: actions/upload-artifact@v2
174+
if: failure()
175+
with:
176+
name: Behat logs
177+
path: etc/build/
178+
if-no-files-found: ignore

0 commit comments

Comments
 (0)