-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·153 lines (136 loc) · 5.98 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
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
# https://help.github.com/en/actions
name: Histologe CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
schedule:
- cron: '0 7 * * *'
env:
HISTOLOGE_URL: http://localhost:8080
jobs:
code-quality:
name: Histologe (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: histologe
MYSQL_DATABASE: histologe_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: Cache wkthtmltopdf
uses: actions/cache@v2
id: cache-wkhtmltopdf
with:
path: "~/wkhtmltox/"
key: ${{ runner.os }}-wkhtmltopdf-${{ hashFiles('**/*.deb') }}
- name: Download wkthtmltopdf & dependencies
if: steps.cache-wkhtmltopdf.outputs.cache-hit != 'true'
run: |
mkdir ~/wkhtmltox
wget -O ~/wkhtmltox/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
wget -O ~/wkhtmltox/xfonts-encodings.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-encodings/xfonts-encodings_1.0.4-2_all.deb
wget -O ~/wkhtmltox/xfonts-utils.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-utils/xfonts-utils_7.7+6_amd64.deb
wget -O ~/wkhtmltox/xfonts-75dpi.deb http://archive.ubuntu.com/ubuntu/pool/universe/x/xfonts-75dpi/xfonts-75dpi_1.0.4+nmu1_all.deb
wget -O ~/wkhtmltox/xfonts-base.deb http://archive.ubuntu.com/ubuntu/pool/main/x/xfonts-base/xfonts-base_1.0.4+nmu1_all.deb
- name: Install wkhtmltopdf
run: |
sudo dpkg -i ~/wkhtmltox/xfonts-encodings.deb
sudo dpkg -i ~/wkhtmltox/xfonts-utils.deb
sudo dpkg -i ~/wkhtmltox/xfonts-75dpi.deb
sudo dpkg -i ~/wkhtmltox/xfonts-base.deb
sudo dpkg -i ~/wkhtmltox/wkhtmltox.deb
- 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:
APP_SECRET: ${{ secrets.APP_SECRET }}
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/histologe_db
NOTIFICATIONS_EMAIL: [email protected]
CONTACT_EMAIL: [email protected]
HISTOLOGE_URL: http://localhost:8080
SERVER_NAME: localhost:8080
MAILER_DSN: ${{ secrets.MAILER_DSN_CI }}
MAIL_ENABLE: 1
- name: Run tests
run: |
composer require --dev dama/doctrine-test-bundle:7.3
./vendor/bin/phpunit --stop-on-failure --testdox -d memory_limit=-1
env:
APP_SECRET: ${{ secrets.APP_SECRET }}
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/histologe_db
ADMIN_EMAIL: [email protected]
NOTIFICATIONS_EMAIL: [email protected]
CONTACT_EMAIL: [email protected]
HISTOLOGE_URL: http://localhost:8080
SERVER_NAME: localhost:8080
MAILER_DSN: ${{ secrets.MAILER_DSN_CI }}
CRON_ENABLE: 1
MAIL_ENABLE: 1
FEATURE_ASK_VISITE_ENABLE: 1
MAINTENANCE_ENABLE: 0