Skip to content

Commit 542649a

Browse files
committed
Upload test sketches report workflow artifact
This sketches report artifact is used to get test size deltas reports.
1 parent 45844ce commit 542649a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Upload test sketches report artifact
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
# The "labeled" event can be used to easily retrigger the workflow to restore the workflow artifact after it
9+
# expires every 90 days.
10+
- labeled
11+
12+
jobs:
13+
upload:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
20+
# The action only does a deltas report when the sketches report's `commit_hash` value matches the PR head SHA
21+
- name: Update commit hash in reports
22+
run: |
23+
# Set up dedicated folder for the updated sketches reports (it's not possible to modify them in place)
24+
SKETCHES_REPORTS_PATH="${{ runner.temp }}/sketches-reports"
25+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
26+
echo "SKETCHES_REPORTS_PATH=$SKETCHES_REPORTS_PATH" >> "$GITHUB_ENV"
27+
mkdir --parents "$SKETCHES_REPORTS_PATH"
28+
29+
cd "${{ github.workspace }}/.github/workflows/testdata/sketches-reports/"
30+
for reportFile in *.json; do
31+
jq '.commit_hash = "${{ github.event.pull_request.head.sha }}"' "$reportFile" > "${SKETCHES_REPORTS_PATH}/$reportFile"
32+
done
33+
34+
- name: Save sketches report as workflow artifact
35+
uses: actions/upload-artifact@v2
36+
with:
37+
if-no-files-found: error
38+
path: ${{ env.SKETCHES_REPORTS_PATH }}
39+
name: sketches-reports

0 commit comments

Comments
 (0)