From fd13388d68e1bbef8f48e9ace2852ff0885bf21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ljubo=20Nikoli=C4=87?= Date: Tue, 4 Jun 2024 14:22:08 +0200 Subject: [PATCH 1/2] add lint job to CI --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 503746c..729a12b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,31 +1,54 @@ -name: Release +name: CI on: push: - tags: - - 'v*' + pull_request: + branches: + - main + +env: + GO_VERSION: 1.22 + GORELEASER_VERSION: v1.25.1 jobs: - release: + lint: + name: Lint runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Check out source code uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 with: - fetch-depth: 0 + go-version: ${{ env.GO_VERSION }} + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.22' - - name: Login to DockerHub - uses: docker/login-action@v3 + go-version: ${{ env.GO_VERSION }} + - name: Cache Go modules + uses: actions/cache@v4 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Run goreleaser + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install goreleaser uses: goreleaser/goreleaser-action@v5 with: - version: v1.25.1 - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + version: ${{ env.GORELEASER_VERSION }} + install-only: true + - name: Build + run: goreleaser build --clean --snapshot + - name: Run tests + run: go test -v ./... \ No newline at end of file From a2bfda337801d57562329f4ca9d70189fe693f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ljubo=20Nikoli=C4=87?= Date: Tue, 4 Jun 2024 14:22:20 +0200 Subject: [PATCH 2/2] fix deprecated packages --- server/config.go | 2 +- server/server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/config.go b/server/config.go index a4e314e..8abc633 100644 --- a/server/config.go +++ b/server/config.go @@ -20,7 +20,7 @@ import ( "github.com/c2h5oh/datasize" "github.com/palantir/go-baseapp/baseapp" - "github.com/palantir/go-baseapp/baseapp/datadog" + "github.com/palantir/go-baseapp/appmetrics/emitter/datadog" "github.com/palantir/go-githubapp/githubapp" "github.com/pkg/errors" "gopkg.in/yaml.v2" diff --git a/server/server.go b/server/server.go index b310b05..91ec846 100644 --- a/server/server.go +++ b/server/server.go @@ -25,7 +25,7 @@ import ( "github.com/die-net/lrucache" "github.com/gregjones/httpcache" "github.com/palantir/go-baseapp/baseapp" - "github.com/palantir/go-baseapp/baseapp/datadog" + "github.com/palantir/go-baseapp/appmetrics/emitter/datadog" "github.com/palantir/go-githubapp/githubapp" "github.com/palantir/policy-bot/pull" "github.com/pkg/errors"