Merge pull request #1523 from johnedquinn/v1-functions-missing #3256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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 }}/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: 8.7 | |
- 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 |