From dc50ee618b352d361d953a49a47f7c81fbe94bba Mon Sep 17 00:00:00 2001 From: Linlin Sun Date: Thu, 12 Jan 2023 15:06:11 -0800 Subject: [PATCH 1/3] 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 ae6e3b668b..5981ab6ec6 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: amazon-ion/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: amazon-ion/ion-java ref: master From ed0ca3f4d4f95f93d5f0ce0caf4744e3019986fc Mon Sep 17 00:00:00 2001 From: Linlin Sun Date: Tue, 17 Jan 2023 10:43:38 -0800 Subject: [PATCH 2/3] Apply PR-content-check to ion-test-driver workflow. --- .github/workflows/PR-content-check.yml | 26 ++++++++++++++++ ...n-java-performance-regression-detector.yml | 30 ++++--------------- .github/workflows/ion-test-driver.yml | 7 ++++- 3 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/PR-content-check.yml diff --git a/.github/workflows/PR-content-check.yml b/.github/workflows/PR-content-check.yml new file mode 100644 index 0000000000..382d48850d --- /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 \ No newline at end of file diff --git a/.github/workflows/ion-java-performance-regression-detector.yml b/.github/workflows/ion-java-performance-regression-detector.yml index 5981ab6ec6..baee64393a 100644 --- a/.github/workflows/ion-java-performance-regression-detector.yml +++ b/.github/workflows/ion-java-performance-regression-detector.yml @@ -3,35 +3,17 @@ 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' }} + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/ion-test-driver.yml b/.github/workflows/ion-test-driver.yml index c7b166b8e0..ab76601968 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: + 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 From 51f657b251991f15ed927f17b8a46abf45017288 Mon Sep 17 00:00:00 2001 From: Linlin Sun Date: Fri, 20 Jan 2023 00:15:10 -0800 Subject: [PATCH 3/3] Update workflows to avoid failing PR-content-check workflow. Update the trigger events of ion-test-driver and ion-java-performance-regression-detection workflows. Update the output of PR-content-check. --- .github/workflows/PR-content-check.yml | 12 ++++++++++-- .../ion-java-performance-regression-detector.yml | 13 ++++++------- .github/workflows/ion-test-driver.yml | 12 ++++++------ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.github/workflows/PR-content-check.yml b/.github/workflows/PR-content-check.yml index 382d48850d..eb2c624155 100644 --- a/.github/workflows/PR-content-check.yml +++ b/.github/workflows/PR-content-check.yml @@ -3,7 +3,12 @@ name: PR Content Check -on: [pull_request] +on: + workflow_call: + outputs: + result: + description: "The result of PR content check" + value: ${{ jobs.check-PR-content.outputs.output1 }} jobs: check-PR-content: @@ -11,6 +16,9 @@ jobs: runs-on: ubuntu-latest + outputs: + output1: ${{ steps.check-content.outputs.result }} + steps: - name: Checkout the incoming pull request uses: actions/checkout@v3 @@ -23,4 +31,4 @@ jobs: id: check-content run: | cd ion-java-new - if [[ $(git log -1 --name-only) == *"src/"* ]]; then echo "result=pass"; else exit 1; fi \ No newline at end of file + 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 baee64393a..fe19e59f9a 100644 --- a/.github/workflows/ion-java-performance-regression-detector.yml +++ b/.github/workflows/ion-java-performance-regression-detector.yml @@ -3,17 +3,16 @@ name: Ion Java performance regression detector -on: - workflow_run: - workflows: [ PR Content Check ] - types: - - completed +on: [pull_request] jobs: + PR-Content-Check: + uses: amazon-ion/ion-java/.github/workflows/PR-content-check.yml@master + detect-regression: name: Detect Regression - needs: check-PR-content - if: ${{ github.event.workflow_run.conclusion == 'success' }} + needs: PR-Content-Check + if: ${{ needs.PR-Content-Check.outputs.result == 'pass' }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/ion-test-driver.yml b/.github/workflows/ion-test-driver.yml index ab76601968..8c899374f2 100644 --- a/.github/workflows/ion-test-driver.yml +++ b/.github/workflows/ion-test-driver.yml @@ -1,15 +1,15 @@ name: ion-test-driver -on: - workflow_run: - workflows: [ PR Content Check ] - types: - - completed +on: [pull_request] jobs: + PR-Content-Check: + uses: amazon-ion/ion-java/.github/workflows/PR-content-check.yml@master + ion-test-driver: runs-on: macos-10.15 - if: ${{ github.event.workflow_run.conclusion == 'success' }} + needs: PR-Content-Check + if: ${{ needs.PR-Content-Check.outputs.result == 'pass' }} steps: - name: Checkout ion-java uses: actions/checkout@master