chore: Creates mock generation infrastructure #2712
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: 'Code Health' | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-excluding-paths | |
- '*.md' | |
- 'examples/**' | |
- 'LICENSE' | |
pull_request: {} | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Install tools for mocks and linter | |
run: make tools | |
- name: Mock generation | |
run: mockery | |
- name: Check for uncommited files | |
run: | | |
export FILES=$(git ls-files -o -m --directory --exclude-standard --no-empty-directory) | |
export LINES=$(echo "$FILES" | awk 'NF' | wc -l) | |
if [ $LINES -ne 0 ]; then | |
echo "Detected files that need to be committed:" | |
echo "$FILES" | sed -e "s/^/ /" | |
echo "" | |
echo "Mock skeletons are not up-to-date, you may have forgotten to run mockery before committing your changes." | |
exit 1 | |
fi | |
- name: Build | |
run: make build | |
- name: Linter | |
run: make lint | |
unit-test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Unit Test | |
run: make test | |
- name: Convert coverage report to Cobertura format | |
run: | | |
go install github.com/axw/gocov/gocov@latest | |
go install github.com/AlekSi/gocov-xml@latest | |
gocov convert coverage.out | gocov-xml > coverage.xml | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
with: | |
filename: coverage.xml | |
format: markdown | |
hide_complexity: true | |
hide_branch_rate: false | |
output: both | |
badge: true | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |
website-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: website lint | |
run: make tools && make website-lint | |
shellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run ShellCheck | |
uses: bewuethr/shellcheck-action@v2 | |
call-acceptance-tests-workflow: | |
needs: [build, shellcheck, unit-test, website-lint] | |
secrets: inherit | |
uses: ./.github/workflows/acceptance-tests.yml | |
call-migration-tests-workflow: | |
needs: [build, shellcheck, unit-test, website-lint] | |
secrets: inherit | |
uses: ./.github/workflows/migration-tests.yml | |