Skip to content

Commit

Permalink
include golangci-lint into ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
apenella committed Apr 17, 2024
1 parent 178afc6 commit 421263f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GOLANG_VERSION=1.22
GOLANG_VERSION=1.22
GOLANGCI_LINT_VERSION=v1.57.2
12 changes: 8 additions & 4 deletions .github/workflows/testing.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
run: |
make vet
- name: Execute golangci-lint
run: |
make golangci-lint
# - name: Execute errcheck
# run: |
# make errcheck
Expand All @@ -35,10 +39,10 @@ jobs:
fetch-depth: 0
- run: git fetch --force --tags

- uses: actions/setup-go@v3
with:
go-version: ^1.22
cache: true
# - uses: actions/setup-go@v3
# with:
# go-version: ^1.22
# cache: true

- name: Execute unit tests
run: |
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
DOCKER_COMPOSE_BINARY := $(shell docker compose version > /dev/null 2>&1 && echo "docker compose" || (which docker-compose > /dev/null 2>&1 && echo "docker-compose" || (echo "docker compose not found. Aborting." >&2; exit 1)))

GOLANG_BINARY := $(DOCKER_COMPOSE_BINARY) run --rm golang-ci go
GOLANGCI_LINT_BINARY := $(DOCKER_COMPOSE_BINARY) run --rm golangci-lint

## Colors
COLOR_GREEN=\033[0;32m
Expand Down Expand Up @@ -31,7 +32,7 @@ golangci-lint: ## Executes golangci-lint
@echo
@echo "$(COLOR_GREEN) Executing golangci-lint $(COLOR_END)"
@echo
@golangci-lint run
@$(GOLANGCI_LINT_BINARY) run

unit-test: ## Run unit tests
@echo
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# go-ansible

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Test](https://github.com/apenella/go-ansible/actions/workflows/testing.yml/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/apenella/go-ansible/v2)](https://goreportcard.com/report/github.com/apenella/go-ansible/v2) [![Go Reference](https://pkg.go.dev/badge/github.com/apenella/go-ansible/v2.svg)](https://pkg.go.dev/github.com/apenella/go-ansible/v2)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Test](https://github.com/apenella/go-ansible/actions/workflows/ci.yml/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/apenella/go-ansible/v2)](https://goreportcard.com/report/github.com/apenella/go-ansible/v2) [![Go Reference](https://pkg.go.dev/badge/github.com/apenella/go-ansible/v2.svg)](https://pkg.go.dev/github.com/apenella/go-ansible/v2)

![go-ansible-logo](docs/logo/go-ansible_logo.png "Go-ansible Logo" )

Expand Down
10 changes: 9 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ services:
volumes:
- .:/app
working_dir: /app
command: ["go", "version"]
command: ["go", "version"]

golangci-lint:
image: golangci/golangci-lint:${GOLANGCI_LINT_VERSION:-v1.57.2}-alpine
volumes:
- .:/app
working_dir: /app
entrypoint: ["golangci-lint"]
command: ["--version"]

0 comments on commit 421263f

Please sign in to comment.