Skip to content

Commit

Permalink
chore: Add yamllint check
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Trangoni <[email protected]>
  • Loading branch information
mjtrangoni committed Jan 8, 2023
1 parent f19c6de commit f4eac06
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 70 deletions.
88 changes: 44 additions & 44 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,63 @@ executors:
jobs:
codespell:
docker:
- image: circleci/python
- image: circleci/python
steps:
- checkout
- run: sudo pip install codespell
- run: codespell --skip=".git,./vendor"
- checkout
- run: sudo pip install codespell
- run: codespell --skip=".git,./vendor"

build:
docker:
- image: cimg/go:1.19
- image: cimg/go:1.19
environment:
- DOCKER_IMAGE_NAME: "mjtrangoni/flexlm_exporter"
- QUAY_IMAGE_NAME: "quay.io/mjtrangoni/flexlm_exporter"
- DOCKER_IMAGE_NAME: "mjtrangoni/flexlm_exporter"
- QUAY_IMAGE_NAME: "quay.io/mjtrangoni/flexlm_exporter"
steps:
# checkout the project
- checkout
# checkout the project
- checkout

# make and test
- run:
name: Binary Build
command: make
# make and test
- run:
name: Binary Build
command: make

- setup_remote_docker:
version: 20.10.14
docker_layer_caching: true
- setup_remote_docker:
version: 20.10.14
docker_layer_caching: true

# quay build
- run:
name: Quay.io Build
command: docker build -t $QUAY_IMAGE_NAME -t $QUAY_IMAGE_NAME:$CIRCLE_BRANCH .
- run:
name: Quay Login
command: docker login -u $QUAYLOGIN -p $QUAYPASSWORD quay.io
- run:
name: Quay Push
command: docker push $QUAY_IMAGE_NAME:$CIRCLE_BRANCH
- run:
name: Docker Build
command: make docker
- run:
name: Docker Login
command: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- run:
name: Docker Push
command : docker push $DOCKER_IMAGE_NAME:$CIRCLE_BRANCH
# quay build
- run:
name: Quay.io Build
command: docker build -t $QUAY_IMAGE_NAME -t $QUAY_IMAGE_NAME:$CIRCLE_BRANCH .
- run:
name: Quay Login
command: docker login -u $QUAYLOGIN -p $QUAYPASSWORD quay.io
- run:
name: Quay Push
command: docker push $QUAY_IMAGE_NAME:$CIRCLE_BRANCH
- run:
name: Docker Build
command: make docker
- run:
name: Docker Login
command: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- run:
name: Docker Push
command: docker push $DOCKER_IMAGE_NAME:$CIRCLE_BRANCH

release:
executor: golang
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "f5:e9:3e:54:1e:4d:db:c8:14:27:1f:8d:60:9f:4e:f5"
- run:
name: Release binaries
command: |
go install github.com/prometheus/[email protected]
curl -sL https://git.io/goreleaser | bash
- checkout
- add_ssh_keys:
fingerprints:
- "f5:e9:3e:54:1e:4d:db:c8:14:27:1f:8d:60:9f:4e:f5"
- run:
name: Release binaries
command: |
go install github.com/prometheus/[email protected]
curl -sL https://git.io/goreleaser | bash
workflows:
version: 2
Expand Down
38 changes: 19 additions & 19 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ linters:
- wsl

issues:
exclude-rules:
- text: "type `typedDesc` is unused"
linters:
- unused
- text: "rewrite if-else to switch statement"
linters:
- gocritic
- text: "consider giving a name to these results"
linters:
- gocritic
- text: "Subprocess launched with a potential tainted input or cmd arguments"
linters:
- gosec
- text: "if statements should only be cuddled with assignments"
linters:
- wsl
- text: "Error return value of"
linters:
errcheck
exclude-rules:
- text: "type `typedDesc` is unused"
linters:
- unused
- text: "rewrite if-else to switch statement"
linters:
- gocritic
- text: "consider giving a name to these results"
linters:
- gocritic
- text: "Subprocess launched with a potential tainted input or cmd arguments"
linters:
- gosec
- text: "if statements should only be cuddled with assignments"
linters:
- wsl
- text: "Error return value of"
linters:
errcheck
12 changes: 6 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch

archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
Expand All @@ -38,8 +38,8 @@ archives:
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
- goos: windows
format: zip

snapshot:
name_template: "{{ .Tag }}-snapshot"
22 changes: 22 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
commas: disable
comments: disable
comments-indentation: disable
document-start: disable
indentation:
spaces: consistent
indent-sequences: consistent
line-length: disable
truthy:
ignore: |
config/fixtures/licenses.yml
.github/workflows/build.yml
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PREFIX ?= $(shell pwd)
BIN_DIR ?= $(shell pwd)

.PHONY: all
all: clean format vet golangci build test
all: clean format vet golangci yamllint build test

.PHONY: test
test:
Expand All @@ -47,6 +47,15 @@ golangci: $(GOLINTER)
@echo ">> linting code"
@$(GOLINTER) run --config ./.golangci.yml

.PHONY: yamllint
yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell which yamllint))
@echo "yamllint not installed so skipping"
else
yamllint .
endif

.PHONY: build
build: $(PROMU)
@echo ">> building binaries"
Expand Down

0 comments on commit f4eac06

Please sign in to comment.