Skip to content

Commit

Permalink
chore: setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Oct 28, 2021
1 parent 024077e commit fb6aafa
Show file tree
Hide file tree
Showing 71 changed files with 415 additions and 220 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# http://editorconfig.org/

root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[{*.go, go.mod}]
indent_style = tab
indent_size = 4

[{*.yml,*.yaml}]
indent_style = space
indent_size = 2

[*.py]
indent_style = space
indent_size = 4

# Makefiles always use tabs for indentation
[Makefile]
indent_style = tab
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
26 changes: 26 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 366

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug
- blocked
- protected
- triaged

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI
on:
push:
tags:
- v*
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.17

- name: Get Go environment
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/[email protected]
with:
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
key: test-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
test-${{ runner.os }}-go-
- name: Download dependencies
run: go mod download && go mod tidy

- name: Run tests
run: make test
12 changes: 12 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Lint Commit Messages
on: [pull_request]

jobs:
commitlint:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: wagoid/[email protected]
72 changes: 72 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Coverage
on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.17

- name: Get Go environment
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/[email protected]
with:
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
key: test-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
test-${{ runner.os }}-go-
- name: Checkout code
uses: actions/[email protected]

- name: Download dependencies
run: go mod download && go mod tidy

- name: Run tests with coverage
run: make coverage

- name: Upload artifact
uses: actions/[email protected]
with:
name: coverage
path: profile.out
if-no-files-found: error
retention-days: 1

- name: Send coverage
uses: codecov/[email protected]
with:
file: profile.out

upload:
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Download artifact
uses: actions/[email protected]
with:
name: coverage

- name: Send coverage
uses: codecov/[email protected]
with:
file: profile.out
94 changes: 94 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
workflow_dispatch:

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.17

- name: Lint
uses: golangci/[email protected]
with:
version: latest
args: --timeout 5m
skip-go-installation: true

# Check if there are any dirty changes after go mod tidy
check-mod:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.17

- name: Get Go environment
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/[email protected]
with:
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
key: check-mod-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
check-mod-${{ runner.os }}-go-
- name: Download dependencies
run: go mod download && go mod tidy

- name: Check git diff
run: git diff --exit-code

# Check if there are any dirty changes after go generate
check-generate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.17

- name: Get Go environment
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/[email protected]
with:
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
key: check-generate-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
check-generate-${{ runner.os }}-go-
- name: Download dependencies
run: go mod download && go mod tidy

- name: Check git diff
run: git diff --exit-code
27 changes: 27 additions & 0 deletions .github/workflows/pr-extra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Extra
on:
push:
tags:
- v*
branches:
- main
pull_request:
workflow_dispatch:

jobs:
vulns:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Install Go
uses: actions/[email protected]
with:
go-version: 1.17

- name: List dependencies
run: go list -json -m all > go.list

- name: Run nancy
uses: sonatype-nexus-community/[email protected]
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
/bug_test.go
/coverage.txt
/.idea
.idea
_bin/*
./examples

*-fuzz.zip

*.out
*.dump
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

21 changes: 0 additions & 21 deletions Gopkg.lock

This file was deleted.

26 changes: 0 additions & 26 deletions Gopkg.toml

This file was deleted.

Loading

0 comments on commit fb6aafa

Please sign in to comment.