-
Notifications
You must be signed in to change notification settings - Fork 1.9k
171 lines (151 loc) · 5.77 KB
/
frontend.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Frontend Tests & Coverage
on:
push:
branches: [develop]
pull_request:
branches: [develop]
paths:
- "frontend/taipy-gui/**"
workflow_dispatch:
permissions:
# Required to checkout the code
checks: write
# Required to put a comment into the pull-request
pull-requests: write
env:
NODE_OPTIONS: --max-old-space-size=4096
jobs:
frontend-jest:
timeout-minutes: 20
strategy:
matrix:
node-version: [20.x]
os: [ubuntu-latest, windows-latest, macos-13]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./frontend/taipy-gui
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: npm test with node ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Hash taipy-gui source code
id: hash-gui-fe
working-directory: ./
run: |
python tools/frontend/hash_source.py --taipy-gui-only
echo "HASH=$(cat hash.txt)" >> $GITHUB_OUTPUT
rm hash.txt
shell: bash
- name: Restore cached frontend build
id: cache-gui-fe-build
uses: actions/cache@v4
with:
path: taipy/gui/webapp
key: taipy-gui-frontend-build-${{ runner.os }}-${{ steps.hash-gui-fe.outputs.HASH }}
- name: Install dom dependencies
if: steps.cache-gui-fe-build.outputs.cache-hit != 'true'
working-directory: ./frontend/taipy-gui/dom
run: npm ci
- name: Install dependencies
if: steps.cache-gui-fe-build.outputs.cache-hit != 'true'
run: npm ci
- name: Test Gui
if: steps.cache-gui-fe-build.outputs.cache-hit != 'true'
run: npm test
- name: Code coverage
if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name
uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
threshold: "80"
working-directory: "./frontend/taipy-gui"
skip-step: install
annotations: failed-tests
# use if you want to avoid errors on the base branch coverage (ie no coverage and no comparison but as it fails anyway as it uses npm install)
# base-coverage-file: ./report.json
frontend-core-jest:
timeout-minutes: 20
strategy:
matrix:
node-version: [20.x]
os: [ubuntu-latest, windows-latest, macos-13]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./frontend/taipy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: npm build and test with node ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Hash taipy gui source code
id: hash-gui-fe
working-directory: ./
run: |
python tools/frontend/hash_source.py --taipy-gui-only
echo "HASH=$(cat hash.txt)" >> $GITHUB_OUTPUT
rm hash.txt
shell: bash
- name: Restore cached frontend build
id: cache-gui-fe-build
uses: actions/cache@v4
with:
path: taipy/gui/webapp
key: taipy-gui-frontend-build-${{ runner.os }}-${{ steps.hash-gui-fe.outputs.HASH }}
- name: Hash taipy gui core source code
id: hash-gui-core-fe
working-directory: ./
run: |
python tools/frontend/hash_source.py --taipy-gui-core-only
echo "HASH=$(cat hash.txt)" >> $GITHUB_OUTPUT
rm hash.txt
shell: bash
- name: Restore cached core frontend build
id: cache-gui-core-fe-build
uses: actions/cache@v4
with:
path: taipy/gui_core/lib
key: taipy-gui-core-frontend-build-${{ runner.os }}-${{ steps.hash-gui-core-fe.outputs.HASH }}
- name: Taipy-gui Install dom dependencies
if: steps.cache-gui-fe-build.outputs.cache-hit != 'true'
working-directory: ./frontend/taipy-gui/dom
run: npm ci
- name: Install Taipy-gui dependencies
if: steps.cache-gui-fe-build.outputs.cache-hit != 'true'
working-directory: ./frontend/taipy-gui
run: npm ci
- name: Build Taipy-gui
if: steps.cache-gui-fe-build.outputs.cache-hit != 'true'
working-directory: ./frontend/taipy-gui
run: npm run build
- name: Install dependencies
if: steps.cache-gui-core-fe-build.outputs.cache-hit != 'true'
run: npm ci
- name: Test Taipy
if: steps.cache-gui-core-fe-build.outputs.cache-hit != 'true'
run: npm test
- name: Code coverage
if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.cache-gui-core-fe-build.outputs.cache-hit != 'true' && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name
uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
threshold: "80"
working-directory: "./frontend/taipy"
skip-step: install
annotations: failed-tests
# use if you want to avoid errors on the base branch coverage (ie no coverage and no comparison but as it fails anyway as it uses npm install)
# base-coverage-file: ./report.json