-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (121 loc) · 4.04 KB
/
ci.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
name: Continuous Integration
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
env:
NODE_VERSION: 18
PHP_VERSION: 8.2
jobs:
validate:
name: 'Build & validate'
runs-on: 'ubuntu-22.04'
services:
postgres:
image: postgres:14.10-bookworm
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
rabbitmq:
image: rabbitmq:3
ports:
- 5672:5672
options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
registry-url: 'https://npm.pkg.github.com'
- name: Install npm dependencies
run: |
echo "//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.REPO_READ_ONLY_TOKEN }}
- name: 'Linting: javascript'
if: always()
run: |
npm run jslint
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace@g' reports/eslint.json
- name: 'Linting: Markdown'
uses: DavidAnson/markdownlint-cli2-action@v16
if: always()
with:
globs: |
**/*.md
!node_modules
!vendor
- name: 'Linting: REUSE'
uses: fsfe/reuse-action@v3
if: always()
- name: 'Unit tests: front-end'
if: always()
run: npm test
- name: Install PHP
uses: shivammathur/setup-php@master
if: always()
with:
php-version: ${{ env.PHP_VERSION }}
extensions: zip, pgsql, pcov
- name: 'Composer install'
if: always()
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.REPO_READ_ONLY_TOKEN }}"}}'
run: composer install --no-interaction --no-scripts --no-progress --prefer-dist --no-ansi
- name: Build npm
if: always()
run: npm run build
- name: 'Linting: PHP CodeSniffer'
if: always()
run: vendor/bin/phpcs
- name: 'Linting: PHP CS Fixer'
if: always()
run: vendor/bin/php-cs-fixer fix --dry-run --diff --verbose
- name: 'Linting: PHPmd'
if: always()
run: vendor/bin/phpmd src/ text ruleset.phpmd.xml
- name: Copy .env.ci to .env.local
if: always()
run: cp .env.ci .env.test.local
- name: Clear and warmup cache
if: always()
id: cache_warmup
env:
APP_ENV: prod
APP_DEBUG: false
run: |
bin/console cache:clear
bin/console cache:warmup
- name: 'Linting: Twig'
if: success() || steps.cache_warmup.conclusion == 'success'
run: bin/console lint:twig templates
- name: 'Linting: Translations'
if: success() || steps.cache_warmup.conclusion == 'success'
run: bin/console lint:yaml translations
- name: 'Static Code Analysis: PHPStan'
if: success() || steps.cache_warmup.conclusion == 'success'
run: vendor/bin/phpstan analyse --error-format=json > reports/phpstan.json
- name: Migrate Test DB
if: always()
run: bin/console doctrine:schema:create --no-interaction --env=test
- name: 'Unit tests: PHP'
if: always()
run: php -dpcov.enabled=1 -dpcov.directory=. bin/phpunit -d --without-creating-snapshots --log-junit=reports/report-phpunit.xml --coverage-clover=reports/coverage-phpunit.xml
- name: 'Static Code Analysis: SonarCloud'
if: always()
uses: SonarSource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}