-
-
Notifications
You must be signed in to change notification settings - Fork 28
117 lines (98 loc) · 2.97 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
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
name: main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches: [develop]
push:
branches: [stable, develop]
workflow_dispatch:
inputs:
reason:
description: Why was the workflow triggered manually?
required: true
type: string
permissions:
contents: read
jobs:
build:
name: Run build and unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js and install NPM dependencies
uses: ./.github/actions/install-npm-deps
- name: Check code format
run: npm run format
- name: Lint
run: |
npm run lint
- name: Build
run: |
npm run build:lib
npm run build:demo -- --progress=false
npm run build:example -- --progress=false
- name: Test
run: |
npm run test:lib
npm run test:demo
npm run test:example
- name: Upload library build artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-ng-in-viewport
path: dist/ng-in-viewport
- name: Upload demo application build artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-demo
path: dist/demo
- name: Upload example application build artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-example
path: dist/example
- name: Upload code coverage report to Codecov
if: ${{ github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/ng-in-viewport/lcov.info
flags: unittests
e2e:
name: Run E2E tests
needs: build
strategy:
matrix:
project: ['demo', 'example']
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js and install NPM dependencies
uses: ./.github/actions/install-npm-deps
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-${{ matrix.project }}
path: dist/${{ matrix.project }}
- name: Run cypress
uses: cypress-io/github-action@v5
with:
project: projects/${{ matrix.project }}-e2e
browser: chrome
headless: true
- name: Upload failed screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: failed-e2e-${{ matrix.project }}-screenshots
path: projects/${{ matrix.project }}-e2e/artifacts/screenshots
- name: Upload failed videos
uses: actions/upload-artifact@v4
if: failure()
with:
name: failed-e2e-${{ matrix.project }}-videos
path: projects/${{ matrix.project }}-e2e/artifacts/videos