forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (113 loc) · 5.4 KB
/
ci_static-checks.yaml
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
name: Static Analysis
on:
workflow_dispatch: ~
workflow_call:
inputs:
branch:
description: "Branch"
required: false
type: string
default: ""
type:
description: "Type of the build"
required: true
type: string
permissions:
contents: read
jobs:
get-matrix:
runs-on: ubuntu-latest
name: "Get matrix"
outputs:
matrix: ${{ steps.matrix.outputs.prop }}
steps:
- name: "Checkout (With Branch)"
if: "${{ inputs.branch != '' }}"
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: "Checkout"
if: "${{ inputs.branch == '' }}"
uses: actions/checkout@v4
-
name: "Get matrix"
id: matrix
uses: notiz-dev/github-action-json-property@release
with:
path: '.github/workflows/matrix.json'
prop_path: '${{ inputs.type }}.static-checks'
static-checks:
needs: get-matrix
runs-on: ubuntu-latest
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, API Platform ${{ matrix.api-platform }}"
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
env:
APP_ENV: test_cached
DATABASE_URL: "mysql://root:[email protected]/sylius?charset=utf8mb4&serverVersion=8.0"
steps:
- name: "Checkout (With Branch)"
if: "${{ inputs.branch != '' }}"
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: "Checkout"
if: "${{ inputs.branch == '' }}"
uses: actions/checkout@v4
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0
extensions: intl, gd, opcache, mysql, pdo_mysql
tools: symfony, composer-require-checker
coverage: none
- name: "Restrict packages' versions"
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
composer config extra.symfony.require "${{ matrix.symfony }}"
composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction
- name: Restrict API Platform version for ApiBundle
run: composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction
working-directory: "src/Sylius/Bundle/ApiBundle"
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Setup cache"
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.dir }}
key: ${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}
- name: "Require ext-random"
if: matrix.php == '8.2'
run: composer require ext-random --no-update --no-scripts --no-interaction
- name: "Install dependencies"
run: composer update --no-interaction --no-scripts
- name: "Validate composer.json"
run: composer validate --strict --no-check-version
- name: "Check for security vulnerabilities"
run: symfony security:check
continue-on-error: true
- name: "Validate Twig templates"
run: bin/console lint:twig src
- name: "Validate Container"
run: bin/console lint:container
- name: Validate Yaml files
run: bin/console lint:yaml src
- name: Validate Package versions
run: vendor/bin/monorepo-builder validate
- name: Run PHPArkitect
run: vendor/bin/phparkitect check
- name: Run PHPStan
run: vendor/bin/phpstan analyse
- name: Run PHPSpec
run: vendor/bin/phpspec run --ansi --no-interaction -f dot
- name: Run ComposerRequireChecker
run: |
(cat composer.json | jq '.["autoload-dev"]["psr-4"] |= . + {"Sylius\\Behat\\": "src/Sylius/Behat/"}' | jq 'del(.autoload["psr-4"]["Sylius\\Behat\\"])') > _composer.json
mv _composer.json composer.json
composer dump-autoload
composer-require-checker check --config-file=composer-require-checker.json --ignore-parse-errors