-
Notifications
You must be signed in to change notification settings - Fork 51
143 lines (133 loc) · 4.03 KB
/
test.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
139
140
141
142
143
name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: CYPRESS_INSTALL_BINARY=0 yarn install
- run: yarn lint
test:
name: Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: CYPRESS_INSTALL_BINARY=0 yarn install
- run: yarn test:ci
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage
retention-days: 1
publish-coverage-report:
name: Publish Coverage Report
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: test
permissions:
id-token: write
pages: write
steps:
- uses: actions/checkout@v4
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: coverage
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
tics-report:
name: TICS Report
runs-on: ubuntu-latest
needs: test
steps:
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: .coverage
- name: Display structure of downloaded files
run: ls -R .coverage
- uses: actions/checkout@v4
- name: Run TICS Analyzer
uses: tiobe/tics-github-action@v3
with:
# Use 'qserver' for push to main branch, 'client' for others. See: https://github.com/tiobe/tics-github-action?tab=readme-ov-file#client-default
mode: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'qserver' || 'client' }}
project: maas-ui
viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
installTics: true
tmpdir: /tmp/tics
branchdir: ${{ github.workspace }}
- name: Upload TICS Report
if: always()
uses: actions/upload-artifact@v4
with:
name: tics-report
path: /tmp/tics
retention-days: 7
build:
name: Build
timeout-minutes: 15
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: CYPRESS_INSTALL_BINARY=0 yarn install
- name: Build assets
run: yarn build
- name: Serve build
run: yarn serve --host --port=8400 --base=/ &
- name: Wait for UI to be ready
run: yarn wait-on-ui