-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (96 loc) · 2.68 KB
/
test-and-release.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
117
118
119
120
121
122
123
124
125
name: Test and Release
on:
push:
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Compile TypeScript
run: npx tsc
- name: Check source code with eslint
run: npx eslint ./
- name: Check if source code is properly formatted
run: npx prettier -c ./
- name: Run tests
run: npm test
- name: Ensure it builds
env:
REGISTRY_ENDPOINT: https://example.com/
run: |
npm run build
e2e-tests:
timeout-minutes: 10
runs-on: ubuntu-latest
environment: ci
container: mcr.microsoft.com/playwright:v1.49.1
env:
MAP_REGION: ${{ vars.MAP_REGION }}
MAP_NAME: ${{ vars.MAP_NAME }}
MAP_API_KEY: ${{ vars.MAP_API_KEY }}
# Note: It's currently not possible to run test for multiple browsers in
# parallel since the `webServer` cannot be defined per project:
# https://github.com/microsoft/playwright/issues/22496
# However the mock backend server state is manipulated during test runs and
# therefore cannot be used in parallel.
strategy:
matrix:
browser:
- chromium
- firefox
- webkit
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit --force
- name: Run Playwright tests
env:
HOME: /root
run: npx playwright test -x --project ${{ matrix.browser }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
retention-days: 7
release:
if: github.ref == 'refs/heads/saga'
permissions:
actions: write
contents: write
needs:
- tests
- e2e-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Semantic release
continue-on-error: true
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger deployment workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run deploy.yaml