From 35f86b259a41b379af16136be57b418b1d61a44f Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 13:05:17 +0530 Subject: [PATCH 1/9] adds-gha --- .github/CODEOWNERS | 5 +++ .github/PULL_REQUEST_TEMPLATE.md | 25 +++++++++++++ .github/pr-build.yml | 26 ++++++++++++++ .github/pr-test.yml | 60 ++++++++++++++++++++++++++++++++ .github/publish.yml | 39 +++++++++++++++++++++ 5 files changed, 155 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/pr-build.yml create mode 100644 .github/pr-test.yml create mode 100644 .github/publish.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..b6e2fc4 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Each line is a file pattern followed by one or more owners. + +# GH action +.github/ @aaron-steinfeld @jbahire @kotharironak @buchi-busireddy + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a8e827b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ +## Description +Please include a summary of the change, motivation and context. + + + + +### Testing +Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally. + +### Checklist: +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] Any dependent changes have been merged and published in downstream modules + +### Documentation +Make sure that you have documented corresponding changes in this repository or [hypertrace docs repo](https://github.com/hypertrace/hypertrace-docs-website) if required. + + diff --git a/.github/pr-build.yml b/.github/pr-build.yml new file mode 100644 index 0000000..97a7f36 --- /dev/null +++ b/.github/pr-build.yml @@ -0,0 +1,26 @@ +name: snyk scan +on: + push: + branches: + - main + pull_request_target: + branches: + - main + +jobs: + snyk-scan: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + - name: Setup snyk + uses: snyk/actions/setup@0.3.0 + - name: Snyk test + run: snyk test --all-sub-projects --org=hypertrace --severity-threshold=low --policy-path=.snyk --configuration-matching='^runtimeClasspath$' + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} diff --git a/.github/pr-test.yml b/.github/pr-test.yml new file mode 100644 index 0000000..cb8501e --- /dev/null +++ b/.github/pr-test.yml @@ -0,0 +1,60 @@ +name: test +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle + key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} + restore-keys: | + gradle-packages-${{ runner.os }}-${{ github.job }} + gradle-packages-${{ runner.os }} + + - name: Unit test + uses: hypertrace/github-actions/gradle@main + with: + args: jacocoTestReport + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + name: unit test reports + fail_ci_if_error: true + flags: unit + + - name: copy test reports + uses: hypertrace/github-actions/gradle@main + with: + args: copyAllReports --output-dir=/tmp/test-reports + + - name: Archive test reports + uses: actions/upload-artifact@v1 + with: + name: test-reports + path: /tmp/test-reports + if: always() + + - name: Publish Unit Test Results + uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + files: ./**/build/test-results/**/*.xml diff --git a/.github/publish.yml b/.github/publish.yml new file mode 100644 index 0000000..336a604 --- /dev/null +++ b/.github/publish.yml @@ -0,0 +1,39 @@ +name: Publish artifacts +on: +# Will only run when release is published. + release: + types: + - created + workflow_dispatch: + +jobs: + publish-artifacts: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: Cache packages + uses: actions/cache@v2 + with: + path: ~/.gradle + key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} + restore-keys: | + gradle-packages-${{ runner.os }}-${{ github.job }} + gradle-packages-${{ runner.os }} + + - name: publish java artifacts + uses: hypertrace/github-actions/gradle@main + with: + args: publish + env: + ORG_GRADLE_PROJECT_publishUser: ${{ secrets.BINTRAY_USER }} + ORG_GRADLE_PROJECT_publishApiKey: ${{ secrets.BINTRAY_API_KEY }} + + From fa4898d9d23db2772b79e33aa449385f7fd2c37e Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 13:05:41 +0530 Subject: [PATCH 2/9] removes-cci --- .circleci/config.yml | 106 ------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 80de69d..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,106 +0,0 @@ -version: 2.1 - -orbs: - codecov: codecov/codecov@1 - snyk: snyk/snyk@0.0.11 - -executors: - java: - docker: - - image: cimg/openjdk:11.0 - -commands: - gradle: - description: 'Run the provided gradle command' - parameters: - args: - type: string - when: - default: "on_success" - type: enum - enum: ["on_fail", "on_success", "always"] - steps: - - run: - name: << parameters.args >> - command: ./gradlew << parameters.args >> --info --max-workers=2 -Dorg.gradle.jvmargs=-Xmx2g -Dorg.gradle.console=plain --continue - when: << parameters.when >> - setup_build_environment: - description: 'Generates cache key from a hash of all gradle files' - steps: - - checkout - - run: - name: Generate cache key - command: find . -type f -name "*.gradle*" -o -name "gradle-wrapper*" -exec shasum {} + | sort > /tmp/checksum.txt && cat /tmp/checksum.txt - - restore_cache: - keys: - - v1-dependencies-{{ checksum "/tmp/checksum.txt" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - populate_and_save_cache: - description: 'Downloads all gradle dependencies and uploads cache for later use' - steps: - - gradle: - args: downloadDependencies - - save_cache: - paths: - - ~/.gradle - key: v1-dependencies-{{ checksum "/tmp/checksum.txt" }} - -jobs: - build: - executor: java - steps: - - setup_build_environment - - populate_and_save_cache - - gradle: - args: build - - gradle: - args: jacocoTestReport - - gradle: - args: copyAllReports --output-dir=/tmp/test-reports - when: always - - codecov/upload - - store_test_results: - path: /tmp/test-reports - - store_artifacts: - path: /tmp/test-reports - destination: reports - publish: - executor: java - steps: - - setup_build_environment - - gradle: - args: :tag -Prelease - - add_ssh_keys: - fingerprints: - - '1d:e2:f6:2d:16:e5:ed:fc:34:e8:ae:33:6b:b5:03:57' - - run: git push origin $(./gradlew -q :printVersion) - - gradle: - args: publish - snyk-scan: - executor: - name: java - environment: - GRADLE_OPTS: -Dorg.gradle.workers.max=1 # Snyk doesn't handle parallelism well - steps: - - setup_build_environment - - snyk/scan: - additional-arguments: --all-sub-projects --policy-path=.snyk --configuration-matching='^runtimeClasspath$' - -workflows: - version: 2 - build-and-publish: - jobs: - - build - - snyk-scan: - context: hypertrace-vulnerability-scanning - - publish: - context: hypertrace-publishing - requires: - - build -# Disabling temporarily due to snyk quota issue -# - snyk-scan - filters: - branches: - only: - - main From 73d06cb10528fc8f4d71c50b555cc3b502a52057 Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 13:19:09 +0530 Subject: [PATCH 3/9] directory --- .github/{ => workflows}/pr-build.yml | 0 .github/{ => workflows}/pr-test.yml | 0 .github/{ => workflows}/publish.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/pr-build.yml (100%) rename .github/{ => workflows}/pr-test.yml (100%) rename .github/{ => workflows}/publish.yml (100%) diff --git a/.github/pr-build.yml b/.github/workflows/pr-build.yml similarity index 100% rename from .github/pr-build.yml rename to .github/workflows/pr-build.yml diff --git a/.github/pr-test.yml b/.github/workflows/pr-test.yml similarity index 100% rename from .github/pr-test.yml rename to .github/workflows/pr-test.yml diff --git a/.github/publish.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/publish.yml rename to .github/workflows/publish.yml From bfb566e3d577b53d81659fabcc9e21561bf23594 Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 16:00:38 +0530 Subject: [PATCH 4/9] adds codecov file --- codecov.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..8a333e5 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +codecov: + max_report_age: off From 2292d6d8773f2c09af4c8b76d529d74f80ba3777 Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Fri, 8 Jan 2021 11:51:08 +0530 Subject: [PATCH 5/9] adds build job --- .github/workflows/pr-test.yml | 27 +++++++++++++++++++ .../workflows/{pr-build.yml => snyk-scan.yml} | 0 2 files changed, 27 insertions(+) rename .github/workflows/{pr-build.yml => snyk-scan.yml} (100%) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index cb8501e..3253bce 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -58,3 +58,30 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} files: ./**/build/test-results/**/*.xml + + build: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle + key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} + restore-keys: | + gradle-packages-${{ runner.os }}-${{ github.job }} + gradle-packages-${{ runner.os }} + + - name: Unit test + uses: hypertrace/github-actions/gradle@main + with: + args: build \ No newline at end of file diff --git a/.github/workflows/pr-build.yml b/.github/workflows/snyk-scan.yml similarity index 100% rename from .github/workflows/pr-build.yml rename to .github/workflows/snyk-scan.yml From 079c504149475991d7d5ea8a997fabfcc70e4d6b Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Fri, 8 Jan 2021 12:00:49 +0530 Subject: [PATCH 6/9] addressed ronak's comment --- .github/workflows/pr-build.yml | 53 +++++++++++++++++++++++++++++++++ .github/workflows/pr-test.yml | 29 +----------------- .github/workflows/snyk-scan.yml | 26 ---------------- 3 files changed, 54 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/pr-build.yml delete mode 100644 .github/workflows/snyk-scan.yml diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000..87f9392 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,53 @@ +name: build +on: + push: + branches: + - main + pull_request_target: + branches: + - main + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle + key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} + restore-keys: | + gradle-packages-${{ runner.os }}-${{ github.job }} + gradle-packages-${{ runner.os }} + + - name: Unit test + uses: hypertrace/github-actions/gradle@main + with: + args: build + + snyk-scan: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + - name: Setup snyk + uses: snyk/actions/setup@0.3.0 + - name: Snyk test + run: snyk test --all-sub-projects --org=hypertrace --severity-threshold=low --policy-path=.snyk --configuration-matching='^runtimeClasspath$' + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 3253bce..9e9421c 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -57,31 +57,4 @@ jobs: if: always() with: github_token: ${{ secrets.GITHUB_TOKEN }} - files: ./**/build/test-results/**/*.xml - - build: - runs-on: ubuntu-20.04 - steps: - # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - - name: Check out code - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 0 - - - name: create checksum file - uses: hypertrace/github-actions/checksum@main - - - name: Cache packages - id: cache-packages - uses: actions/cache@v2 - with: - path: ~/.gradle - key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} - restore-keys: | - gradle-packages-${{ runner.os }}-${{ github.job }} - gradle-packages-${{ runner.os }} - - - name: Unit test - uses: hypertrace/github-actions/gradle@main - with: - args: build \ No newline at end of file + files: ./**/build/test-results/**/*.xml \ No newline at end of file diff --git a/.github/workflows/snyk-scan.yml b/.github/workflows/snyk-scan.yml deleted file mode 100644 index 97a7f36..0000000 --- a/.github/workflows/snyk-scan.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: snyk scan -on: - push: - branches: - - main - pull_request_target: - branches: - - main - -jobs: - snyk-scan: - runs-on: ubuntu-20.04 - steps: - # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - - name: Check out code - uses: actions/checkout@v2.3.4 - with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - fetch-depth: 0 - - name: Setup snyk - uses: snyk/actions/setup@0.3.0 - - name: Snyk test - run: snyk test --all-sub-projects --org=hypertrace --severity-threshold=low --policy-path=.snyk --configuration-matching='^runtimeClasspath$' - env: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} From 262d1b42a9c664f8fcbc413bfe46ceaae61f3584 Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Fri, 8 Jan 2021 12:09:56 +0530 Subject: [PATCH 7/9] addressed ronak's comments --- .github/workflows/pr-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 87f9392..6bf1dac 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -1,4 +1,4 @@ -name: build +name: build & validate on: push: branches: @@ -15,6 +15,8 @@ jobs: - name: Check out code uses: actions/checkout@v2.3.4 with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - name: create checksum file From 7ef2baf93183ebaa855ecd9752c27db85643f4fe Mon Sep 17 00:00:00 2001 From: kotharironak <53209990+kotharironak@users.noreply.github.com> Date: Fri, 8 Jan 2021 12:19:37 +0530 Subject: [PATCH 8/9] Update .github/CODEOWNERS --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b6e2fc4..9dc8891 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,5 @@ # Each line is a file pattern followed by one or more owners. - +# global +* @laxmanchekka @kotharironak @surajpuvvada @ravisingal # GH action .github/ @aaron-steinfeld @jbahire @kotharironak @buchi-busireddy - From 6899bee723f3ec55284c6379e41c3963c639fce4 Mon Sep 17 00:00:00 2001 From: kotharironak <53209990+kotharironak@users.noreply.github.com> Date: Fri, 8 Jan 2021 12:21:34 +0530 Subject: [PATCH 9/9] Update .github/workflows/pr-build.yml --- .github/workflows/pr-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 6bf1dac..6cabba1 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -32,7 +32,7 @@ jobs: gradle-packages-${{ runner.os }}-${{ github.job }} gradle-packages-${{ runner.os }} - - name: Unit test + - name: Build with Gradle uses: hypertrace/github-actions/gradle@main with: args: build