Skip to content

Commit

Permalink
chore: rekres, rename
Browse files Browse the repository at this point in the history
Rename Go module, rekres, fix linting, rename main branch.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Oct 31, 2022
1 parent 8cbc42d commit a062a4c
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 175 deletions.
20 changes: 10 additions & 10 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty.
# Generated on 2022-10-31T18:09:29Z by kres 03328da.

codecov:
require_ci_to_pass: false
require_ci_to_pass: false

coverage:
status:
project:
default:
target: 50%
threshold: 0.5%
base: auto
if_ci_failed: success
patch: off
status:
project:
default:
target: 50%
threshold: 0.5%
base: auto
if_ci_failed: success
patch: off

comment: false
17 changes: 10 additions & 7 deletions .conform.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty.
# Generated on 2022-10-31T18:09:29Z by kres 03328da.

---
policies:
- type: commit
spec:
dco: true
gpg: false
gpg:
required: true
identity:
gitHubOrganization: siderolabs
spellcheck:
locale: US
maximumOfOneCommit: true
Expand All @@ -19,16 +23,15 @@ policies:
required: true
conventional:
types: ["chore","docs","perf","refactor","style","test","release"]
scopes: ["*"]
scopes: [".*"]
- type: license
spec:
skipPaths:
- .git/
- testdata/
includeSuffixes:
- .go
excludeSuffixes:
- .pb.go
header: |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
- .pb.gw.go
header: "// This Source Code Form is subject to the terms of the Mozilla Public\u000A// License, v. 2.0. If a copy of the MPL was not distributed with this\u000A// file, You can obtain one at http://mozilla.org/MPL/2.0/.\u000A"
64 changes: 62 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty.
# Generated on 2022-10-31T18:09:29Z by kres 03328da.

kind: pipeline
type: kubernetes
Expand Down Expand Up @@ -122,9 +122,59 @@ steps:
depends_on:
- base

- name: release-notes
pull: always
image: autonomy/build-container:latest
commands:
- make release-notes
volumes:
- name: outer-docker-socket
path: /var/outer-run
- name: docker-socket
path: /var/run
- name: buildx
path: /root/.docker/buildx
- name: ssh
path: /root/.ssh
when:
event:
- tag
depends_on:
- unit-tests
- coverage
- lint

- name: release
pull: always
image: plugins/github-release
settings:
api_key:
from_secret: github_token
checksum:
- sha256
- sha512
draft: true
files:
- _out/*
note: _out/RELEASE_NOTES.md
volumes:
- name: outer-docker-socket
path: /var/outer-run
- name: docker-socket
path: /var/run
- name: buildx
path: /root/.docker/buildx
- name: ssh
path: /root/.ssh
when:
event:
- tag
depends_on:
- release-notes

services:
- name: docker
image: docker:19.03-dind
image: docker:20.10-dind
entrypoint:
- dockerd
commands:
Expand Down Expand Up @@ -157,6 +207,12 @@ volumes:
temp:
medium: memory

trigger:
branch:
exclude:
- renovate/*
- dependabot/*

---
kind: pipeline
type: kubernetes
Expand Down Expand Up @@ -184,6 +240,10 @@ steps:
- failure

trigger:
branch:
exclude:
- renovate/*
- dependabot/*
status:
- success
- failure
Expand Down
53 changes: 35 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty.

# Generated on 2022-10-31T18:09:29Z by kres 03328da.

# options for analysis running
run:
Expand All @@ -22,7 +21,6 @@ output:
uniq-by-line: true
path-prefix: ""


# all available settings of specific linters
linters-settings:
dogsled:
Expand All @@ -38,9 +36,16 @@ linters-settings:
lines: 60
statements: 40
gci:
local-prefixes: github.com/talos-systems/go-procfs
local-prefixes: github.com/siderolabs/go-procfs
gocognit:
min-complexity: 30
ireturn:
allow:
- anon
- error
- empty
- stdlib
- github.com\/talos-systems\/kres\/internal\/dag.Node
nestif:
min-complexity: 5
goconst:
Expand All @@ -60,7 +65,7 @@ linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/talos-systems/go-procfs
local-prefixes: github.com/siderolabs/go-procfs
golint:
min-confidence: 0.8
gomnd:
Expand All @@ -75,8 +80,6 @@ linters-settings:
lll:
line-length: 200
tab-width: 4
maligned:
suggest-new: true
misspell:
locale: US
ignore-words: []
Expand All @@ -93,7 +96,7 @@ linters-settings:
require-explanation: false
require-specific: true
rowserrcheck: {}
testpackage:
testpackage: {}
unparam:
check-exported: false
unused:
Expand All @@ -112,25 +115,41 @@ linters-settings:
allow-separated-leading-comment: false
gofumpt:
extra-rules: false
cyclop:
# the maximal code complexity to report
max-complexity: 20

linters:
enable-all: true
disable-all: false
fast: false
disable:
- exhaustruct
- exhaustivestruct
- forbidigo
- funlen
- gas
- typecheck
- gochecknoglobals
- gochecknoinits
- funlen
- godox
- gomnd
- goerr113
- gomnd
- gomoddirectives
- ireturn
- nestif
- wrapcheck
- nonamedreturns
- nosnakecase
- paralleltest
- exhaustivestruct
disable-all: false
fast: false

- tagliatelle
- thelper
- typecheck
- varnamelen
- wrapcheck
# abandoned linters for which golangci shows the warning that the repo is archived by the owner
- interfacer
- maligned
- golint
- scopelint

issues:
exclude: []
Expand All @@ -139,10 +158,8 @@ issues:
exclude-case-sensitive: false
max-issues-per-linter: 10
max-same-issues: 3

new: false

severity:
default-severity: error

case-sensitive: false
3 changes: 3 additions & 0 deletions .license-header.go.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
51 changes: 35 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,46 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2020-12-10T14:39:08Z by kres 31dc49d-dirty.
# Generated on 2022-10-31T18:09:29Z by kres 03328da.

ARG TOOLCHAIN

# cleaned up specs and compiled versions
FROM scratch AS generate

# runs markdownlint
FROM node:14.8.0-alpine AS lint-markdown
RUN npm i -g markdownlint-cli@0.23.2
RUN npm i sentences-per-line@0.2.1
FROM docker.io/node:19.0.0-alpine3.16 AS lint-markdown
WORKDIR /src
RUN npm i -g markdownlint-cli@0.32.2
RUN npm i sentences-per-line@0.2.1
COPY .markdownlint.json .
COPY ./README.md ./README.md
RUN markdownlint --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules /node_modules/sentences-per-line/index.js .
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .

# base toolchain image
FROM ${TOOLCHAIN} AS toolchain
RUN apk --update --no-cache add bash curl build-base
RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev

# build tools
FROM toolchain AS tools
FROM --platform=${BUILDPLATFORM} toolchain AS tools
ENV GO111MODULE on
ENV CGO_ENABLED 0
ARG CGO_ENABLED
ENV CGO_ENABLED ${CGO_ENABLED}
ENV GOPATH /go
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /bin v1.33.0
ARG GOLANGCILINT_VERSION
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
&& mv /go/bin/golangci-lint /bin/golangci-lint
ARG GOFUMPT_VERSION
RUN cd $(mktemp -d) \
&& go mod init tmp \
&& go get mvdan.cc/gofumpt/gofumports@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumports /bin/gofumports
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumpt /bin/gofumpt
RUN go install golang.org/x/vuln/cmd/govulncheck@latest \
&& mv /go/bin/govulncheck /bin/govulncheck
ARG GOIMPORTS_VERSION
RUN go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \
&& mv /go/bin/goimports /bin/goimports
ARG DEEPCOPY_VERSION
RUN go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
&& mv /go/bin/deep-copy /bin/deep-copy

# tools and sources
FROM tools AS base
Expand All @@ -43,15 +55,22 @@ RUN --mount=type=cache,target=/go/pkg go list -mod=readonly all >/dev/null

# runs gofumpt
FROM base AS lint-gofumpt
RUN find . -name '*.pb.go' | xargs -r rm
RUN FILES="$(gofumports -l -local github.com/talos-systems/go-procfs .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumports -w -local github.com/talos-systems/go-procfs .':\n${FILES}"; exit 1)
RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumpt -w .':\n${FILES}"; exit 1)

# runs goimports
FROM base AS lint-goimports
RUN FILES="$(goimports -l -local github.com/siderolabs/go-procfs .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/go-procfs .':\n${FILES}"; exit 1)

# runs golangci-lint
FROM base AS lint-golangci-lint
COPY .golangci.yml .
ENV GOGC 50
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint --mount=type=cache,target=/go/pkg golangci-lint run --config .golangci.yml

# runs govulncheck
FROM base AS lint-govulncheck
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg govulncheck ./...

# runs unit-tests with race detector
FROM base AS unit-tests-race
ARG TESTPKGS
Expand All @@ -60,7 +79,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/g
# runs unit-tests
FROM base AS unit-tests-run
ARG TESTPKGS
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -count 1 ${TESTPKGS}
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}

FROM scratch AS unit-tests
COPY --from=unit-tests-run /src/coverage.txt /coverage.txt
Expand Down
Loading

0 comments on commit a062a4c

Please sign in to comment.