diff --git a/.github/workflows/PR-content-check.yml b/.github/workflows/PR-content-check.yml new file mode 100644 index 0000000000..a4e8fe0e0c --- /dev/null +++ b/.github/workflows/PR-content-check.yml @@ -0,0 +1,31 @@ +# 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: + workflow_call: + outputs: + result: + description: "The first output string" + value: ${{ jobs.check-PR-content.outputs.output1 }} + +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 diff --git a/.github/workflows/ion-java-performance-regression-detector.yml b/.github/workflows/ion-java-performance-regression-detector.yml index 277ccff505..469d9c09b7 100644 --- a/.github/workflows/ion-java-performance-regression-detector.yml +++ b/.github/workflows/ion-java-performance-regression-detector.yml @@ -3,12 +3,18 @@ name: Ion Java performance regression detector -on: [pull_request] +on: + pull_request jobs: + PR-Content-Check: + uses: linlin-s/ion-java/.github/workflows/PR-content-check.yml@master detect-regression: name: Detect Regression - + needs: PR-Content-Check + if: ${{ needs.PR-Content-Check.outputs.result == 'pass' }} + outputs: + output1: ${{ steps.regression_result.outputs.result }} runs-on: ubuntu-latest steps: @@ -18,7 +24,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 +33,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 +76,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 @@ -116,7 +122,7 @@ jobs: run: | result=true cd benchmarkResults && for FILE in *; do message=$(java -jar /home/runner/work/ion-java/ion-java/ion-java-benchmark-cli/target/ion-java-benchmark-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar compare --benchmark-result-previous $FILE/previous.ion --benchmark-result-new $FILE/new.ion $FILE/report.ion | tee /dev/stderr) && if [ "$message" != "no regression detected" ]; then result=false; fi; done - echo "::set-output name=regression-result::$result" + echo "regression-result=$result" >> $GITHUB_OUTPUT if [ "$result" = "true" ]; then echo "No regression detected!" >> $GITHUB_STEP_SUMMARY; fi - name: Upload comparison reports to the benchmark results directory @@ -131,4 +137,4 @@ jobs: if: ${{ env.regression_detect == 'false' }} run: | cd benchmarkResults && echo "| Benchmark command | GC Allocation Rate | Heap Usage | Speed |" >> $GITHUB_STEP_SUMMARY && echo "| ----------- | ----------- |----------- | ----------- |" >> $GITHUB_STEP_SUMMARY && for FILE in *; do regressionDetection=$(java -jar /home/runner/work/ion-java/ion-java/ion-java-benchmark-cli/target/ion-java-benchmark-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar compare --benchmark-result-previous $FILE/previous.ion --benchmark-result-new $FILE/new.ion $FILE/report.ion) && if [ "$regressionDetection" != "no regression detected" ]; then command=$(echo $FILE | sed "s/_/ /g") && read gc heapUsage speed <<< $( echo ${regressionDetection} | awk -F", " '{print $1" "$2" "$3}' ) && echo "|$command|$gc|$heapUsage|$speed|" >> $GITHUB_STEP_SUMMARY; fi; done - exit 1 \ No newline at end of file + exit 1 diff --git a/.github/workflows/ion-test-driver.yml b/.github/workflows/ion-test-driver.yml index e39846aed3..002902356b 100644 --- a/.github/workflows/ion-test-driver.yml +++ b/.github/workflows/ion-test-driver.yml @@ -1,10 +1,15 @@ name: ion-test-driver -on: [pull_request] +on: + pull_request jobs: + PR-Content-Check: + uses: linlin-s/ion-java/.github/workflows/PR-content-check.yml@master ion-test-driver: runs-on: macos-10.15 + needs: PR-Content-Check + if: ${{ needs.PR-Content-Check.outputs.result == 'pass' }} steps: - name: Checkout ion-java uses: actions/checkout@master @@ -13,6 +18,7 @@ jobs: ref: master path: ion-java + - name: Checkout ion-test-driver uses: actions/checkout@master with: diff --git a/src/com/amazon/ion/apps/EncodeApp.java b/src/com/amazon/ion/apps/EncodeApp.java index 40045b6d43..4c7c0d06d9 100644 --- a/src/com/amazon/ion/apps/EncodeApp.java +++ b/src/com/amazon/ion/apps/EncodeApp.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.ArrayList; - public class EncodeApp extends BaseApp {