Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proteus Initial implementation #2

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See: http://editorconfig.org
root = true

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

indent_style = tab
max_line_length = 80

[*.go]
indent_style = tab
max_line_length = 0

[*.md]
indent_size = 2
indent_style = space
max_line_length = 80
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
max_line_length = 0

[*.yml]
indent_style = space
indent_size = 2
max_line_length = 0

[*.editorconfig]
indent_style = space
indent_size = 2
max_line_length = 0
60 changes: 60 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Coverage Badge

on:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
name: Update coverage badge
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Run Test
run: |
go test ./... -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out

- name: Go Coverage Badge # Pass the `coverage.out` output to this action
uses: tj-actions/[email protected]
with:
filename: coverage.out

- name: Verify Changed files
uses: tj-actions/[email protected]
id: verify-changed-files
with:
files: README.md

- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "Coverage Reporter"
git add README.md
git commit -m "chore: Updated coverage badge."

- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}
18 changes: 10 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Go
name: Static Analysis

on: ["push", "pull_request"]
on:
push:
branches: ['master']
pull_request:
branches: ['**']

jobs:
ci:
Expand All @@ -9,16 +13,14 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
go: ["1.18.5", "1.19"]
go: ["1.18", "1.19"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: WillAbides/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- run: "go test ./..."
- run: "go test --race ./..."
- run: "go vet ./..."
- uses: dominikh/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.out
25 changes: 25 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
linters:
disable-all: true
enable:
- deadcode
- errcheck
- exportloopref
- goimports
- revive
- gosimple
- ineffassign
- misspell
- prealloc
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- typecheck
- unconvert
- unused
- varcheck
- vet

linters-settings:
goimports:
local-prefixes: github.com/simplesurance/proteus
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
all: check

check:
staticcheck ./...
go test --race ./...

cover:
go test ./... -covermode=count -coverprofile=coverage.out
go tool cover -html=coverage.out
Loading