From 6e324d11c7dcd8cb31b564a5be8b5850b99bc9cd Mon Sep 17 00:00:00 2001 From: franklin Date: Sat, 7 Dec 2024 21:57:37 +0100 Subject: [PATCH] chore: update workflows --- .github/workflows/ci.yml | 31 ----------------------- .github/workflows/release.yml | 46 ++++++++++++----------------------- .github/workflows/test.yml | 33 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 52846ff..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: CI - -on: - push: - branches: - - main - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - env: - GOFLAGS: -mod=readonly - GOPROXY: https://proxy.golang.org - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 - - - name: Test - run: go test ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4e99cc..2030dfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,44 +1,38 @@ -name: goreleaser +name: Release on: push: tags: - v*.*.* + workflow_dispatch: + +permissions: + contents: write jobs: - goreleaser: + release: runs-on: ubuntu-latest - env: - GOFLAGS: -mod=readonly - GOPROXY: https://proxy.golang.org steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Unshallow run: git fetch --prune --unshallow - - name: Set up Go - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: - go-version: 1.17 + go-version-file: go.mod - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + - uses: goreleaser/goreleaser-action@v6 with: - distribution: goreleaser version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + docker: runs-on: ubuntu-latest steps: - - name: Check Out Repo - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Docker meta id: meta @@ -48,25 +42,17 @@ jobs: tags: | type=semver,pattern={{version}} - - name: Login to Docker Hub - uses: docker/login-action@v1 + - uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 + - uses: docker/setup-buildx-action@v1 - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 + - uses: docker/build-push-action@v2 with: context: ./ file: ./Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..23b544b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + merge_group: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - uses: gotesttools/gotestfmt-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: golangci/golangci-lint-action@v6 + with: + version: latest + + - name: Run tests + run: make test