-
Notifications
You must be signed in to change notification settings - Fork 8
116 lines (106 loc) · 4.56 KB
/
e2e-test.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
---
name: E2E Test
on:
pull_request:
branches: ["main", "develop"]
types: ["opened", "synchronize", "reopened", "ready_for_review"]
workflow_dispatch:
jobs:
launch:
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'hotfix')
strategy:
matrix:
version:
- 1.7.8.7
#- 1.7.7.5
steps:
- name: Generate Github token for PR checks
id: github-token-checks
uses: actions/create-github-app-token@v1
continue-on-error: true
with:
app-id: ${{ secrets.ALMA_UPDATE_CHECKS_APP_ID }}
private-key: ${{ secrets.ALMA_UPDATE_CHECKS_APP_PEM }}
repositories: alma-installments-prestashop
- name: Create a Github check for E2E tests run in the Pull Request
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
id: create-github-check
with:
github-token: ${{ steps.github-token-checks.outputs.token }}
script: |
const check = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'E2E tests results',
head_sha: '${{ github.event.pull_request.head.sha }}',
status: "in_progress",
})
core.setOutput('id', check.data.id)
- name: Generate Github token for integration-infrastructure repo
id: github-token-infrastructure
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.ALMA_WF_TRIGGER_APP_ID }}
private-key: ${{ secrets.ALMA_WF_TRIGGER_APP_PEM }}
repositories: integration-infrastructure
- name: Trigger E2E tests in the integration-infrastructure repository
uses: codex-/return-dispatch@v2
id: e2e-tests-workflow-dispatch
with:
token: ${{ steps.github-token-infrastructure.outputs.token }}
ref: main
repo: integration-infrastructure
owner: alma
workflow: deploy-cms.yaml
workflow_inputs: '{
"name": "e2e-${{ github.run_id }}",
"alma_plugin_branch": "${{ github.head_ref || github.ref_name }}",
"alma_plugin_test_branch" : "main",
"cms": "prestashop-${{ matrix.version }}",
"e2e": "true",
"e2e_check_info" : "{
\"repository\": \"${{ github.event.repository.name }}\",
\"pr_number\": \"${{ github.event.number }}\",
\"check_id\": \"${{ steps.create-github-check.outputs.id }}\"
}"
}'
workflow_timeout_seconds: 120 # Default: 300
- name: Hide deprecated E2E test run info message
uses: int128/hide-comment-action@v1
with:
# This string should be kept in sync with the last words of the comment in.
# `Send a comment to the PR informing that the E2E tests are running` step (in this workflow).
# `Add a comment with E2E tests results in the Pull Request` step (in e2e-test-post-results workflow)
contains: <!-- id:e2e-test-run-info -->
- name: Send a comment to the PR informing that the E2E tests are running
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⏳E2E tests are currently running. \n' +
'➡️ You can follow their progression [here](${{steps.e2e-tests-workflow-dispatch.outputs.run_url}}).' +
'\n\n<!-- id:e2e-test-run-info -->'
})
- name: Update Github check with the E2E tests run URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ steps.github-token-checks.outputs.token }}
script: |
const checkOutput = {
title: 'E2E tests results',
summary: '⏳E2E tests are currently running.',
text: '➡️ You can follow their progression [here](${{steps.e2e-tests-workflow-dispatch.outputs.run_url}}).'
};
github.rest.checks.update({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: '${{ steps.create-github-check.outputs.id }}',
output: checkOutput
})