-
Notifications
You must be signed in to change notification settings - Fork 3.9k
156 lines (133 loc) · 4.82 KB
/
reusable-web-e2e.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
name: Test WEB
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
# Controls when the action will run. Triggers the workflow on push or pull request
on:
workflow_dispatch:
inputs:
ee:
description: 'use the ee version of worker'
required: false
default: true
type: boolean
workflow_call:
inputs:
ee:
description: 'use the ee version of worker'
required: false
default: false
type: boolean
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
e2e_web:
strategy:
fail-fast: false
matrix:
# run 4 copies of the current job in parallel
containers: [1, 2, 3, 4]
total: [4]
# The type of runner that the job will run on
runs-on: ubuntu-latest
timeout-minutes: 80
permissions:
contents: read
packages: write
deployments: write
id-token: write
steps:
- id: determine_run_type
name: Determing community vs enterprise run
run: |
if ! [[ -z "${{ secrets.SUBMODULES_TOKEN }}" ]]; then
echo "enterprise_run=true" >> $GITHUB_OUTPUT
else
echo "enterprise_run=false" >> $GITHUB_OUTPUT
fi
- id: checkout-enterprise-code
name: Checkout enterprise code from the submodule
uses: actions/checkout@v4
if: steps.determine_run_type.outputs.enterprise_run == 'true'
with:
submodules: true
token: ${{ secrets.SUBMODULES_TOKEN }}
- id: checkout-community-code
name: Checkout community code
uses: actions/checkout@v4
if: steps.determine_run_type.outputs.enterprise_run != 'true'
- uses: ./.github/actions/setup-project
with:
submodules: true
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: build
projects: '@novu/web,@novu/api,@novu/worker'
args: --skip-nx-cache
- uses: ./.github/actions/start-localstack
- uses: ./.github/actions/setup-redis-cluster
- uses: ./.github/actions/run-backend
with:
cypress_github_oauth_client_id: ${{ secrets.CYPRESS_GITHUB_OAUTH_CLIENT_ID }}
cypress_github_oauth_client_secret: ${{ secrets.CYPRESS_GITHUB_OAUTH_CLIENT_SECRET }}
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}
ci_ee_test: ${{ steps.determine_run_type.outputs.enterprise_run }}
- name: Start WS
run: |
cd apps/ws && pnpm start:test &
- name: Start Novu web app
working-directory: apps/web
env:
REACT_APP_API_URL: http://127.0.0.1:1336
REACT_APP_WS_URL: http://127.0.0.1:1340
REACT_APP_WEBHOOK_URL: http://127.0.0.1:1341
# Disable LaunchDarkly client-side SDK in the test environment to reduce E2E flakiness
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID: ''
NOVU_ENTERPRISE: ${{ steps.determine_run_type.outputs.enterprise_run }}
run: |
pnpm run envsetup:docker
pnpm start:static:build &
- name: Wait on Services
run: wait-on --timeout=180000 http://127.0.0.1:1340/v1/health-check http://127.0.0.1:4200/
- name: Install Playwright
working-directory: apps/web
run: pnpm test:e2e:install
- name: Run E2E tests
working-directory: apps/web
env:
NOVU_ENTERPRISE: ${{ steps.determine_run_type.outputs.enterprise_run }}
run: pnpm test:e2e --shard=${{ matrix.containers }}/${{ matrix.total }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: blob-report-${{ matrix.containers }}
path: apps/web/blob-report
retention-days: 1
merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: ${{ !cancelled() }}
needs: [e2e_web]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.8.1
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14
- name: Send Slack notifications
uses: ./.github/actions/slack-notify-on-failure
if: failure()
with:
slackWebhookURL: ${{ secrets.SLACK_WEBHOOK_URL_ENG_FEED_GITHUB }}