-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jahnestacado/feature/workflows
Feature/workflows
- Loading branch information
Showing
9 changed files
with
208 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Build | ||
|
||
on: [ push ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18' ] | ||
name: Go ${{ matrix.go }} sample | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
- name: Upload test coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
if: matrix.go == '1.18' | ||
with: | ||
files: ./coverage.txt | ||
fail_ci_if_error: true | ||
verbose: true | ||
|
||
- name: Run linter | ||
run: make lint | ||
|
||
- name: Run vulnerabilities scan | ||
run: make scan | ||
|
||
tag: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- name: Bump version and push tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
WITH_V: true | ||
VERBOSE: true | ||
DEFAULT_BUMP: patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
tagged-release: | ||
name: "Tagged Release" | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: "${{ secrets.PAT }}" | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# This file contains all available configuration options | ||
# with their default values (in comments). | ||
|
||
# Options for analysis running. | ||
run: | ||
# The default concurrency value is the number of available CPU. | ||
concurrency: 8 | ||
|
||
# Timeout for analysis, e.g. 30s, 5m. | ||
# Default: 1m | ||
timeout: 5m | ||
|
||
# Exit code when at least one issue was found. | ||
# Default: 1 | ||
issues-exit-code: 1 | ||
|
||
# Include test files or not. | ||
# Default: true | ||
tests: false | ||
|
||
# Enables skipping of directories: | ||
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ | ||
# Default: true | ||
skip-dirs-use-default: true | ||
|
||
|
||
# Allow multiple parallel golangci-lint instances running. | ||
# If false (default) - golangci-lint acquires file lock on start. | ||
allow-parallel-runners: true | ||
|
||
|
||
# output configuration options | ||
output: | ||
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions | ||
# | ||
# Multiple can be specified by separating them by comma, output can be provided | ||
# for each of them by separating format name and path by colon symbol. | ||
# Output path can be either `stdout`, `stderr` or path to the file to write to. | ||
# Example: "checkstyle:report.json,colored-line-number" | ||
# | ||
# Default: colored-line-number | ||
format: colored-line-number | ||
|
||
# Print lines of code with issue. | ||
# Default: true | ||
print-issued-lines: true | ||
|
||
# Print linter name in the end of issue text. | ||
# Default: true | ||
print-linter-name: true | ||
|
||
# Make issues output unique by line. | ||
# Default: true | ||
uniq-by-line: true | ||
|
||
# Add a prefix to the output file references. | ||
# Default is no prefix. | ||
path-prefix: "" | ||
|
||
# Sort results by: filepath, line and column. | ||
sort-results: true | ||
|
||
|
||
linters: | ||
# Enable specific linter | ||
# https://golangci-lint.run/usage/linters/#enabled-by-default-linters | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- varcheck | ||
- goimports | ||
- gofmt | ||
|
||
|
||
# # Enable presets. | ||
# # https://golangci-lint.run/usage/linters | ||
# presets: | ||
# - bugs | ||
# - complexity | ||
# - error | ||
# - format | ||
# - import | ||
# - metalinter | ||
# - module | ||
# - performance | ||
# - sql | ||
# - style | ||
# - test | ||
# - unused | ||
|
||
issues: | ||
# Maximum count of issues with the same text. | ||
# Set to 0 to disable. | ||
# Default: 3 | ||
max-same-issues: 50 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
#help: @ List available tasks on this project | ||
help: | ||
@grep -E '[a-zA-Z\.\-]+:.*?@ .*$$' $(MAKEFILE_LIST)| tr -d '#' | awk 'BEGIN {FS = ":.*?@ "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
|
||
#test: @ Runs unit tests | ||
test: | ||
go test -race -v -coverprofile=coverage.txt -covermode=atomic | ||
|
||
#test: @ Runs performance tests | ||
bench: | ||
go test -bench=. | ||
|
||
#lint: @ Lints source code | ||
lint: | ||
docker run --rm -v ${CURDIR}:/app -w /app golangci/golangci-lint:v1.49.0 golangci-lint run -v | ||
|
||
#scan: @ Scans source code dependencies for vulnerabilities | ||
scan: | ||
go list -json -deps | docker run --rm -i sonatypecommunity/nancy:v1.0.29 sleuth | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
module github.com/jahnestacado/tlru | ||
|
||
go 1.13 | ||
go 1.18 | ||
|
||
require github.com/stretchr/testify v1.5.1 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v2 v2.2.2 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters