-
Notifications
You must be signed in to change notification settings - Fork 27
138 lines (116 loc) · 3.34 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 2
jobs:
unit-test-and-build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: yarn
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
run: yarn install
- name: Lint
run: |
yarn run lint
- name: Test
run: |
yarn run coverage:unit
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage_unit
path: coverage/clover.xml
retention-days: 4
- name: Build
run: yarn run build
- name: Check browser compatibility
run: yarn run lint:compat
- name: Towncrier - draft changelog
uses: cylc/release-actions/towncrier-draft@v1
cypress-run:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
type: [e2e, component]
browser: [firefox, chrome]
os: [ubuntu-latest]
# TODO: re-enable once macos build is stable #590
# include:
# - os: macos-latest
# browser: edge
env:
COVERAGE: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: yarn
- name: Test (E2E)
if: matrix.type == 'e2e'
uses: cypress-io/github-action@v6
env:
BASE_URL: http://localhost:4173/
with:
build: yarn run build --mode offline
start: yarn run preview
config: baseUrl=${{ env.BASE_URL }}
wait-on: ${{ env.BASE_URL }}
browser: ${{ matrix.browser }}
- name: Test (component)
if: matrix.type == 'component'
uses: cypress-io/github-action@v6
with:
component: true
browser: ${{ matrix.browser }}
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: 'cypress-screenshots_${{ matrix.type }}_${{ matrix.browser }}_${{ matrix.os }}'
path: tests/e2e/screenshots
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: 'coverage_${{ matrix.type }}_${{ matrix.browser }}_${{ matrix.os }}'
path: coverage/lcov.info
retention-days: 4
codecov-upload:
needs: [unit-test-and-build, cypress-run]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download coverage artifacts
uses: actions/download-artifact@v4
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
# Token not required for public repos, but avoids upload failure due
# to rate-limiting (but not for PRs opened from forks)
token: ${{ secrets.CODECOV_TOKEN }}