-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (143 loc) · 6.64 KB
/
ci.yaml
File metadata and controls
166 lines (143 loc) · 6.64 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Tests
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"
uses: actions/checkout@v4
if: "${{ inputs.branch == '' }}"
- name: "Get matrix"
id: matrix
uses: notiz-dev/github-action-json-property@release
with:
path: '.github/workflows/matrix.json'
prop_path: '${{ inputs.type }}.ci'
phpunit-cli-api:
needs: get-matrix
runs-on: ubuntu-latest
name: "PHPUnit, CLI, API, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
timeout-minutes: 45
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
env:
APP_ENV: ${{ matrix.env || 'test_cached' }}
BEHAT_BASE_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f progress"
BEHAT_RERUN_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f pretty --rerun"
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: Build application
uses: SyliusLabs/BuildTestAppAction@v4
with:
cache_key: "${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('composer.json') }}"
cache_restore_key: "${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-"
e2e: "yes"
database: "mysql:${{ matrix.mysql }}"
php_version: ${{ matrix.php }}
symfony_version: ${{ matrix.symfony }}
node_version: "22.x"
- name: Fix permissions for Symfony logs directory
run: |
LOGS_DIR=$(bin/console debug:container --parameter=kernel.logs_dir | grep 'kernel.logs_dir' | awk '{print $2}')
mkdir -p "$LOGS_DIR"
chmod -R 777 "$LOGS_DIR"
- name: Test installer
run: bin/console sylius:install --no-interaction -vvv
- name: Run PHPUnit
run: vendor/bin/phpunit --colors=always
- name: Run CLI Behat
run: |
$BEHAT_BASE_CMD --tags="@cli&&~@todo" --suite-tags="@cli" || \
$BEHAT_RERUN_CMD --tags="@cli&&~@todo" --suite-tags="@cli"
- name: Run API Behat
run: |
$BEHAT_BASE_CMD --tags="~@todo&&~@cli&&~@mink:chromedriver&&~@javascript" --suite-tags="@api,@domain" || \
$BEHAT_RERUN_CMD --tags="~@todo&&~@cli&&~@mink:chromedriver&&~@javascript" --suite-tags="@api,@domain"
- name: Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Logs (PHPUnit, CLI, API, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}) - ${{ github.run_id }}-${{ github.run_number }}"
path: |
etc/build/
var/log
if-no-files-found: ignore
overwrite: true
behat-ui:
needs: get-matrix
runs-on: ubuntu-latest
name: "UI, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
timeout-minutes: 45
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
env:
APP_ENV: ${{ matrix.env || 'test_cached' }}
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
BEHAT_BASE_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f progress"
BEHAT_RERUN_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f pretty --rerun"
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: Build application
uses: SyliusLabs/BuildTestAppAction@v4
with:
build_type: "app"
cache_key: "${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('composer.json') }}"
cache_restore_key: "${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-"
e2e: "yes"
e2e_js: "yes"
database: "mysql:${{ matrix.mysql }}"
php_version: ${{ matrix.php }}
symfony_version: ${{ matrix.symfony }}
node_version: "20.x"
- name: Run UI Behat
run: |
$BEHAT_BASE_CMD --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || \
$BEHAT_RERUN_CMD --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui"
- name: Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Logs (UI, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}) - ${{ github.run_id }}-${{ github.run_number }}"
path: |
etc/build/
var/log
if-no-files-found: ignore
overwrite: true