wip #705
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
on: push | |
name: Build and test | |
permissions: | |
contents: write | |
jobs: | |
go-version: | |
name: Lookup go versions | |
runs-on: ubuntu-22.04 | |
outputs: | |
minimal: ${{ steps.go-version.outputs.minimal }} | |
matrix: ${{ steps.go-version.outputs.matrix }} | |
module: ${{ steps.go-version.outputs.module }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: arnested/go-version-action@v1 | |
id: go-version | |
go_generate: | |
name: Check generated code is up to date | |
needs: go-version | |
runs-on: ubuntu-22.04 | |
env: | |
workdir: go/src/${{ needs.go-version.outputs.module }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{env.workdir}} | |
- name: Setup Go ${{ needs.go-version.outputs.minimal }} | |
uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ needs.go-version.outputs.minimal }} | |
- name: go generate | |
env: | |
GO111MODULE: 'on' | |
GOPATH: ${{ github.workspace }}/go | |
working-directory: ${{env.workdir}} | |
run: go generate -x | |
- name: Diff after go generate | |
working-directory: ${{env.workdir}} | |
run: git diff --exit-code | |
build_and_test: | |
name: Build and test | |
needs: go-version | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
go-version: ${{ fromJSON(needs.go-version.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go ${{ matrix.go-version }}.x | |
uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ matrix.go-version }}.x | |
ignore-local: true | |
- name: go version | |
env: | |
GO111MODULE: 'on' | |
run: go version | |
- name: go test | |
env: | |
GO111MODULE: 'on' | |
run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./... | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: go${{ matrix.go-version }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release --snapshot | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Debian packages | |
path: dist/*.deb | |
license_check: | |
name: License check | |
needs: go-version | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go ${{ needs.go-version.outputs.minimal }} | |
uses: WillAbides/[email protected] | |
with: | |
go-version: ${{ needs.go-version.outputs.minimal }} | |
- name: Install wwhrd | |
env: | |
GO111MODULE: 'off' | |
run: go get -u github.com/frapposelli/wwhrd | |
- name: go mod vendor | |
env: | |
GO111MODULE: 'on' | |
run: go mod vendor | |
- name: wwhrd check | |
run: wwhrd check |