-
Notifications
You must be signed in to change notification settings - Fork 19
169 lines (142 loc) Β· 5.46 KB
/
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
157
158
159
160
161
162
163
164
165
166
167
168
169
name: e2e
on:
workflow_dispatch:
pull_request:
types: [synchronize, opened, reopened]
permissions:
id-token: write
contents: read
jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
outputs:
npm-package-version: ${{ steps.version.outputs.npm-package-version }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set NPM Env
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Choose version
id: version
run: 'node tasks/set-npm-canary-version.js'
- name: Build
run: npm run build
- name: Lerna publish canary version
run: |
git config --global user.name "stryker-mutator[bot]"
git config --global user.email 158062761+stryker-mutator[bot]@users.noreply.github.com
npx lerna version ${{ steps.version.outputs.npm-package-version }} --no-git-tag-version --no-push --exact --force-publish --yes --no-conventional-commits
git commit -am "temp-commit"
npx lerna publish from-package --dist-tag canary --no-git-reset --yes
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/stryker-mutator/dashboard
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=v${{ steps.version.outputs.npm-package-version }}
- name: Wait for package to be available
run: node tasks/wait-for-npm-package.js ${{ steps.version.outputs.npm-package-version }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
id: build
with:
context: ./docker
push: true
build-args: 'version=${{ steps.meta.outputs.version }}'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-and-test:
name: Deploy to Acceptance and run E2E tests
needs: build-and-release
runs-on: ubuntu-latest
environment:
name: Acceptance
url: https://stryker-dashboard-acceptance.azurewebsites.net/
concurrency:
group: Acceptance
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download & install badge-api package
run: ./tasks/download-badge-api-package.sh ${{ needs.build-and-release.outputs.npm-package-version }}
- name: Azure login
uses: Azure/login@v2
with:
client-id: ${{ secrets.AZURE_IDENTITY_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_IDENTITY_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_IDENTITY_SUBSCRIPTION_ID }}
- name: 'Deploy stryker-dashboard-acceptance.azurewebsites.net'
uses: azure/webapps-deploy@v3
with:
app-name: 'stryker-dashboard-acceptance'
images: 'ghcr.io/stryker-mutator/dashboard:${{ needs.build-and-release.outputs.npm-package-version }}'
- name: 'Deploy stryker-mutator-badge-api-acceptance.azurewebsites.net'
uses: Azure/functions-action@v1
id: fa
with:
app-name: stryker-mutator-badge-api-acceptance
package: 'package'
- name: 'Verify deployment'
run: |
node tasks/check-version badge-api https://stryker-mutator-badge-api-acceptance.azurewebsites.net/api ${{ needs.build-and-release.outputs.npm-package-version }}
node tasks/check-version dashboard https://stryker-dashboard-acceptance.azurewebsites.net/api/version ${{ needs.build-and-release.outputs.npm-package-version }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install browsers
run: |
cd packages/e2e
npx playwright install chromium --with-deps
- name: Build
run: |
cd packages/e2e
npx tsc -b
cd ../..
- name: Run e2e tests
run: |
cd packages/e2e
npm run test
env:
BASE_URL: https://stryker-dashboard-acceptance.azurewebsites.net
E2E_AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.E2E_AZURE_STORAGE_CONNECTION_STRING }}
E2E_JWT_SECRET: ${{ secrets.E2E_JWT_SECRET }}
E2E_ACCESS_TOKEN: ${{ secrets.E2E_ACCESS_TOKEN }}
E2E_BADGE_API_BASE_URL: https://stryker-mutator-badge-api-acceptance.azurewebsites.net
- name: Upload artifacts if failed
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-videos
path: |
packages/e2e/test-results/
packages/e2e/playwright-report/