CI: build with/require go 1.20 (#2031)

This commit is contained in:
mmetc 2023-02-15 14:27:17 +01:00 committed by GitHub
parent 06ddd01c70
commit 5ff6bfba9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 35 additions and 34 deletions

View file

@ -23,10 +23,10 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go 1.19"
- name: "Set up Go 1.20"
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: "Clone CrowdSec"

View file

@ -10,9 +10,7 @@ on:
env:
PREFIX_TEST_NAMES_WITH_FILE: true
jobs:
build:
name: "Build + tests"
runs-on: ubuntu-latest
@ -32,10 +30,10 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go 1.19"
- name: "Set up Go 1.20"
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: "Check out CrowdSec repository"

View file

@ -7,7 +7,6 @@ env:
PREFIX_TEST_NAMES_WITH_FILE: true
jobs:
build:
name: "Build + tests"
runs-on: ubuntu-latest
@ -32,10 +31,10 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go 1.19"
- name: "Set up Go 1.20"
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: "Check out CrowdSec repository"

View file

@ -21,10 +21,10 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go 1.19"
- name: "Set up Go 1.20"
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: "Check out CrowdSec repository"

View file

@ -25,10 +25,10 @@ jobs:
name: Build
runs-on: windows-2019
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3

View file

@ -24,18 +24,15 @@ jobs:
name: lint
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50
version: v1.51
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false

View file

@ -26,10 +26,10 @@ jobs:
steps:
- name: "Set up Go 1.19"
- name: "Set up Go 1.20"
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: Check out CrowdSec repository

View file

@ -33,11 +33,10 @@ env:
CROWDSEC_FEATURE_DISABLE_HTTP_RETRY_BACKOFF: true
jobs:
build:
strategy:
matrix:
go-version: ["1.19", "1.20.0-rc.1"]
go-version: ["1.20.1"]
name: "Build + tests"
runs-on: ubuntu-latest
@ -74,7 +73,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
kafka1:
image: crowdsecurity/kafka-ssl
ports:

View file

@ -11,10 +11,10 @@ jobs:
name: Build and upload binary package
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
@ -32,10 +32,10 @@ jobs:
name: Build and upload binary package
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20.1
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3

View file

@ -71,6 +71,7 @@ linters:
# - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
# - exportloopref # checks for pointers to enclosing loop variables
# - funlen # Tool for detection of long functions
# - ginkgolinter # enforces standards of using ginkgo and gomega
# - gochecknoinits # Checks that no init functions are present in Go code
# - gocritic # Provides diagnostics that check for bugs, performance and style issues.
# - goheader # Checks is file header matches to pattern
@ -115,6 +116,7 @@ linters:
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
- gosec # (gas): Inspects source code for security problems
- lll # Reports long lines
- musttag # enforce field tags in (un)marshaled structs
- nakedret # Finds naked returns in functions greater than a specified function length
- nonamedreturns # Reports all named returns
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
@ -182,6 +184,9 @@ linters:
issues:
# “Look, thats why theres rules, understand? So that you think before you
# break em.” ― Terry Pratchett
max-issues-per-linter: 0
max-same-issues: 10
exclude-rules:
@ -220,3 +225,7 @@ issues:
- linters:
- gocritic
text: "commentFormatting: put a space between `//` and comment text"
- linters:
- staticcheck
text: "x509.ParseCRL has been deprecated since Go 1.19: Use ParseRevocationList instead"

View file

@ -1,5 +1,5 @@
# vim: set ft=dockerfile:
ARG GOVERSION=1.19
ARG GOVERSION=1.20.1
FROM golang:${GOVERSION}-alpine AS build

View file

@ -1,5 +1,5 @@
# vim: set ft=dockerfile:
ARG GOVERSION=1.19
ARG GOVERSION=1.20.1
FROM golang:${GOVERSION}-bullseye AS build

View file

@ -45,7 +45,7 @@ CSCLI_BIN = cscli$(EXT)
BUILD_CMD = build
MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 19
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 20
go_major_minor = $(subst ., ,$(BUILD_GOVERSION))
GO_MAJOR_VERSION = $(word 1, $(go_major_minor))

View file

@ -25,12 +25,11 @@ stages:
custom: 'tool'
arguments: 'install --global SignClient --version 1.3.155'
- task: GoTool@0
displayName: "Install Go 1.19"
displayName: "Install Go 1.20"
inputs:
version: '1.19'
version: '1.20.1'
- pwsh: |
choco install -y jq
choco install -y make
displayName: "Install builds deps"
- task: PowerShell@2