-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (117 loc) · 3.37 KB
/
build.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
name: Build
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
paths:
- '.github/workflows/build.yml'
- 'frontend/**'
env:
NODE_VERSION: '20.x'
NPM_LOCK_LOCATION: 'frontend/package-lock.json'
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
lint:
if: ${{ github.event.action != 'closed' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.NPM_LOCK_LOCATION }}
- name: Install Packages
run: |
cd frontend
npm ci
- name: Run Linter
run: |
cd frontend
npm run lint
unit-testing:
if: ${{ github.event.action != 'closed' }}
needs: [ lint ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.NPM_LOCK_LOCATION }}
- name: Install Packages
run: |
cd frontend
npm ci
- name: Run Unit Tests
run: |
cd frontend
npm run test:unit -- --coverage
e2e-testing:
if: ${{ github.event.action != 'closed' }}
needs: [ lint ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.NPM_LOCK_LOCATION }}
- name: Install Packages
run: |
cd frontend
npm ci
- name: Run Unit Tests
uses: cypress-io/github-action@v6
with:
browser: chrome
build: npm run build
start: npm run preview
working-directory: frontend
wait-on: http://localhost:4173/
build-deploy-preview:
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
if: github.event.action != 'closed'
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.NPM_LOCK_LOCATION }}
- name: Install Packages
run: |
cd frontend
npm ci
- name: Build Library
if: github.event.action != 'closed'
env:
VITE_IMPRINT_EMAIL: ${{ secrets.VITE_IMPRINT_EMAIL }}
VITE_IMPRINT_NAME: ${{ secrets.VITE_IMPRINT_NAME }}
VITE_IMPRINT_STREET: ${{ secrets.VITE_IMPRINT_STREET }}
VITE_IMPRINT_POSTAL_CODE: ${{ secrets.VITE_IMPRINT_POSTAL_CODE }}
VITE_IMPRINT_CITY: ${{ secrets.VITE_IMPRINT_CITY }}
run: |
cd frontend
npm run build
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./frontend/dist
custom-url: sense.michigg.de