mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
enable golangci-lint for supported platforms
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
6641167e7d
commit
ee24a36c4f
2
.github/workflows/validate.yml
vendored
2
.github/workflows/validate.yml
vendored
@ -19,6 +19,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
env:
|
||||||
|
GOLANGCI_LINT_MULTIPLATFORM: 1
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
run:
|
run:
|
||||||
timeout: 10m
|
timeout: 30m
|
||||||
skip-files:
|
skip-files:
|
||||||
- ".*\\.pb\\.go$"
|
- ".*\\.pb\\.go$"
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@ variable "DOCS_FORMATS" {
|
|||||||
variable "DESTDIR" {
|
variable "DESTDIR" {
|
||||||
default = "./bin"
|
default = "./bin"
|
||||||
}
|
}
|
||||||
|
variable "GOLANGCI_LINT_MULTIPLATFORM" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
# Special target: https://github.com/docker/metadata-action#bake-definition
|
# Special target: https://github.com/docker/metadata-action#bake-definition
|
||||||
target "meta-helper" {
|
target "meta-helper" {
|
||||||
@ -32,6 +35,17 @@ target "lint" {
|
|||||||
inherits = ["_common"]
|
inherits = ["_common"]
|
||||||
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
|
platforms = GOLANGCI_LINT_MULTIPLATFORM != null ? [
|
||||||
|
"darwin/amd64",
|
||||||
|
"darwin/arm64",
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/s390x",
|
||||||
|
"linux/ppc64le",
|
||||||
|
"linux/riscv64",
|
||||||
|
"windows/amd64",
|
||||||
|
"windows/arm64"
|
||||||
|
] : []
|
||||||
}
|
}
|
||||||
|
|
||||||
target "validate-vendor" {
|
target "validate-vendor" {
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.21.3
|
ARG GO_VERSION=1.21.3
|
||||||
|
ARG XX_VERSION=1.3.0
|
||||||
ARG GOLANGCI_LINT_VERSION=1.54.2
|
ARG GOLANGCI_LINT_VERSION=1.54.2
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-alpine
|
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
|
||||||
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine
|
||||||
RUN apk add --no-cache git gcc musl-dev
|
RUN apk add --no-cache git gcc musl-dev
|
||||||
ENV GOFLAGS="-buildvcs=false"
|
ENV GOFLAGS="-buildvcs=false"
|
||||||
ARG GOLANGCI_LINT_VERSION
|
ARG GOLANGCI_LINT_VERSION
|
||||||
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
|
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
|
||||||
|
COPY --link --from=xx / /
|
||||||
WORKDIR /go/src/github.com/docker/buildx
|
WORKDIR /go/src/github.com/docker/buildx
|
||||||
|
ARG TARGETPLATFORM
|
||||||
RUN --mount=target=/go/src/github.com/docker/buildx \
|
RUN --mount=target=/go/src/github.com/docker/buildx \
|
||||||
--mount=target=/root/.cache,type=cache \
|
--mount=target=/root/.cache,type=cache,id=lint-cache-$TARGETPLATFORM \
|
||||||
|
xx-go --wrap && \
|
||||||
golangci-lint run
|
golangci-lint run
|
||||||
|
Loading…
x
Reference in New Issue
Block a user