Skip to content

Commit ed6b9ee

Browse files
committed
ci(sizes): Sites test between master and 2.x branch
1 parent c16a325 commit ed6b9ee

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Sizes Results (master-v2.x)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
# It's convenient to set variables for values used multiple times in the workflow
8+
SKETCHES_REPORTS_PATH: artifacts/sizes-report
9+
RESULT_SIZES_TEST_FILE: SIZES_TEST.md
10+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
11+
12+
jobs:
13+
sizes-test-results:
14+
name: Sizes Comparsion Results
15+
runs-on: ubuntu-latest
16+
if: |
17+
github.event.workflow_run.event == 'pull_request' &&
18+
github.event.workflow_run.conclusion == 'success'
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4 # This step checks out the repository's code at gh-pages branch
23+
with:
24+
ref: gh-pages
25+
26+
- name: Create folder structure
27+
run: |
28+
mkdir -p artifacts && cd artifacts
29+
mkdir -p sizes-report
30+
mkdir -p sizes-report/master
31+
mkdir -p sizes-report/pr
32+
33+
# master folder is a base for comparison
34+
# pr folder is for comparison with master
35+
- name: Download JSON file
36+
run: |
37+
mv master_cli_compile/*.json artifacts/sizes-report/pr/
38+
mv v2.x_cli_compile/*.json artifacts/sizes-report/master/
39+
40+
- name: Report results
41+
uses: P-R-O-C-H-Y/report-size-deltas@sizes_v2
42+
with:
43+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
44+
github-token: ${{ env.GITHUB_TOKEN }}
45+
destination-file: ${{ env.RESULT_SIZES_TEST_FILE }}
46+
47+
- name: Append file with action URL
48+
run:
49+
echo "/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" >> ${{ env.RESULT_SIZES_TEST_FILE }}
50+
51+
- name: Push to github repo
52+
run: |
53+
git config user.name github-actions
54+
git config user.email github-actions@github.com
55+
git add ${{ env.RESULT_SIZES_TEST_FILE }}
56+
git commit -m "Generated Sizes Results (master-v2.x)"
57+
git push origin HEAD:gh-pages

0 commit comments

Comments
 (0)