This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
build and test #509
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and test | |
on: | |
schedule: | |
- cron: 11 0 * * 1 | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
with: | |
username: ${{ secrets.DOCKERHUB_READ_USER }} | |
password: ${{ secrets.DOCKERHUB_READ_TOKEN }} | |
- name: Build with Gradle | |
uses: hypertrace/github-actions/gradle@main | |
with: | |
args: build dockerBuildImages | |
- name: Run Trivy vulnerability scanner | |
uses: hypertrace/github-actions/trivy-image-scan@main | |
with: | |
image: hypertrace/gateway-service | |
output-mode: github | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Unit test | |
uses: hypertrace/github-actions/gradle@main | |
with: | |
args: jacocoTestReport | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
name: unit test reports | |
flags: unit | |
- name: copy test reports | |
uses: hypertrace/github-actions/gradle@main | |
with: | |
args: copyAllReports --output-dir=/tmp/test-reports | |
if: failure() | |
- name: Archive test reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: /tmp/test-reports | |
if: failure() | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: (success() || failure()) && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: ./**/build/test-results/**/*.xml | |
dependency-check: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Dependency Check | |
uses: hypertrace/github-actions/dependency-check@main | |
validate-helm-charts: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
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/github-actions/validate-charts@main |