-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (115 loc) · 3.47 KB
/
pull_request.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
name: Pull Request Events
on: pull_request
permissions:
contents: write
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test-functional:
name: Functional tests
runs-on: ubuntu-latest
environment:
name: dev
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: 💾 Cache firebase emulators
uses: actions/cache@v4
with:
path: /home/runner/.cache/firebase/emulators
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
continue-on-error: true
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 📥 Download dependencies
run: npm ci
- name: 💻 Install Playwright Browsers
run: npx playwright install chromium --with-deps
- name: 🚀 Start App
run: |
npm run start:e2e-resources &
npx wait-on http://127.0.0.1:5173
npx wait-on http://127.0.0.1:4000/auth
env:
VITE_QUAD_WORD: ${{ secrets.QUAD_WORD }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
VITE_BUILD: development
- name: ⏯️ Run Playwright Tests
run: npm run e2e
- name: ⬆️ Upload Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
test-unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 📥 Download dependencies
run: npm ci
- name: 🧪 Run tests
run: npm test
test-build:
name: Test build
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 📥 Download dependencies
run: |
npm ci
- name: 📦 Build
env:
VITE_QUAD_WORD: test
VITE_FIREBASE_CONFIG: '{}'
run: npm run build
deploy-preview:
name: Firebase preview
runs-on: ubuntu-latest
needs: [test-functional, test-unit, test-build]
if: ${{ github.event.sender.type == 'User' && github.head_ref != 'dev' }}
environment:
name: dev
steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
preview: yes
prebuild-command: |
cd functions
echo "ENVIRONMENT=stage" > .env
echo "AGS_HOST=https://wrimaps.at.utah.gov" >> .env
build-command: npm run build:stage
repo-token: ${{ secrets.GITHUB_TOKEN }}
env:
VITE_QUAD_WORD: ${{ secrets.QUAD_WORD }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}