-
Notifications
You must be signed in to change notification settings - Fork 62
181 lines (179 loc) · 8.17 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
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
name: Conformance Test Report Generation
on: [push, pull_request]
env:
LEGACY_VERSION: v0.14.8
CONFORMANCE_REPORT_NAME: conformance_test_results.ion
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: 8.7
# 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 }}/${{ env.CONFORMANCE_REPORT_RELATIVE_PATH }}
# 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: 8.7
- name: Download `conformance_test_results.ion` from target branch
uses: dawidd6/action-download-artifact@v6
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
- name: "Artifact CROSS-ENGINE Report (creates comparison_report.md)"
continue-on-error: true
run: |
T="CROSS-ENGINE-REPORT"
BF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/src/main/resources/config/legacy/$CONFORMANCE_REPORT_NAME"
BL="LEGACY"
BT="$LEGACY_VERSION"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O"
gradle :test:partiql-tests-runner:run --args="$ARGS"
- name: "Artifact CROSS-COMMIT Report (appends to comparison_report.md)"
continue-on-error: true
run: |
T="CROSS-COMMIT-REPORT"
BF="$GITHUB_WORKSPACE/artifact/eval/$CONFORMANCE_REPORT_NAME"
BL="EVAL"
BT="${{ github.event.pull_request.base.sha }}"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O"
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
- name: "Comment CROSS-ENGINE Report (creates comparison_report_limited.md)"
continue-on-error: true
run: |
T="CROSS-ENGINE-REPORT"
BF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/src/main/resources/config/legacy/$CONFORMANCE_REPORT_NAME"
BL="LEGACY"
BT="$LEGACY_VERSION"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME_WITH_LIMIT"
L="$COMMENT_SIZE_LIMIT"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O -l $L"
gradle :test:partiql-tests-runner:run --args="$ARGS"
- name: "Comment CROSS-COMMIT Report (appends to comparison_report_limited.md)"
continue-on-error: true
run: |
T="CROSS-COMMIT-REPORT"
BF="$GITHUB_WORKSPACE/artifact/eval/$CONFORMANCE_REPORT_NAME"
BL="EVAL"
BT="${{ github.event.pull_request.base.sha }}"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME_WITH_LIMIT"
L="$COMMENT_SIZE_LIMIT"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O -l $L"
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: CROSS-ENGINE-REPORT
# 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