ci: add a codecoverage action #53
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: Go OVP8xx package | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
cache: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Require: The version of golangci-lint to use. | |
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. | |
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. | |
version: v1.53 | |
test: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
lfs: 'true' | |
go-version: '1.21' | |
- run: git lfs pull | |
- run: go test -v -failfast -coverprofile cover.out -timeout=1m ./... | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Install dependencies | |
run: go get -d ./... | |
- name: Build | |
run: go build -v ./... | |
- name: Build the CLI | |
run: go build cmd/ovp8xx/ovp8xx.go | |
release: | |
runs-on: ubuntu-latest | |
needs: test | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- uses: go-semantic-release/action@v1 | |
with: | |
hooks: goreleaser | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |