Skip to content

Commit

Permalink
ci: migrating to GitHub actions (#47)
Browse files Browse the repository at this point in the history
* adds gha and removes CCI

* addresses comments and changes in actions

* adds role for publish action

* cleanup

* cleanup

* removes redundant action file

* addresses Aaron's comments
  • Loading branch information
JBAhire authored Jan 6, 2021
1 parent 6a44a93 commit 0759b48
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 196 deletions.
194 changes: 0 additions & 194 deletions .circleci/config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# global
* @buchi-busireddy @tim-mwangi @avinashkolluru @inespo

# GH action
.github/ @aaron-steinfeld @jbahire @kotharironak @buchi-busireddy
44 changes: 44 additions & 0 deletions .github/workflows/merge-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: merge-publish
on:
push:
branches:
- main
workflow_dispatch:

jobs:
merge-publish:
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/[email protected]
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0

- name: create checksum file
uses: hypertrace/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: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_READ_USER }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}

- name: push docker image
uses: hypertrace/actions/gradle@main
with:
args: dockerPushImages
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}
73 changes: 73 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: build and validate
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/[email protected]
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0

- name: create checksum file
uses: hypertrace/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: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_READ_USER }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}

- name: Build with Gradle
uses: hypertrace/actions/gradle@main
with:
args: build dockerBuildImages

validate-helm-charts:
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0

- name: validate charts
uses: hypertrace/actions/validate-charts@main

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/[email protected]
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/[email protected]
- 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 }}
60 changes: 60 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
fetch-depth: 0

- name: create checksum file
uses: hypertrace/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: Unit test
uses: hypertrace/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/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
Loading

0 comments on commit 0759b48

Please sign in to comment.