From 267cf79abaef93ef121994ba44ca21ef1b2d924c Mon Sep 17 00:00:00 2001 From: Linlin Sun Date: Thu, 12 Jan 2023 15:06:11 -0800 Subject: [PATCH 1/2] Add extra step to check if there is any source code changed in the incoming pull request. Signed-off-by: Linlin Sun --- ...n-java-performance-regression-detector.yml | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ion-java-performance-regression-detector.yml b/.github/workflows/ion-java-performance-regression-detector.yml index 277ccff505..de943f25ee 100644 --- a/.github/workflows/ion-java-performance-regression-detector.yml +++ b/.github/workflows/ion-java-performance-regression-detector.yml @@ -6,9 +6,32 @@ name: Ion Java performance regression detector on: [pull_request] jobs: + check-PR-content: + name: Check PR Content + + runs-on: ubuntu-latest + + outputs: + output1: ${{ steps.check-content.outputs.result }} + + steps: + - name: Checkout the incoming pull request + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + path: ion-java-new + + - name: Check the content of the last commit + id: check-content + run: | + cd ion-java-new + if [[ $(git log -1 --name-only) == *"src/"* ]]; then echo "result=pass" >> $GITHUB_OUTPUT; else echo "result=fail" >> $GITHUB_OUTPUT; fi + detect-regression: name: Detect Regression - + needs: check-PR-content + if: ${{ needs.check-PR-content.outputs.output1 == 'pass' }} runs-on: ubuntu-latest steps: @@ -18,7 +41,7 @@ jobs: java-version: 1.8 - name: Checkout ion-java from the new commit. - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} path: ion-java-new @@ -27,7 +50,7 @@ jobs: run: cd ion-java-new && git submodule init && git submodule update && ./gradlew clean publishToMavenLocal - name: Checkout ion-java-benchmark-cli - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: amzn/ion-java-benchmark-cli ref: master @@ -70,7 +93,7 @@ jobs: run : rm -r /home/runner/.m2 - name: Checkout the current commit - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: amzn/ion-java ref: master From c6eaa9c736cec5a03d9051de9cd90e78fa645f9e Mon Sep 17 00:00:00 2001 From: Linlin Sun Date: Fri, 13 Jan 2023 17:28:00 -0800 Subject: [PATCH 2/2] Add PR content check to ion-test-driver workflow. --- ...n-java-performance-regression-detector.yml | 32 ++++--------------- .github/workflows/ion-test-driver.yml | 8 +++-- .github/workflows/pr-content-check.yml | 26 +++++++++++++++ .../ion/impl/_Private_ByteTransferReader.java | 2 +- 4 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/pr-content-check.yml diff --git a/.github/workflows/ion-java-performance-regression-detector.yml b/.github/workflows/ion-java-performance-regression-detector.yml index de943f25ee..7e179f113d 100644 --- a/.github/workflows/ion-java-performance-regression-detector.yml +++ b/.github/workflows/ion-java-performance-regression-detector.yml @@ -3,36 +3,16 @@ name: Ion Java performance regression detector -on: [pull_request] - +on: + workflow_run: + workflows: [ PR Content Check ] + types: + - completed jobs: - check-PR-content: - name: Check PR Content - - runs-on: ubuntu-latest - - outputs: - output1: ${{ steps.check-content.outputs.result }} - - steps: - - name: Checkout the incoming pull request - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - path: ion-java-new - - - name: Check the content of the last commit - id: check-content - run: | - cd ion-java-new - if [[ $(git log -1 --name-only) == *"src/"* ]]; then echo "result=pass" >> $GITHUB_OUTPUT; else echo "result=fail" >> $GITHUB_OUTPUT; fi - detect-regression: name: Detect Regression - needs: check-PR-content - if: ${{ needs.check-PR-content.outputs.output1 == 'pass' }} runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Set up JDK 1.8 diff --git a/.github/workflows/ion-test-driver.yml b/.github/workflows/ion-test-driver.yml index e39846aed3..40af32fafe 100644 --- a/.github/workflows/ion-test-driver.yml +++ b/.github/workflows/ion-test-driver.yml @@ -1,10 +1,14 @@ name: ion-test-driver -on: [pull_request] - +on: + workflow_run: + workflows: [ PR Content Check ] + types: + - completed jobs: ion-test-driver: runs-on: macos-10.15 + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout ion-java uses: actions/checkout@master diff --git a/.github/workflows/pr-content-check.yml b/.github/workflows/pr-content-check.yml new file mode 100644 index 0000000000..1c70e463f4 --- /dev/null +++ b/.github/workflows/pr-content-check.yml @@ -0,0 +1,26 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: PR Content Check + +on: [pull_request] + +jobs: + check-PR-content: + name: Check PR Content + + runs-on: ubuntu-latest + + steps: + - name: Checkout the incoming pull request + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + path: ion-java-new + + - name: Check the content of the last commit + id: check-content + run: | + cd ion-java-new + if [[ $(git log -1 --name-only) == *"src/"* ]]; then echo "result=pass"; else exit 1; fi diff --git a/src/com/amazon/ion/impl/_Private_ByteTransferReader.java b/src/com/amazon/ion/impl/_Private_ByteTransferReader.java index b1b9d95d35..7e7bc8428c 100644 --- a/src/com/amazon/ion/impl/_Private_ByteTransferReader.java +++ b/src/com/amazon/ion/impl/_Private_ByteTransferReader.java @@ -17,7 +17,7 @@ import com.amazon.ion.IonReader; import java.io.IOException; - +// Test only /** * An {@link IonReader} {@linkplain com.amazon.ion.facet facet} that can rapidly bulk-copy * Ion binary data under certain circumstances.