tidy mod #528
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
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "**" | |
pull_request: | |
env: | |
go_version: 1.21.6 | |
jobs: | |
golangci-lint: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go_version }} | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55.2 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go_version }} | |
- name: Set up gotestfmt | |
uses: gotesttools/gotestfmt-action@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up limgo | |
uses: GoTestTools/[email protected] | |
with: | |
version: "v1.0.0" | |
install-only: true | |
- name: Setup go mockgen | |
run: go install go.uber.org/mock/[email protected] | |
- name: generate mocks | |
run: go generate ./... | |
- name: run tests | |
run: | | |
set -euo pipefail | |
go test -coverprofile=test.cov -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt | |
- name: upload test log | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-log | |
path: /tmp/gotest.log | |
if-no-files-found: error | |
- name: Calculate test coverage | |
run: | | |
cat .limgo.json | |
limgo -coverfile=test.cov -config=.limgo.json -outfmt=md -outfile=limgo_cov.md | |
cat limgo_cov.md >> $GITHUB_STEP_SUMMARY | |
- name: upload coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: limgo_cov.md | |
if-no-files-found: error | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
needs: | |
- golangci-lint | |
- test | |
if: startsWith(github.event.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go_version }} | |
- name: Setup go mockgen | |
run: go install github.com/golang/mock/[email protected] | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: dist |