ci: integrate the codecov #1013
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 | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: | |
- "1.19" | |
- "1.20" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Run unit tests | |
run: make test | |
- name: Upload coverage reports to Codecov | |
if: ${{ github.repository == 'kubewharf/kubeadmiral' && matrix.go-version == '1.19' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.out | |
flags: unittests | |
fail_ci_if_error: true | |
verbose: true | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.19" | |
# https://github.com/golangci/golangci-lint-action/issues/244 | |
# without `cache: false`, the action might intermittently fail | |
cache: false | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.53.3 | |
only-new-issues: true | |
args: > | |
--timeout=8m | |
--max-issues-per-linter=10 | |
--max-same-issues=10 | |
--uniq-by-line=false | |
verify-codegen: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.19" | |
- run: | | |
make generate -B | |
git diff --exit-code && exit 0 | |
echo "Codegen is not up to date. Please run 'make generate' and commit the changes." >&2 | |
exit 1 | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: crate-ci/typos@master | |
with: | |
config: hack/typos.toml |