PMM-12339 remove go tip ()

* PMM-12339 remove go tip

* PMM-12339 use Go version from go.mod

* PMM-12339 Hix CI

* PMM-12339 remove a redundant linter run (file missing)

* PMM-12339 avoid linting when running tests

* PMM-12339 final cleanup

---------

Co-authored-by: Artem Gavrilov <artem.gavrilov@percona.com>
This commit is contained in:
Alex Tymchuk 2023-07-19 17:33:24 +03:00 committed by GitHub
parent 60937ab304
commit 74815fb098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 11 deletions

View File

@ -13,8 +13,6 @@ jobs:
name: Test name: Test
strategy: strategy:
matrix: matrix:
go-version:
- 1.19
postgresql-image: postgresql-image:
- postgres:10 - postgres:10
- postgres:11 - postgres:11
@ -26,18 +24,20 @@ jobs:
environment: environment:
name: CI name: CI
steps: steps:
- name: Set up Go release
uses: percona-platform/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code - name: Checkout code
uses: percona-platform/checkout@v3 uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: ${{ github.workspace }}/go.mod
- name: Run checks - name: Run checks
run: | 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/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 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 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 - name: Run Tests
run: | run: |
sudo chown 999:999 testdata/ssl/server/* sudo chown 999:999 testdata/ssl/server/*
@ -47,6 +47,7 @@ jobs:
make test make test
env: env:
POSTGRESQL_IMAGE: ${{ matrix.postgresql-image }} POSTGRESQL_IMAGE: ${{ matrix.postgresql-image }}
- name: Run debug commands on failure - name: Run debug commands on failure
if: ${{ failure() }} if: ${{ failure() }}
run: | run: |

View File

@ -17,13 +17,16 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: install Go - name: install Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: 1.19.x go-version-file: ${{ github.workspace }}/go.mod
- name: Install snmp_exporter/generator dependencies - name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter' if: github.repository == 'prometheus/snmp_exporter'
- name: Lint - name: Lint
uses: golangci/golangci-lint-action@v3.6.0 uses: golangci/golangci-lint-action@v3.6.0
with: with:

View File

@ -58,6 +58,7 @@ endif
PROMU_VERSION ?= 0.13.0 PROMU_VERSION ?= 0.13.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
SKIP_GOLANGCI_LINT ?= $(CI)
GOLANGCI_LINT := GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?= GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.45.2 GOLANGCI_LINT_VERSION ?= v1.45.2
@ -67,7 +68,9 @@ ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386)) ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
# If we're in CI and there is an Actions file, that means the linter # If we're in CI and there is an Actions file, that means the linter
# is being run in Actions, so we don't need to run it here. # is being run in Actions, so we don't need to run it here.
ifeq (,$(CIRCLE_JOB)) ifneq (,$(SKIP_GOLANGCI_LINT))
GOLANGCI_LINT :=
else ifeq (,$(CIRCLE_JOB))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml)) else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint

View File

@ -1,5 +1,4 @@
--- ---
version: '3'
services: services:
postgresql: postgresql:
image: ${POSTGRESQL_IMAGE:-postgres} image: ${POSTGRESQL_IMAGE:-postgres}