-
Notifications
You must be signed in to change notification settings - Fork 211
139 lines (118 loc) · 5.66 KB
/
e2e-test.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: E2E test workflow
run-name: E2E test workflow with test suite branch ${{inputs.testBranch || 'main'}}
on:
pull_request:
branches: [main]
pull_request_target:
branches: [main]
workflow_dispatch:
inputs:
testBranch:
description: "Integration Test Repository branch"
required: true
default: "develop"
testGroup:
description: "Test group"
required: true
default: "standard"
type: choice
options:
- all
- standard
- express-checkout
expressBranch:
description: "Express Checkout repository branch"
required: true
default: "main"
jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch')
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
strategy:
matrix:
php-version: ["8.3"]
magento-version: ["2.4.7-p2"]
runs-on:
group: larger-runners
labels: ubuntu-latest-8-cores
timeout-minutes: 25
env:
PHP_VERSION: ${{ matrix.php-version }}
MAGENTO_VERSION: ${{ matrix.magento-version }}
ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}}
ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}}
ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}}
ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
DONATION_ACCOUNT: ${{secrets.DONATION_ACCOUNT}}
DEPLOY_SAMPLEDATA: 1
steps:
# Define variables for the test case
- run: echo "IS_RELEASE=${{ contains(github.event.pull_request.title, 'Release v9.') && 'TRUE' || 'FALSE' }}" >> $GITHUB_ENV
- run: echo "TEST_GROUP=${{ env.IS_RELEASE == 'TRUE' && 'all' || (inputs.testGroup || 'standard') }}" >> $GITHUB_ENV
- run: echo "TEST_BRANCH=${{ (env.IS_RELEASE == 'TRUE' || !inputs.testBranch) && 'develop' || inputs.testBranch }}" >> $GITHUB_ENV
- run: echo "EXPRESS_BRANCH=${{ contains(fromJSON('["all", "express-checkout"]'), env.TEST_GROUP) && (inputs.expressBranch || 'main') || '' }}" >> $GITHUB_ENV
- name: Information
run: echo "E2E testing against test suite branch ${{env.TEST_BRANCH}} using group ${{env.TEST_GROUP}} ${{ env.EXPRESS_BRANCH && 'with express module branch' || '' }} ${{ env.EXPRESS_BRANCH || '' }}"
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Install Magento
run: docker compose -f .github/docker-compose.yml run --rm web make magento
- name: Start web server in background
run: docker compose -f .github/docker-compose.yml up -d web
- name: Setup permissions
run: docker exec magento2-container make fs
- name: Check install
run: docker exec magento2-container make sys-check
- name: Install plugin
run: docker exec -u www-data magento2-container make plugin
- name: Kill Cron Jobs
run: docker exec magento2-container /etc/init.d/cron stop
- name: Checkout developer module
uses: actions/checkout@v3
with:
repository: Adyen/adyen-magento2-dev
ref: "main"
token: ${{ secrets.ADYEN_AUTOMATION_BOT_TEST_ACCESS_TOKEN }}
path: Developer
- name: Make the folder for dev module
run: docker exec -u www-data magento2-container mkdir -p /var/www/html/app/code/Adyen
- name: Copy dev module into Docker container
run: docker cp ./Developer magento2-container:/var/www/html/app/code/Adyen
- name: Change ownership of developer module folder
run: docker exec magento2-container chown -R www-data:www-data /var/www/html/app/code/Adyen/Developer
- name: Enable developer module
run: docker exec -u www-data magento2-container make dev-module
- name: Install Express module
if: ${{ env.EXPRESS_BRANCH }}
run: docker exec -u www-data magento2-container composer require adyen/adyen-magento2-expresscheckout:dev-${{ env.EXPRESS_BRANCH }}
- name: Enable Express module
if: ${{ env.EXPRESS_BRANCH }}
run: docker exec -u www-data magento2-container make enable-express
- name: Switch to production mode
run: docker exec -u www-data magento2-container make production
- name: Setup permissions
run: docker exec magento2-container make fs
- name: Run E2E tests
run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh ${{ env.TEST_GROUP }}
env:
INTEGRATION_TESTS_BRANCH: ${{ env.TEST_BRANCH }}
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
MAGENTO_ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
MAGENTO_BASE_URL: ${{secrets.MAGENTO_BASE_URL}}
PAYPAL_USERNAME: ${{secrets.PLAYWRIGHT_PAYPAL_USERNAME}}
PAYPAL_PASSWORD: ${{secrets.PLAYWRIGHT_PAYPAL_PASSWORD}}
GOOGLE_USERNAME: ${{secrets.PLAYWRIGHT_GOOGLE_USERNAME}}
GOOGLE_PASSWORD: ${{secrets.PLAYWRIGHT_GOOGLE_PASSWORD}}
AMAZON_USERNAME: ${{secrets.AMAZON_USERNAME}}
AMAZON_PASSWORD: ${{secrets.AMAZON_PASSWORD}}
WEBHOOK_USERNAME: admin
WEBHOOK_PASSWORD: 1234
CI: TRUE
- name: Archive test result artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: html-report
path: test-report