-
Notifications
You must be signed in to change notification settings - Fork 4
111 lines (109 loc) · 2.94 KB
/
ci.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
name: CI
on:
pull_request:
branches:
- main
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
defaults:
run:
working-directory: ${{ matrix.project }}
strategy:
matrix:
project:
- 'react-app'
- 'rest-api-with-express'
- 'rest-api-with-fastify'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: ${{ matrix.project }}/package-lock.json
- name: Install Dependencies
run: npm ci
- name: Run linters
run: npm run lint
test-ui:
name: Test (UI)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.project }}
strategy:
matrix:
browser:
- 'chrome'
project:
- 'react-app'
- 'rest-api-with-express'
- 'rest-api-with-fastify'
- 'html-web-page'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: ${{ matrix.project }}/package-lock.json
- name: Build for Cypress
uses: cypress-io/github-action@v6
with:
working-directory: ${{ matrix.project }}
build: npm run build -- --logLevel error
runTests: false
- name: Run Cypress
uses: cypress-io/github-action@v6
with:
working-directory: ${{ matrix.project }}
start: npm start
browser: ${{ matrix.browser }}
install: false
- uses: actions/upload-artifact@master
if: failure()
with:
name: screenshots
path: ${{ matrix.project }}/cypress/screenshots
- uses: actions/upload-artifact@master
if: failure()
with:
name: videos
path: ${{ matrix.project }}/cypress/videos
test-unit:
name: Test (Unit)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.project }}
strategy:
matrix:
project:
- 'rest-api-with-express'
- 'rest-api-with-fastify'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: ${{ matrix.project }}/package-lock.json
- name: Install Dependencies
run: npm ci
- name: Run Unit Tests
run: npm test -- --reporter=xunit --reporter-options output=unit-tests.xml
- name: Report Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
${{ matrix.project }}/unit-tests.xml