Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @artemgavrilov
* @ademidoff
135 changes: 47 additions & 88 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,61 @@ jobs:
test:
name: Test
timeout-minutes: 10

strategy:
fail-fast: false
matrix:
go-version: [1.16.x]
may-fail: [false]
include:
- go-version: tip
may-fail: true

continue-on-error: ${{ matrix.may-fail }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Set up Go release
if: matrix.go-version != 'tip'
uses: percona-platform/setup-go@v2
- name: Check out code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
go-version: ${{ matrix.go-version }}
lfs: true

- name: Set up Go tip
if: matrix.go-version == 'tip'
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: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: ${{ github.workspace }}/go.mod
cache: false

- name: Set GO_VERSION environment variable
run: |
go version
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV

- name: Check out code into the Go module directory
uses: percona-platform/checkout@v2
with:
lfs: true

- name: Enable Go modules cache
uses: percona-platform/cache@v2
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
${{ runner.os }}-go-modules-

- name: Enable Go build cache
uses: percona-platform/cache@v2
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go-version }}-build-
${{ runner.os }}-go-build-${{ github.ref }}-
${{ runner.os }}-go-build-

- name: Download Go modules
run: go mod download
run: go mod download -x

- name: Install development tools
run: make init

- name: Format the code
run: make format

- name: Run tests
run: |
go clean -testcache
make test-crosscover

- name: Upload coverage results
uses: percona-platform/codecov-action@v1
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: crosscover.out
files: crosscover.out
flags: crosscover
env_vars: GO_VERSION
fail_ci_if_error: false
Expand All @@ -101,82 +84,58 @@ jobs:
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
echo "--------------- ENVIRONMENT ---------------"
env | sort
echo "--------------- GO ENV ---------------"
go env | sort
git status

check:
name: Check
timeout-minutes: 10
if: github.event_name == 'pull_request'

strategy:
fail-fast: false
matrix:
go-version: [1.16.x]
may-fail: [false]

continue-on-error: ${{ matrix.may-fail }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Set up Go release
if: matrix.go-version != 'tip'
uses: percona-platform/setup-go@v2
- name: Check out code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
go-version: ${{ matrix.go-version }}

- name: Set up Go tip
if: matrix.go-version == 'tip'
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: Set GO_VERSION environment variable
run: |
go version
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
lfs: true

- name: Check out code into the Go module directory
uses: percona-platform/checkout@v2
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
lfs: true
go-version-file: ${{ github.workspace }}/go.mod
cache: false

- name: Enable Go modules cache
uses: percona-platform/cache@v2
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
${{ runner.os }}-go-modules-

- name: Enable Go build cache
uses: percona-platform/cache@v2
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go-version }}-build-
${{ runner.os }}-go-build-${{ github.ref }}-
${{ runner.os }}-go-build-

- name: Download Go modules
run: go mod download
run: go mod download -x

- name: Install tools
run: make init

- name: Run checks/linters
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
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 -name='Required checks' -reporter=github-pr-check

# use ROBOT_TOKEN for better reviewer's name
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.ROBOT_TOKEN }} bin/reviewdog -f=golangci-lint -name='Linters' -reporter=github-pr-review
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -name='Linters' -reporter=github-pr-review

# run it like that until some of those issues/PRs are resolved:
# * https://github.com/quasilyte/go-consistent/issues/33
Expand All @@ -197,8 +156,8 @@ jobs:
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
echo "--------------- ENVIRONMENT ---------------"
env | sort
echo "--------------- GO ENV ---------------"
go env | sort
git status
71 changes: 0 additions & 71 deletions .github/workflows/clean.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .golangci-required.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .golangci.bck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# Almost all linters; some of them are optional.

linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
# use "gopkg.in/yaml.v2" instead
- gopkg.in/yaml.v3

goimports:
local-prefixes: github.com/percona/promconfig

tagliatelle:
case:
rules:
yaml: snake

unused:
check-exported: true

unparam:
check-exported: true

linters:
enable-all: true
disable:
- exhaustivestruct # too annoying
- gci # works poorly
- goerr113 # we use pkg/errors for stack traces
- golint # deprecated
- gomnd # too annoying
- interfacer # deprecated
- maligned # deprecated
- nlreturn # conflicts with formatter
- scopelint # deprecated
- wrapcheck # forces to wrap errors everywhere
- wsl # too annoying

issues:
exclude-use-default: false
exclude-rules:
- path: _test\.go
linters:
- funlen # tests may be long
- testpackage # senseless
- unused # very annoying false positive: https://github.com/golangci/golangci-lint/issues/791
Loading