-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (138 loc) · 4.58 KB
/
ci_integration_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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Integration Tests
on:
schedule:
- cron: '00 09 * * *'
workflow_call:
inputs:
environment:
required: true
type: string
description: Select the Environment
canary:
description: 'run the tests on canary version'
required: false
type: boolean
default: false
notify:
description: 'notify result with slack message'
required: false
type: boolean
default: true
workflow_dispatch:
inputs:
environment:
required: true
type: choice
description: Select the Environment
options:
- local
- dev
canary:
description: 'run the tests on canary version'
required: false
type: boolean
default: false
notify:
description: 'notify result with slack message'
required: false
type: boolean
default: false
permissions:
id-token: write
contents: read
deployments: write
pages: write
concurrency:
group: "integration"
cancel-in-progress: true
jobs:
integration_test:
name: Test ${{(inputs.environment == null && 'dev') || inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707
- name: Set Node.js 18
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
with:
node-version: 18.15.0
- name: Run Integration Tests Puppeteer
shell: bash
run: |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}'
if [ "${{ inputs.environment || 'dev' }}" = "local" ]; then
export FE_URL=https://icy-island-050778e03-${{ github.event.number }}.westeurope.5.azurestaticapps.net/ui
fi
if [ "${{ inputs.environment || 'dev' }}" = "dev" ]; then
export FE_URL="https://selfcare.dev.platform.pagopa.it/ui"
fi
cd ./integration-test
yarn install
yarn run cucumber
- name: Run Integration Tests Playwright
shell: bash
run: |
cd ./e2e
yarn install
npx playwright install --with-deps
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}'
export SUBKEY='${{ secrets.DEV_SUBKEY }}'
npx playwright test --workers=1 --max-failures=1 --project=chromium
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: './e2e/playwright-report/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
print_debug:
runs-on: ubuntu-latest
steps:
- name: Dump Inputs
env:
JSON_INPUTS: ${{ toJson(inputs) }}
run: echo "$JSON_INPUTS"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
notify:
needs: [ integration_test ]
runs-on: ubuntu-latest
name: Notify
if: ${{ always() && (github.event_name == 'schedule' || inputs.notify == true ) }}
steps:
- name: Report Status
uses: ravsamhq/notify-slack-action@be814b201e233b2dc673608aa46e5447c8ab13f2 # v2
with:
status: ${{ needs.integration_test.result }}
token: ${{ secrets.GITHUB_TOKEN }}
notify_when: 'success,failure,skipped'
notification_title: "<{run_url}| Integration Test> has {status_message} in ${{ inputs.environment || 'dev'}}"
message_format: '{emoji} <{run_url}|{workflow}> {status_message} in <{repo_url}|{repo}>'
footer: 'Linked to <{workflow_url}| workflow file>'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}