ci: 💚 fix the GitHub Action #171
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.22' | |
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.57 | |
test: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: ⬇️ Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: 'true' | |
- name: 👷 Prepare the Go environment | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: 🧪 Run the unit tests | |
run: go test -v -failfast -coverprofile cover.out -timeout=1m ./... | |
- name: 🚀 Upload the 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.22' | |
- 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.22' | |
- uses: go-semantic-release/action@v1 | |
with: | |
hooks: goreleaser | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |