Skip to content

Commit

Permalink
PMM-12339 remove go tip (#94)
Browse files Browse the repository at this point in the history
* 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 <artem.gavrilov@percona.com>
  • Loading branch information
Alex Tymchuk and artemgavrilov committed Jul 20, 2023
1 parent f639f1d commit d206d79
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 40 deletions.
44 changes: 18 additions & 26 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -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: |
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit d206d79

Please sign in to comment.