f7cc0ac32d
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.5.0 to 5.1.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/e28ff129e5465c2c0dcc6f003fc735cb6ae0c673...7f8b4b4bde536c465e797be725718b88c5d95e0e) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
name: Lint and Unit tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**.go"
|
|
- go.mod
|
|
- go.sum
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**.go"
|
|
- go.mod
|
|
- go.sum
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
GOLANGCI_LINT_VERSION: v1.61.0
|
|
GOLANGCI_LINT_TIMEOUT: 5m
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
permissions:
|
|
contents: read # for actions/checkout to fetch code
|
|
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
|
|
runs-on: ubuntu-latest
|
|
# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }}
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
|
|
with:
|
|
go-version-file: "go.mod"
|
|
cache: true
|
|
|
|
- name: Verify dependencies
|
|
run: |
|
|
go mod verify
|
|
go mod download
|
|
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
|
|
with:
|
|
skip-cache: true
|
|
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
|
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
|
|
|
|
- name: Detect git changes
|
|
if: always()
|
|
run: |
|
|
if [[ $(git diff --stat) != '' ]]; then
|
|
echo -e '❌ \033[0;31m. Fix lint changes.\033[0m'
|
|
git diff --color
|
|
exit 1
|
|
else
|
|
echo '✔ No issues detected. Have a nice day :-)'
|
|
fi
|
|
|
|
- name: Run unit tests
|
|
run: ./hack/runtests.sh
|
|
|
|
- name: Upload Coverage report to CodeCov
|
|
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: unittests
|
|
file: ./coverage.txt
|