-
Notifications
You must be signed in to change notification settings - Fork 13
194 lines (164 loc) · 7.56 KB
/
plotlyTestCoverage.yml
File metadata and controls
194 lines (164 loc) · 7.56 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: "Plotly Test coverage"
on:
schedule:
- cron: "30 5 * * *" # Runs every day at 11:00 AM IST (05:30 AM UTC)
- cron: "30 10 * * *" # Runs every day at 4:00 PM IST (10:30 AM UTC)
workflow_dispatch:
inputs:
repo:
description: "Repo to run the tests on"
required: true
default: "microsoft/fluentui"
branch:
description: "Branch to run the tests on"
required: true
default: "master"
permissions:
contents: write
pages: write
id-token: write
jobs:
run_tests:
strategy:
matrix:
os: [windows-latest]
runs-on: ${{ matrix.os }}
outputs:
test_coverage: ${{ steps.run_tests.outputs }}
windows_artifact_name: ${{ steps.windows.outputs.COVERAGE_FILENAME_WINDOWS }}
steps:
- name: Enable Git long paths
run: git config --global core.longpaths true
- name: Checkout [react-charting]
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repo || 'microsoft/fluentui'}}
ref: ${{ github.event.inputs.branch || 'master'}}
path: repo1
- name: Display Input Repo and Branch in Summary
shell: pwsh
run: |
echo "### Workflow Inputs" >> $env:GITHUB_STEP_SUMMARY
echo "- **Repository**: ${{ github.event.inputs.repo }}" >> $env:GITHUB_STEP_SUMMARY
echo "- **Branch**: ${{ github.event.inputs.branch }}" >> $env:GITHUB_STEP_SUMMARY
- name: Show current directory
run: echo "$PWD" && ls
- name: Show repo1 repository
run: ls ./repo1
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install packages
run: |
cd ./repo1
yarn
- name: Build
run: |
cd ./repo1
yarn nx run react-charting:build
- name: Run yarn pack in chart-utilities to create .tgz file
run: |
cd ./repo1/packages/charts/chart-utilities
yarn pack --filename chart-utilities.tgz
id: pack-util
- name: Run yarn pack in react-charting to create .tgz file
run: |
cd ./repo1/packages/charts/react-charting
yarn pack --filename react-charting.tgz
id: pack-chart-v8
- name: Upload chart-utilities.tgz as artifact
uses: actions/upload-artifact@v4
with:
name: chart-utilities-tgz
path: ./repo1/packages/charts/chart-utilities/chart-utilities.tgz
- name: Upload react-charting.tgz as artifact
uses: actions/upload-artifact@v4
with:
name: react-charting-tgz
path: ./repo1/packages/charts/react-charting/react-charting.tgz
- name: Checkout [main] of current repo
uses: actions/checkout@v4
with:
path: contrib_repo
- name: Add chart-utils package to resolutions block
run: |
cd contrib_repo/apps/plotly_examples
npx json -I -f package.json -e "this.resolutions = this.resolutions || {}; this.resolutions['@fluentui/chart-utilities'] = 'file:../../../repo1/packages/charts/chart-utilities/chart-utilities.tgz';"
- name: Install .tgz file in Plotly examples
run: |
cd contrib_repo/apps/plotly_examples
yarn add ../../../repo1/packages/charts/react-charting/react-charting.tgz
yarn
- name: Start test app in background
shell: bash
run: |
cd contrib_repo/apps/plotly_examples
yarn build
nohup npx -y serve -s build -l 3000 > output.log 2>&1 &
npx wait-on http://localhost:3000/ --timeout 300000
- name: Run Playwright test script
run: |
cd contrib_repo/apps/plotly_examples
npx playwright install
npx cross-env BASE_URL='http://localhost:3000/' npx playwright test tests/DeclarativeChart.spec.ts || true
continue-on-error: true
- name: Zip Playwright report
shell: pwsh
run: |
cd contrib_repo/apps/plotly_examples
Compress-Archive -Path playwright-report -DestinationPath playwright-report.zip
- name: Compute number of total tests and failures
uses: ./contrib_repo/.github/actions/playwright_metrics
with:
current_report: contrib_repo/apps/plotly_examples/playwright-report.json
baseline_report: contrib_repo/apps/plotly_examples/reports/playwright-report-v8.json
- name: Upload Playwright HTML report as artifact
uses: actions/upload-artifact@v4
with:
name: playwright-html-report
path: contrib_repo/apps/plotly_examples/playwright-report/
- name: Upload Playwright JSON report as artifact
uses: actions/upload-artifact@v4
with:
name: playwright-json-report
path: contrib_repo/apps/plotly_examples/playwright-report.json
- name: Move Playwright JSON report to reports folder for scheduled runs
if: github.event_name == 'schedule'
shell: bash
run: |
cd contrib_repo/apps/plotly_examples
mv playwright-report.json reports/playwright-report-v8.json
git add reports/playwright-report-v8.json
- name: "Run monosize on react-charting"
run: |
cd repo1/packages/charts/react-charting
yarn monosize measure
- name: Upload monosize JSON report as artifact
uses: actions/upload-artifact@v4
with:
name: monosize-report
path: repo1/packages/charts/react-charting/dist/bundle-size/monosize.json
- name: Create branch name for scheduled report
if: github.event_name == 'schedule'
id: branch
shell: bash
run: |
BRANCH="playwright-report-v8-$(date +'%Y%m%d-%H%M%S')"
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Commit and push v8 scheduled report
if: github.event_name == 'schedule'
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ steps.branch.outputs.branch }}
create_branch: true
commit_message: "chore: (auto) Update v8 playwright report"
file_pattern: apps/plotly_examples/reports/playwright-report-v8.json
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
repository: contrib_repo
- name: "Publish Notification for scheduled report commit"
if: github.event_name == 'schedule' && steps.auto-commit-action.outputs.changes_detected == 'true'
shell: bash
run: |
echo "v8 Playwright report committed. [Create a pull request](https://github.com/${{ github.repository }}/pull/new/${{ steps.branch.outputs.branch }})" >> $GITHUB_STEP_SUMMARY