Skip to content

Commit d9c1629

Browse files
Felix-Suarez-Bonillaamandassa-tR
authored andcommitted
Refactor PHP version specification and enhance testRigor workflow with connection verification and artifact upload
1 parent a091b45 commit d9c1629

File tree

1 file changed

+69
-22
lines changed

1 file changed

+69
-22
lines changed

.github/workflows/main.yml

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php-versions: ['8.2', '8.3', '8.4']
19+
php-versions: ["8.2", "8.3", "8.4"]
2020
steps:
2121
- uses: actions/checkout@v2
2222

@@ -35,30 +35,30 @@ jobs:
3535
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
3636
restore-keys: |
3737
${{ runner.os }}-php-
38-
38+
3939
- name: Install dependencies
4040
if: steps.composer-cache.outputs.cache-hit != 'true'
4141
run: composer install --prefer-dist --no-progress --no-suggest
4242

4343
- name: Run tests
4444
run: vendor/bin/phpunit --configuration dev/tests/phpunit.xml --testsuite unit --coverage-clover clover.xml
4545

46-
# - name: Monitor coverage
47-
# if: github.event_name == 'pull_request'
48-
# uses: slavcodev/coverage-monitor-action@1.2.0
49-
# with:
50-
# github_token: ${{ secrets.GITHUB_TOKEN }}
51-
# clover_file: "clover.xml"
52-
# threshold_alert: 10
53-
# threshold_warning: 20
46+
# - name: Monitor coverage
47+
# if: github.event_name == 'pull_request'
48+
# uses: slavcodev/coverage-monitor-action@1.2.0
49+
# with:
50+
# github_token: ${{ secrets.GITHUB_TOKEN }}
51+
# clover_file: "clover.xml"
52+
# threshold_alert: 10
53+
# threshold_warning: 20
5454

5555
verification-tests:
5656
name: Verification Tests
5757
runs-on: ubuntu-latest
5858
strategy:
5959
fail-fast: false
6060
matrix:
61-
php-versions: ['8.2', '8.3', '8.4']
61+
php-versions: ["8.2", "8.3", "8.4"]
6262
steps:
6363
- uses: actions/checkout@v2
6464

@@ -76,7 +76,7 @@ jobs:
7676
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
7777
restore-keys: |
7878
${{ runner.os }}-php-
79-
79+
8080
- name: Install dependencies
8181
if: steps.composer-cache.outputs.cache-hit != 'true'
8282
run: composer install --prefer-dist --no-progress --no-suggest
@@ -90,7 +90,7 @@ jobs:
9090
strategy:
9191
fail-fast: false
9292
matrix:
93-
php-versions: ['8.2', '8.3', '8.4']
93+
php-versions: ["8.2", "8.3", "8.4"]
9494
steps:
9595
- uses: actions/checkout@v2
9696

@@ -108,7 +108,7 @@ jobs:
108108
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
109109
restore-keys: |
110110
${{ runner.os }}-php-
111-
111+
112112
- name: Install dependencies
113113
if: steps.composer-cache.outputs.cache-hit != 'true'
114114
run: composer install --prefer-dist --no-progress --no-suggest
@@ -122,7 +122,7 @@ jobs:
122122
strategy:
123123
fail-fast: false
124124
matrix:
125-
php-versions: ['8.2', '8.3', '8.4']
125+
php-versions: ["8.2", "8.3", "8.4"]
126126

127127
services:
128128
chrome:
@@ -146,7 +146,7 @@ jobs:
146146
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
147147
restore-keys: |
148148
${{ runner.os }}-php-
149-
149+
150150
- name: Install dependencies
151151
if: steps.composer-cache.outputs.cache-hit != 'true'
152152
run: composer install --prefer-dist --no-progress --no-suggest
@@ -157,18 +157,42 @@ jobs:
157157
testrigor-tests:
158158
name: testRigor Tests
159159
runs-on: ubuntu-latest
160+
160161
env:
162+
# testRigor variables
161163
MAGENTO_TEST_SUITE_ID: ${{vars.MAGENTO_TEST_SUITE_ID}}
162164
MAGENTO_AUTH_TOKEN: ${{secrets.MAGENTO_AUTH_TOKEN}}
163-
LOCALHOST_URL: ${{vars.LOCALHOST_URL}}
165+
166+
# MFTF Magento connection variables
167+
MAGENTO_BASE_URL: ${{vars.MAGENTO_BASE_URL}}
168+
MAGENTO_BACKEND_NAME: ${{vars.MAGENTO_BACKEND_NAME}}
169+
MAGENTO_ADMIN_USERNAME: ${{vars.MAGENTO_ADMIN_USERNAME}}
170+
MAGENTO_ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
171+
172+
# MFTF configuration
173+
SELENIUM_CLOSE_ALL_SESSIONS: true
174+
BROWSER: chrome
175+
WINDOW_WIDTH: 1920
176+
WINDOW_HEIGHT: 1080
177+
WAIT_TIMEOUT: 60
178+
MAGENTO_CLI_WAIT_TIMEOUT: 60
179+
TEST_ENV: ci
180+
HEADLESS: true
181+
182+
services:
183+
chrome:
184+
image: selenium/standalone-chrome:3.141.59-zirconium
185+
ports:
186+
- 4444:4444
164187

165188
steps:
166189
- uses: actions/checkout@v4
190+
167191
- name: Setup PHP
168192
uses: shivammathur/setup-php@master
169193
with:
170-
php-version: ${{ matrix.php-versions }}
171-
extensions: curl, dom, intl, json, openssl
194+
php-version: "8.2"
195+
extensions: curl, dom, intl, json, openssl, zip
172196

173197
- name: Cache Composer packages
174198
id: composer-cache
@@ -178,10 +202,33 @@ jobs:
178202
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
179203
restore-keys: |
180204
${{ runner.os }}-php-
181-
205+
182206
- name: Install dependencies
183207
if: steps.composer-cache.outputs.cache-hit != 'true'
184208
run: composer install --prefer-dist --no-progress --no-suggest
185209

186-
- name: Run tests
187-
run: bin/mftf run:testrigor
210+
- name: Verify Magento connection
211+
run: |
212+
echo "Testing connection to $MAGENTO_BASE_URL"
213+
curl -f -s -o /dev/null $MAGENTO_BASE_URL || echo "Warning: Cannot connect to Magento"
214+
215+
- name: Build MFTF project
216+
run: php bin/mftf build:project
217+
218+
- name: Verify MFTF configuration
219+
run: php bin/mftf doctor || true
220+
221+
- name: Run testRigor tests
222+
run: |
223+
echo "Running MFTF testRigor tests..."
224+
php bin/mftf run:testrigor --debug
225+
226+
- name: Upload test artifacts
227+
if: failure()
228+
uses: actions/upload-artifact@v4
229+
with:
230+
name: mftf-test-artifacts
231+
path: |
232+
dev/tests/acceptance/_output/
233+
var/log/
234+
retention-days: 7

0 commit comments

Comments
 (0)