-
Notifications
You must be signed in to change notification settings - Fork 8
200 lines (178 loc) · 7.41 KB
/
Copy pathci.yml
File metadata and controls
200 lines (178 loc) · 7.41 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: CI
on:
push:
branches: [ "develop", "main" ]
pull_request: ~
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
php-cs-fixer:
name: "Coding Standard"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: php-cs-fixer
- name: Check CS
run: php-cs-fixer fix --dry-run --diff
continue-on-error: true
phpstan:
name: "Static Analysis"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
ini-values: memory_limit=-1
- name: "Install dependencies"
run: composer update --no-interaction --no-progress
- name: "Run PHPStan"
run: vendor/bin/phpstan analyse -c phpstan.neon src
continue-on-error: true
tests:
name: "Tests (PHP ${{ matrix.php-version }}, Symfony ${{ matrix.symfony }}, ${{ matrix.dependencies }})"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
symfony:
- '6.4.*'
- '7.4.*'
- '8.0.*'
dependencies:
- "lowest"
- "highest"
operating-system:
- "ubuntu-latest"
exclude:
- php-version: "8.2"
symfony: '8.0.*'
- php-version: "8.3"
symfony: '8.0.*'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
- name: "Install chromium"
uses: "nanasess/setup-chromedriver@v2"
- name: "Configure Symfony"
run: 'composer config extra.symfony.require "${{ matrix.symfony }}"'
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache dependencies"
uses: "actions/cache@v4"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-symfony-${{ matrix.symfony }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-symfony-${{ matrix.symfony }}-${{ matrix.dependencies }}-"
- name: "Install dependencies"
run: |
if [ "${{ matrix.dependencies }}" == "lowest" ]; then
composer update --no-interaction --no-progress --prefer-lowest
else
composer update --no-interaction --no-progress
fi
- name: "Detect drivers"
run: "vendor/bin/bdi detect drivers"
- name: "Asset Mapper Install"
run: "./tests/App/AssetMapper/bin/console importmap:install"
- name: "Asset Mapper compile"
run: "./tests/App/AssetMapper/bin/console asset-map:compile"
- name: "yarn install"
run: "yarn --cwd tests/App/Webpack/ install"
- name: "yarn build"
run: "yarn --cwd tests/App/Webpack/ build"
- name: "Execute tests"
run: "composer test"
e2e-tests:
name: "E2E Test"
runs-on: ubuntu-latest
steps:
- name: Checkout bundle code
uses: actions/checkout@v4
with:
path: my-bundle
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv
tools: composer
- name: Create Dummy Symfony Project
run: |
composer create-project symfony/skeleton dummy-project
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Dependencies
run: |
cd dummy-project
composer config extra.symfony.allow-contrib true
composer config minimum-stability dev
composer config prefer-stable true
# Explicitly set the repository with path and version as requested
composer config repositories.local '{"type": "path", "url": "../my-bundle", "options": {"symlink": true, "versions": {"tito10047/altcha-bundle": "2.0.0"}}}'
composer require tito10047/altcha-bundle:"2.0.0" --no-scripts
- name: Copy E2E Test Files
run: |
cp -R my-bundle/tests_e2e/basic/* dummy-project/
- name: Run PHP Built-in Server
run: |
cd dummy-project
php -S 127.0.0.1:8000 -t public &
sleep 5
- name: Test URL
run: |
curl -s http://127.0.0.1:8000/test-bundle > response.html
RESPONSE=$(cat response.html)
if [[ "$RESPONSE" == *"altcha-widget"* ]]; then
echo "Altcha widget found in response."
else
echo "Altcha widget NOT found in response!"
exit 1
fi
if [[ "$RESPONSE" == *"altcha.min.js"* || "$RESPONSE" == *"tito10047--altcha-bundle--altcha"* ]]; then
echo "Altcha assets/controller found."
else
echo "Altcha assets/controller NOT found!"
exit 1
fi
- name: Upload HTML Response on Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-response-html
path: response.html