Skip to content

Commit

Permalink
[Backport 1.3] Backport gradle check updates to 1.3 branch. (#3780)
Browse files Browse the repository at this point in the history
* [Backport 1.x] Add gradle check test for github workflows (Testing again) (#3724)

* [Backport 1.x] Add gradle check test for github workflows (Testing again)

* [Backport 1.x] Add gradle check test for github workflows (Testing again)

Signed-off-by: Peter Zhu <[email protected]>

* Remove linter

Signed-off-by: Peter Zhu <[email protected]>

* Update github action gradle-check to use pull_request_target for accessing token (#3728) (#3730)

* Check out gradle

Signed-off-by: Peter Zhu <[email protected]>

* Tweak titles

Signed-off-by: Peter Zhu <[email protected]>
(cherry picked from commit 4f7bf08)

Co-authored-by: Peter Zhu <[email protected]>

* Move gradle-check code to its own scripts and upload codecov (#3742) (#3744)

* Move gradle-check to script, add codecov, add comments

Signed-off-by: Peter Zhu <[email protected]>

* Add more improvements on comments handling

Signed-off-by: Peter Zhu <[email protected]>

* Add more comments

Signed-off-by: Peter Zhu <[email protected]>
(cherry picked from commit 3681ac7)

Co-authored-by: Peter Zhu <[email protected]>

Co-authored-by: Peter Zhu <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 6, 2022
1 parent d57e8f0 commit 16cc502
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
65 changes: 65 additions & 0 deletions .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Gradle Check (Jenkins)
on:
pull_request_target:
types: [opened, synchronize, reopened]

jobs:
gradle-check:
runs-on: ubuntu-latest
timeout-minutes: 130
steps:
- name: Setup environment variables
run: |
echo "pr_from_sha=$(jq --raw-output .pull_request.head.sha $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_from_clone_url=$(jq --raw-output .pull_request.head.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_to_clone_url=$(jq --raw-output .pull_request.base.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_title=$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
- name: Checkout opensearch-build repo
uses: actions/checkout@v2
with:
repository: opensearch-project/opensearch-build
ref: main

- name: Trigger jenkins workflow to run gradle check
run: |
set -e
set -o pipefail
bash scripts/gradle/gradle-check.sh ${{ secrets.JENKINS_GRADLE_CHECK_GENERIC_WEBHOOK_TOKEN }} | tee -a gradle-check.log
- name: Setup Result Status
if: always()
run: |
WORKFLOW_URL=`cat gradle-check.log | grep 'WORKFLOW_URL' | awk '{print $2}'`
RESULT=`cat gradle-check.log | grep 'Result:' | awk '{print $2}'`
echo "workflow_url=$WORKFLOW_URL" >> $GITHUB_ENV
echo "result=$RESULT" >> $GITHUB_ENV
- name: Upload Coverage Report
if: success()
uses: codecov/codecov-action@v2
with:
files: ./codeCoverage.xml

- name: Create Comment Success
if: success()
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ env.pr_number }}
body: |
### Gradle Check (Jenkins) Run Completed with:
* **RESULT:** ${{ env.result }} :white_check_mark:
* **URL:** ${{ env.workflow_url }}
* **CommitID:** ${{ env.pr_from_sha }}
- name: Create Comment Failure
if: failure()
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ env.pr_number }}
body: |
### Gradle Check (Jenkins) Run Completed with:
* **RESULT:** ${{ env.result }} :x:
* **URL:** ${{ env.workflow_url }}
* **CommitID:** ${{ env.pr_from_sha }}
2 changes: 1 addition & 1 deletion .github/workflows/wrapper.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Validate Gradle Wrapper
on: [push, pull_request]
on: [pull_request]

jobs:
validate:
Expand Down

0 comments on commit 16cc502

Please sign in to comment.