Skip to content

Commit

Permalink
chore(ci): add yaml lint update go lint
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Frolov <[email protected]>
  • Loading branch information
Fral738 committed Dec 9, 2024
1 parent 77e664c commit 0ed58be
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
go-version-file: ${{ matrix.directory }}/go.mod

- name: Install linter
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.1
- name: Lint
working-directory: ${{ matrix.directory }}
run: make lint
14 changes: 11 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ linters:
disable-all: true
enable:
# Default linters.
- deadcode
- ineffassign
- structcheck
- typecheck
- varcheck
- unused

# Extra linters.
- asciicheck
Expand All @@ -41,3 +39,13 @@ linters:
- gocritic
- gofumpt
- misspell
- nolintlint

issues:
# Show all errors.
max-issues-per-linter: 0
max-same-issues: 0

exclude:
# TODO use %w in the future.
- "non-wrapping format verb for fmt.Errorf" # errorlint
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docs/.helm
docs/_data/sidebars
werf.yaml
docs/_data/breadcrumbs.yml
58 changes: 58 additions & 0 deletions Taskfile.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ version: "3"

silent: true

vars:
version: "0.0.0"
os: "{{OS}}"
arch: '{{ternary "arm64" ARCH (eq ARCH "arm")}}'
mode: '{{ternary "cgo" "go" (eq .os "linux")}}'
cgoTags: "dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp osusergo exclude_graphdriver_devicemapper netgo no_devmapper static_build cni"
goTags: "dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp"

tasks:
sign:
desc: 'Sign last version tag + origin/main and push signatures. Important vars: "refs".'
Expand All @@ -15,3 +23,53 @@ tasks:
git signatures show {{.CLI_ARGS}} $ref
done
- git signatures push {{.CLI_ARGS}}
lint:
desc: 'Run all linters in parallel. Important vars: "paths".'
deps:
- lint:golangci-lint

lint:golangci-lint:cgo:
desc: 'Lint with golangci-lint for cgo. Important vars: "paths".'
cmds:
- golangci-lint run --build-tags="{{.cgoTags}}" {{.CLI_ARGS}} {{.paths | default "./..."}}
env:
CGO_ENABLED: "1"

lint:golangci-lint:go:
desc: 'Lint with golangci-lint without cgo. Important vars: "paths".'
cmds:
- golangci-lint run --build-tags="{{.goTags}}" {{.CLI_ARGS}} {{.paths | default "./..."}}
env:
CGO_ENABLED: "0"

_lint:golangci-lint:cgo-and-go:
cmds:
- task: lint:golangci-lint:cgo
vars:
paths: "{{.paths}}"
- task: lint:golangci-lint:go
vars:
paths: "{{.paths}}"

_lint:golangci-lint:go:
deps:
- task: lint:golangci-lint:go
vars:
paths: "{{.paths}}"

lint:golangci-lint:
desc: 'Lint with golangci-lint (with and without cgo). Important vars: "paths".'
deps:
- task: _lint:golangci-lint:{{ternary "cgo-and-go" "go" (eq .mode "cgo")}}
vars:
paths: "{{.paths}}"

lint:prettier:
desc: "Check if prettier-formatted."
deps:
- lint:prettier:yaml

lint:prettier:yaml:
desc: "Check if yaml files are prettier-formatted."
cmds:
- prettier -c "**/*.yaml" "**/*.yml"
4 changes: 2 additions & 2 deletions client/trdl.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docker_image: golang:1.20.2-alpine3.17@sha256:4e6bc0eafc261b6c8ba9bd9999b6698e8cefbe21e6d90fbc10c34599d75dc608
commands:
- go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131
- cd client && ./scripts/ci/build_release_v2.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result
- go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131
- cd client && ./scripts/ci/build_release_v2.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result
12 changes: 6 additions & 6 deletions client/trdl_channels.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
groups:
- name: "0"
channels:
- name: alpha
version: 0.7.0
- name: stable
version: 0.7.0
- name: "0"
channels:
- name: alpha
version: 0.7.0
- name: stable
version: 0.7.0
20 changes: 10 additions & 10 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ site_description: Deliver your software continuously & securely.
github_repo_path: /werf/trdl

exclude:
- .gitignore
- Gemfile
- Gemfile.lock
- werf.yaml
- pages_ru/
- .gitignore
- Gemfile
- Gemfile.lock
- werf.yaml
- pages_ru/

highlighter: rouge

plugins:
- jekyll-assets
- jekyll-assets

markdown: kramdown
kramdown:
input: GFM
hard_wrap: false
syntax_highlighter: rouge
input: GFM
hard_wrap: false
syntax_highlighter: rouge

breadcrumbs:
root:
hide: false # show breadcrumbs on root/home page
hide: false # show breadcrumbs on root/home page
image: false # Show image or title text
hometext: "Home"

Expand Down
12 changes: 6 additions & 6 deletions docs/_config_ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ site_lang: ru
site_description: Инструмент безопасной доставки вашего кода пользователям.

exclude:
- .gitignore
- Gemfile
- Gemfile.lock
- werf.yaml
- pages_en/
- .gitignore
- Gemfile
- Gemfile.lock
- werf.yaml
- pages_en/

include:
- pages_ru/
- pages_ru/

breadcrumbs:
hometext: "Начало"
2 changes: 1 addition & 1 deletion docs/_data/trdl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ directives:
required: true
description:
en: Build instructions. The instructions can use the `{{ .Tag }}` pattern, which is replaced by a git tag
ru: Сборочные инструкции. В инструкциях можно использовать шаблон `{{ .Tag }}`, который заменяется на собираемый git-tag
ru: Сборочные инструкции. В инструкциях можно использовать шаблон `{{ .Tag }}`, который заменяется на собираемый git-tag
2 changes: 1 addition & 1 deletion docs/_data/trdl_channels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ directives:
required: true
description:
en: Existing version
ru: Существующая версия
ru: Существующая версия
4 changes: 2 additions & 2 deletions e2e/tests/flow/_fixtures/complete_cycle/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- "9000"
command: server /data
networks:
- minio-net
- minio-net

mc:
image: minio/mc@sha256:f78c05169b54f191ab407a8e4d746a2b1f65a047936ba0e51885504912c9595e
Expand All @@ -17,4 +17,4 @@ services:
environment:
MC_HOST_main: http://minioadmin:minioadmin@minio:9000
networks:
- minio-net
- minio-net
2 changes: 1 addition & 1 deletion e2e/tests/flow/_fixtures/complete_cycle/trdl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ commands:
- mkdir -p /result/any-any/bin
- printf "echo {{ .Tag }}\n" > /result/any-any/bin/script.sh
- mkdir -p /result/windows-any/bin
- printf "@echo off\necho {{ .Tag }}\n" > /result/windows-any/bin/script.bat
- printf "@echo off\necho {{ .Tag }}\n" > /result/windows-any/bin/script.bat
4 changes: 2 additions & 2 deletions server/trdl.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docker_image: golang:1.20.2-alpine3.17@sha256:4e6bc0eafc261b6c8ba9bd9999b6698e8cefbe21e6d90fbc10c34599d75dc608
commands:
- go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131
- cd server && ./scripts/ci/build_release.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result
- go install github.com/mitchellh/gox@8c3b2b9e647dc52457d6ee7b5adcf97e2bafe131
- cd server && ./scripts/ci/build_release.sh {{ .Tag }} && cp -a release-build/{{ .Tag }}/* /result
12 changes: 6 additions & 6 deletions server/trdl_channels.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
groups:
- name: "0"
channels:
- name: alpha
version: 0.7.0
- name: stable
version: 0.7.0
- name: "0"
channels:
- name: alpha
version: 0.7.0
- name: stable
version: 0.7.0

0 comments on commit 0ed58be

Please sign in to comment.