-
Notifications
You must be signed in to change notification settings - Fork 62
137 lines (135 loc) · 6.26 KB
/
conformance-report.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
name: Conformance Test Report Generation
on: [push, pull_request]
env:
PATH_TO_TEST_RUNNER: test/partiql-tests-runner
CONFORMANCE_REPORT_RELATIVE_PATH: build/conformance-test-report
COMPARISON_REPORT_NAME: comparison_report.md
COMPARISON_REPORT_NAME_WITH_LIMIT: comparison_report_limited.md
COMMENT_SIZE_LIMIT: 10
jobs:
conformance-report:
name: Create conformance report for `push` and `pull_request` events
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Use Java 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
# Fix gradle version to what's used in gradle-wrapper
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.5.1
# Run the conformance tests and save to an Ion file.
- name: gradle test of the conformance tests (can fail) and save to Ion file
continue-on-error: true
run: gradle :test:partiql-tests-runner:generateTestReport
# Upload conformance report for future viewing and comparison with future runs.
- name: Upload `conformance-test-report` folder
uses: actions/upload-artifact@v3
with:
path: ${{ env.PATH_TO_TEST_RUNNER }}/build/conformance-test-report
# Cache the conformance report for `conformance-report-comparison` job (pull_request event only)
- name: Cache conformance report and build
if: github.event_name == 'pull_request'
uses: actions/cache@v3
id: restore-build-and-conformance
with:
path: ./*
key: ${{ github.sha }}-conformance-report
conformance-report-comparison:
name: Create comparison report for `pull_request` event
runs-on: ubuntu-latest
needs: [ conformance-report ]
if: github.event_name == 'pull_request'
steps:
# Pull down cached `gradle build` and conformance report
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v3
id: restore-build-and-conformance
with:
path: ./*
key: ${{ github.sha }}-conformance-report
- name: Use Java 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
# Fix gradle version to what's used in gradle-wrapper
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.5.1
- name: Download `conformance_test_results.ion` from target branch
uses: dawidd6/action-download-artifact@v2
id: download-report
continue-on-error: true
with:
workflow: conformance-report.yml
commit: ${{ github.event.pull_request.base.sha }}
# (If download of target branch report fails) Run the conformance tests (i.e. `gradle test`) and save to an Ion file.
- name: (If download of target branch conformance report fails) Checkout target branch
uses: actions/checkout@v3
if: ${{ steps.download-report.outcome == 'failure' }}
with:
submodules: recursive
path: ${{ github.event.pull_request.base.sha }}
ref: ${{ github.event.pull_request.base.sha }}
- name: (If download of target branch conformance report fails) Generate conformance test report for target branch
if: ${{ steps.download-report.outcome == 'failure' }}
continue-on-error: true
run: |
cd ${{ github.event.pull_request.base.sha }}
gradle :test:partiql-tests-runner:generateTestReport
- name: (If download of target branch conformance report fails) Move conformance test report of target branch to ./artifact directory
if: ${{ steps.download-report.outcome == 'failure' }}
continue-on-error: true
run: |
mkdir -p $GITHUB_WORKSPACE/artifact
cp -r $GITHUB_WORKSPACE/${{ github.event.pull_request.base.sha }}/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH $GITHUB_WORKSPACE/artifact/$CONFORMANCE_REPORT_RELATIVE_PATH
# Run conformance report comparison. Generates `comparison_report.md`
- name: Run conformance report comparison for artifact. Generates `comparison_report.md`
continue-on-error: true
run: |
ARGS="$GITHUB_WORKSPACE/artifact $CONFORMANCE_REPORT_RELATIVE_PATH ${{ github.event.pull_request.base.sha }} $GITHUB_SHA $COMPARISON_REPORT_NAME"
gradle :test:partiql-tests-runner:run --args="$ARGS"
# Print conformance report to GitHub actions workflow summary page
- name: Print markdown in run
continue-on-error: true
run: cat $PATH_TO_TEST_RUNNER/$COMPARISON_REPORT_NAME >> $GITHUB_STEP_SUMMARY
# Upload the full comparison report to CI artifact
- name: Upload `comparison_report.md`
uses: actions/upload-artifact@v3
with:
path: ${{ env.PATH_TO_TEST_RUNNER }}/comparison_report.md
# Rebuild the test report with a size limit for comment
- name: Run conformance report comparison for comment. Generates `comparison_report_limited.md`
continue-on-error: true
run: |
ARGS="$GITHUB_WORKSPACE/artifact $CONFORMANCE_REPORT_RELATIVE_PATH ${{ github.event.pull_request.base.sha }} $GITHUB_SHA $COMPARISON_REPORT_NAME_WITH_LIMIT $COMMENT_SIZE_LIMIT"
gradle :test:partiql-tests-runner:run --args="$ARGS"
# Find comment w/ conformance comparison if previous comment published
- name: Find Comment
uses: peter-evans/find-comment@v2
continue-on-error: true
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Conformance
# Create or update (if previous comment exists) with markdown version of comparison report
- name: Create or update comment
continue-on-error: true
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body-file: ${{ env.PATH_TO_TEST_RUNNER }}/${{ env.COMPARISON_REPORT_NAME_WITH_LIMIT }}
edit-mode: replace