RHCLOUD-36175 - Kind cluster setup for inventory #527
Workflow file for this run
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: CI Build and Test | |
on: | |
workflow_call: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
concurrency: | |
# Cancel in-progress runs on PR update | |
group: ci-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test: | |
name: Build & run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.x' | |
cache: true | |
- name: Install dependencies | |
run: go get ./... | |
- name: Build | |
run: go build -tags release -v ./... | |
- name: Test | |
run: make test | |
- name: Store coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage.out | |
code-coverage: | |
name: "test coverage change report" | |
continue-on-error: true | |
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main | |
runs-on: ubuntu-latest | |
needs: build-and-test # Depends on the artifact uploaded by the "build-and-test" job | |
permissions: | |
contents: read | |
actions: read # to download code coverage results from "test" job | |
pull-requests: write # write permission needed to comment on PR | |
steps: | |
# this will fail if the target branch does not already have a coverage.out file uploaded as an artifact | |
- uses: fgrosse/[email protected] | |
with: | |
coverage-artifact-name: "coverage-report" | |
coverage-file-name: "coverage.out" | |
# below options used to make coverage work across forks | |
trim: github.com/project-kessel/inventory-api | |
root-package: "" |