-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (94 loc) · 2.9 KB
/
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
name: Run Tests
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
env:
VITE_API_URL_STAGING: ${{ secrets.VITE_API_URL_STAGING}}
VITE_AUTH0_DOMAIN: ${{ secrets.VITE_AUTH0_DOMAIN_STAGING }}
VITE_AUTH0_CLIENT_ID: ${{ secrets.VITE_AUTH0_CLIENT_ID_STAGING }}
VITE_ENV: staging
- name: Deploy to Netlify
id: deploy
uses: nwtgck/[email protected]
with:
publish-dir: "./dist"
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: false
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
- name: Save deploy URL
run: echo "${{ steps.deploy.outputs.deploy-url }}" > deploy-url.txt
- name: Upload deploy URL
uses: actions/upload-artifact@v4
with:
name: deploy-url
path: deploy-url.txt
unit-tests:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install dependencies
run: npm install
- name: Run unit tests
run: npm test
e2e-tests:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download deploy URL
uses: actions/download-artifact@v4
with:
name: deploy-url
- name: Set deploy URL
id: url
run: echo "::set-output name=DEPLOY_URL::$(cat deploy-url.txt)"
- name: Debug deploy URL
run: 'echo "DEPLOY_URL: ${{ steps.url.outputs.DEPLOY_URL }}"'
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
env:
VITE_AUTH0_TEST_USERNAME: ${{ secrets.VITE_AUTH0_TEST_USERNAME }}
VITE_AUTH0_TEST_PASSWORD: ${{ secrets.VITE_AUTH0_TEST_PASSWORD }}
PLAYWRIGHT_TEST_BASE_URL: ${{ steps.url.outputs.DEPLOY_URL }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30