From 160a7d26f4b53dc44ade2090856427644c12a0da Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 11 Dec 2022 21:07:03 +0000 Subject: [PATCH] ci: setup workflows and release-please --- .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++++++++++ .release-please-manifest.json | 3 ++ Makefile | 2 +- release-please-config.json | 14 ++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7b62a37 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +--- +name: CI +on: [push] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.50 + env: + VERBOSE: "true" + + tidy: + name: Tidy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19 + - uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Check if mods are tidy + run: make check-tidy + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19 + - uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run tests + run: make test + env: + VERBOSE: "true" + + release-please: + needs: [lint, tidy, test] + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + steps: + - uses: google-github-actions/release-please-action@v3 + id: release-please + with: + command: manifest diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..e18ee07 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} diff --git a/Makefile b/Makefile index b4f93a5..9f3ab6d 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ endef $(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc@latest)) $(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest)) $(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports@latest)) -$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49)) +$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50)) $(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest)) $(eval $(call tool,mockgen,github.com/golang/mock/mockgen@v1.6.0)) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..4269600 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,14 @@ +{ + "release-type": "go", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "draft": false, + "prerelease": false, + "extra-files": [] + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}