diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a9061d9..7efbcdb 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,10 +8,14 @@ on: workflow_dispatch: env: - GO_VERSION: "1.22" + GO_VERSION: 1.22 + GOLANGCI_LINT_VERSION: v1.61 + +permissions: + contents: read jobs: - release: + linter: runs-on: personal steps: - name: Checkout @@ -27,9 +31,64 @@ jobs: - name: Check & format go.mod run: go mod tidy - # Run linter and tests + - name: Linter + uses: golangci/golangci-lint-action@v6 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} + + - name: GoReleaser requirements + uses: goreleaser/goreleaser-action@v6 + with: + version: '~> v2' + args: healthcheck + + - name: Validate .goreleaser.yaml + uses: goreleaser/goreleaser-action@v6 + with: + version: '~> v2' + args: check + + tests: + runs-on: personal + 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: Install dependencies + run: | + go get . + + - name: Test + run: go run gotest.tools/gotestsum@latest --junitfile unit-tests.xml --format pkgname + + - name: Test Summary + uses: test-summary/action@v2 + with: + paths: "unit-tests.xml" + if: success() + + + go-releaser: + runs-on: personal + 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: Check GoReleaser requirements + - name: GoReleaser requirements uses: goreleaser/goreleaser-action@v6 with: version: '~> v2' diff --git a/.gitignore b/.gitignore index c1257a0..b303f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vault-snapshot-agent dist/ .coverage/ +unit-tests.xml