Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nieomylnieja committed Dec 4, 2023
0 parents commit d15afd3
Show file tree
Hide file tree
Showing 54 changed files with 3,796 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @nieomylnieja
30 changes: 30 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"schedule:nonOfficeHours", // https://docs.renovatebot.com/presets-schedule/#schedulenonofficehours
":enableVulnerabilityAlertsWithLabel(security)", // https://docs.renovatebot.com/presets-default/#enablevulnerabilityalertswithlabelarg0
"group:recommended", // https://docs.renovatebot.com/presets-group/#grouprecommended
"workarounds:all", // https://docs.renovatebot.com/presets-workarounds/#workaroundsall
],
"reviewersFromCodeOwners": true,
"dependencyDashboard": true,
"semanticCommits": "disabled",
"labels": ["dependencies", "renovate"],
"prHourlyLimit": 1,
"prConcurrentLimit": 5,
"rebaseWhen": "conflicted",
"rangeStrategy": "pin",
"branchPrefix": "renovate_",
// Manager-specific configs:
// This will run go mod tidy after each go.mod update.
"postUpdateOptions": ["gomodTidy"],
// Custom version extraction from Makefile.
"regexManagers": [
{
"fileMatch": ["^Makefile$"],
"matchStrings": [
".*renovate datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\n.*?_VERSION\\s?:=\\s?(?<currentValue>.*)\\s"
]
}
],
}
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI checks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Set up prerequisites - node and yarn
uses: actions/setup-node@v3
- name: Set up yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run spell and markdown checkers
run: make check/spell check/trailing check/markdown
- name: Check formatting
run: make check/format
- name: Run go vet
run: make check/vet
- name: Run golangci-lint
run: make check/lint
- name: Run Gosec Security Scanner
run: make check/gosec
- name: Run unit tests
run: make test
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Release Binaries
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
24 changes: 24 additions & 0 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Scan vulnerabilities
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run at 8:00 AM every weekday.
- cron: '0 8 * * 1-5'
jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version-file: go.mod
check-latest: true
- name: Run Golang Vulncheck
run: make check/vulns
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
vendor/

# Go workspace file
go.work

# Node
node_modules/
yarn.lock
yarn-error.log
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "test/bats"]
path = test/bats
url = https://github.com/bats-core/bats-core.git
[submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert
url = https://github.com/bats-core/bats-assert.git
[submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support
url = https://github.com/bats-core/bats-assert.git
91 changes: 91 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
run:
timeout: 5m
modules-download-mode: readonly
skip-dirs:
- scripts
- test
skip-dirs-use-default: true

issues:
# Enable all checks (which was as default disabled e.g. comments).
exclude-use-default: false
# Value 0 means show all.
max-issues-per-linter: 0
max-same-issues: 0

linters-settings:
revive:
rules:
- name: package-comments
disabled: true
goimports:
# Put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes.
local-prefixes: github.com/nieomylnieja/go-libyear
govet:
# False positives and reporting on error shadowing (which is intended).
# Quoting Robi Pike:
# The shadow code is marked experimental.
# It has too many false positives to be enabled by default, so this is not entirely unexpected,
# but don't expect a fix soon. The right way to detect shadowing without flow analysis is elusive.
# Few years later (comment from 2015) and the Shadow analyer is still experimental...
check-shadowing: false
lll:
line-length: 120
gocritic:
enabled-tags:
- opinionated
exhaustive:
default-signifies-exhaustive: true
errcheck:
exclude-functions:
- Body.Close()
misspell:
locale: US

linters:
disable-all: true
enable:
# All linters from list https://golangci-lint.run/usage/linters/ are speciefed here and explicit enable/disable.
- asasalint
- asciicheck
- bodyclose
- errcheck
- exhaustive
- exportloopref
- gocheckcompilerdirectives
- gochecknoinits
- gocritic
- godot
- gofmt
- goheader
- goimports
- goprintffuncname
- gosimple
- govet
- importas
- ireturn
- ineffassign
- lll
- makezero
- mirror
- misspell
- nakedret
- nilerr
- nilnil
- prealloc
- predeclared
- revive
- rowserrcheck
- sloglint
- staticcheck
- tenv
- testifylint
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- wastedassign
- whitespace
24 changes: 24 additions & 0 deletions .gorelaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
project_name: go-libyear

release:
github:
owner: nieomylnieja
name: go-libyear

builds:
- main: ./cmd/
binary: go-libyear
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
ldflags: -X main.Version={{.Version}} -X main.GitTag={{.Tag}} -X main.BuildDate={{.Date}}
env:
- CGO_ENABLED=0

checksum:
name_template: {{ .ProjectName }}-{{ .Version }}-SHA256SUMS'
algorithm: sha256
Loading

0 comments on commit d15afd3

Please sign in to comment.