Merge pull request #368 from kubewharf/dependabot/go_modules/k8s.io/c… #1600
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: | |
pull_request: | |
push: | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Run unit tests | |
runs-on: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.3' | |
- name: Ensure coverage is reported for every package | |
run: | | |
find pkg -type d -print0 | while IFS= read -r -d '' dir; do | |
go_file=$(ls -1 $dir | grep '\.go$' | grep -v '_test\.go$' | head -n1) | |
if [[ $go_file ]]; then | |
package_line=$(grep '^package' ${dir}/${go_file} | head -n1) | |
echo "${package_line}_test" >$dir/package_coverage_test.go | |
fi | |
done | |
- name: Run unit tests | |
run: make test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
lint: | |
name: golangci-lint | |
runs-on: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.3' | |
- run: rm -r tools | |
- name: Run lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
args: --timeout=10m | |
only-new-issues: true | |
typos: | |
name: Check typos | |
runs-on: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: crate-ci/typos@master | |
with: | |
config: hack/typos.toml |