Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gchiesa committed May 20, 2024
0 parents commit 8c153f7
Show file tree
Hide file tree
Showing 44 changed files with 2,992 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
15 changes: 15 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint Commit Messages
on:
push:
branches:
- master
pull_request:

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
54 changes: 54 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write
packages: write

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: ghcr-login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: golangci-lint
on:
push:
paths:
- '**.go'
branches:
- master
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.19'

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.50.0
args: -c .golang-ci.yml -v --timeout=5m
env:
GO111MODULES: off
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test and coverage

on: [push, pull_request]

jobs:
test:
strategy:
matrix:
go-version: [1.19.x]
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: go get
run: go get ./...

- name: go mod tidy
run: go mod tidy

- name: Run coverage
run: go test -race -coverprofile="coverage.out" -covermode=atomic ./...

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
run: bash <(curl -s https://codecov.io/bash)
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
golang-cli-template
vendor/
coverage.out
/dist
.envrc
manpages/
dist/
42 changes: 42 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
image: tetafro/golang-gcc:1.19-alpine

stages:
- lint
- build
- test
- release

lint:
stage: lint
before_script:
- wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.41.1
script:
- ./bin/golangci-lint run -c .golang-ci.yml
allow_failure: true

build:
stage: build
script:
- go build

test:
stage: test
script:
- go test -v -race "$(go list ./... | grep -v /vendor/)" -v -coverprofile=coverage.out
- go tool cover -func=coverage.out

release:
stage: release
image:
name: goreleaser/goreleaser:v0.164.0
entrypoint: ["/bin/bash", "-c"]
only:
refs:
- tags
variables:
GITLAB_TOKEN: $GITLAB_TOKEN

script:
- cd "$CI_PROJECT_DIR"
- goreleaser release --rm-dist
27 changes: 27 additions & 0 deletions .golang-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
linters-settings:
lll:
line-length: 180
linters:
enable-all: true
disable:
- testpackage
- forbidigo
- paralleltest
- exhaustivestruct
- varnamelen
- interfacer
- maligned
- scopelint
- golint
- varcheck
- nosnakecase
- deadcode
- ifshort
- structcheck
- rowserrcheck
- sqlclosecheck
- structcheck
- wastedassign
- exhaustruct
- nolintlint
- wrapcheck
Loading

0 comments on commit 8c153f7

Please sign in to comment.