From d206d79acfd8596a7aa4ecec7952a5e914a942e9 Mon Sep 17 00:00:00 2001 From: Alex Tymchuk Date: Thu, 20 Jul 2023 19:35:41 +0300 Subject: [PATCH] PMM-12339 remove go tip (#94) * PMM-12339 remove go tip PMM-12339 https://goreleaser.com/deprecations/?h=rm+dist#-rm-dist * PMM-12339 refactor go workflow * PMM-12339 Hix CI * PMM-12339 avoid triggering tests twice --------- Co-authored-by: Artem Gavrilov --- .github/workflows/go.yml | 44 ++++++++++++++--------------------- .github/workflows/release.yml | 28 +++++++++++----------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 54101b9e..112421db 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,57 +1,49 @@ name: Go -on: [push, pull_request] +on: + push: + branches: + - main + tags: + - v[0-9]+.[0-9]+.[0-9]+* + pull_request: jobs: test: name: Test - strategy: - matrix: - go-version: - - 1.19 - include: - - go-version: tip - os: ubuntu-latest - may-fail: true runs-on: ubuntu-latest # The environment this job references environment: name: CI + steps: - - name: Set up Go release - if: matrix.go-version != 'tip' - uses: percona-platform/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Set up Go tip - if: matrix.go-version == 'tip' - env: - # to avoid error due to `go version` accepting -v flag with an argument since 1.15 - GOFLAGS: "" - run: | - git clone --depth=1 https://go.googlesource.com/go $HOME/gotip - cd $HOME/gotip/src - ./make.bash - echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV - echo "$HOME/gotip/bin" >> $GITHUB_PATH - name: Checkout code - uses: percona-platform/checkout@v2 + uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version-file: ${{ github.workspace }}/go.mod + - name: Run checks run: | go build -modfile=tools/go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint go build -modfile=tools/go.mod -o bin/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review + - name: Run Tests env: AWS_ACCESS_KEY: AKIAZPBRO3QWCEHJTL35 AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} run: make test-race + - name: Run Codecov env: AWS_ACCESS_KEY: AKIAZPBRO3QWCEHJTL35 AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} run: make codecov + - name: Run debug commands on failure if: ${{ failure() }} run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be856db4..25a97407 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,32 +7,32 @@ on: - v* # manually trigger the release workflow_dispatch: + jobs: goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout - uses: percona-platform/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Set up Go - uses: percona-platform/setup-go@v2 + + - name: Set up Go + uses: actions/setup-go@v4 with: - go-version: 1.19 - - - name: Login to GitHub Container Registry - uses: percona-platform/login-action@v1 + go-version-file: ${{ github.workspace }}/go.mod + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Run GoReleaser - uses: percona-platform/goreleaser-action@v2 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}