-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (58 loc) · 1.96 KB
/
main.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
name: main
on: [push, pull_request]
jobs:
# this job installs dependencies and builds the "dist" folder
install:
runs-on: ubuntu-24.04
steps:
# https://github.com/actions/checkout
- name: Checkout 🛎️
uses: actions/checkout@v4
# only install the dependencies using
# https://github.com/cypress-io/github-action
- name: Install 📦
uses: cypress-io/github-action@v6
with:
runTests: false
# will create the "dist" folder
- name: Build site 🏗
run: npm run build
- run: ls -la
- run: ls -la dist
# only pass the local folder "dist"
# TIP: we want to avoid uploading node_modules since it is SLOW
# https://glebbahmutov.com/blog/parallel-cypress-tests-gh-action/
- name: Save build folder 🆙
uses: actions/upload-artifact@v4
# https://github.com/actions/upload-artifact#upload-an-entire-directory
with:
name: built
if-no-files-found: error
# upload all files in the "dist" folder
path: dist
# this job runs after the install job builds the "dist" folder
# serves the "dist" folder and runs end-to-end Cypress tests
ui-tests:
runs-on: ubuntu-24.04
needs: install
steps:
# https://github.com/actions/checkout
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Download the built folders ⏬
# https://github.com/actions/download-artifact
uses: actions/download-artifact@v4
with:
name: built
# download all files into "dist" folder
path: dist
- run: ls -la
- run: ls -la dist
# reinstall dependencies and run Cypress tests
- name: Cypress tests 🧪
uses: cypress-io/github-action@v6
with:
# start the local server
start: npm run serve
wait-on: "http://localhost:4173"
config: "baseUrl=http://localhost:4173"