-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (96 loc) · 3.76 KB
/
main.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
# https://help.github.com/en/actions
name: stop-punaises CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
schedule:
- cron: '0 7 * * *'
jobs:
code-quality:
name: STOP-PUNAISES (PHP ${{ matrix.php-versions }})
# https://hub.docker.com/_/ubuntu/
runs-on: ubuntu-latest
services:
# https://docs.docker.com/samples/library/mysql/
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: stopunaises
MYSQL_DATABASE: stopunaises_db
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# https://hub.docker.com/_/elasticsearch/
strategy:
fail-fast: true
matrix:
php-versions: ['8.1']
steps:
# https://github.com/actions/checkout (official)
- name: Checkout
uses: actions/checkout@v2
# https://github.com/shivammathur/setup-php (community)
- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json, mbstring
env:
update: true
- name: Check PHP Version
run: php -v
- name: NPM install
uses: actions/setup-node@v2
with:
node-version: '18'
- run: npm install
- name: NPM build
run: npm run build
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
# https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
composer install --working-dir=tools/php-cs-fixer --no-progress --no-suggest --prefer-dist --optimize-autoloader
# https://github.com/symfonycorp/security-checker-action
- name: Security check installed dependencies
uses: symfonycorp/security-checker-action@v3
- name: Lint twig templates
run: php bin/console lint:twig templates/
# https://github.com/phpstan/phpstan
- name: Analyse PHP Code (PHPStan)
run: vendor/bin/phpstan analyse
# https://github.com/FriendsOfPHP/PHP-CS-Fixer
- name: Check PHP coding standard (PHP-CS-Fixer)
run: composer cs-check
- name: Load Doctrine fixtures
run: |
composer require --dev symfony/orm-pack
php bin/console --env=test doctrine:database:create --no-interaction
php bin/console --env=test doctrine:migrations:migrate --no-interaction
php bin/console --env=test doctrine:fixtures:load --no-interaction
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/stopunaises_db
- name: Run tests
run: |
composer require --dev dama/doctrine-test-bundle
./vendor/bin/phpunit --stop-on-failure --testdox -d memory_limit=-1
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/stopunaises_db
NOTIFICATIONS_EMAIL: [email protected]
APP_URL: http://localhost:8080