Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
flc1125 committed Aug 20, 2024
0 parents commit 23caf9b
Show file tree
Hide file tree
Showing 36 changed files with 2,843 additions and 0 deletions.
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: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
23 changes: 23 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Go Static Analysis

on:
push:
branches:
- master
pull_request:
branches:
- master

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

- name: install nilaway
run: go install go.uber.org/nilaway/cmd/nilaway@latest

- name: nilaway
run: ~/go/bin/nilaway ./...
continue-on-error: true
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Go Lint

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Go Test
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
GOPROXY: "https://proxy.golang.org"

jobs:
test:
name: "go test"
strategy:
matrix:
go-version: [ 1。18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x ]
platform: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.platform }}

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Run tests
run: go test ./... -v -covermode=atomic -race -coverprofile=coverage.txt

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# 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/
.idea
_backup
_example
.todo
28 changes: 28 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
linters:
disable-all: true

enable:
- bodyclose
- dogsled
- durationcheck
- errcheck
- exportloopref
- govet
- gosimple
- gofmt
- gofumpt
- goconst
- goimports
- mnd
- gocyclo
- ineffassign
- lll
- prealloc
- revive
- staticcheck
- typecheck
- unused
- whitespace
- wastedassign
- unconvert
- misspell
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Go Kratos Ecosystem (https://github.com/flc1125, https://flc.io)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.PHONY: init
init:
go install mvdan.cc/gofumpt@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

.PHONY: lint
lint:
golangci-lint run
@echo "✅ Linting completed"

.PHONY: fix
fix:
golangci-lint run --fix
@echo "✅ Lint fixing completed"

.PHONY: test
test:
go test ./...
@echo "✅ Testing completed"

.PHONY: fmt
fmt:
gofmt -w -e "vendor" .
@echo "✅ Formatting completed"

.PHONY: fumpt
fumpt:
gofumpt -w -e "vendor" .
@echo "✅ Formatting completed"

.PHONY: nilaway-install
nilaway-install:
go install go.uber.org/nilaway/cmd/nilaway@latest

.PHONY: nilaway
nilaway:
nilaway ./...
@echo "✅ Nilaway completed"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# go-gitlab-webhook
13 changes: 13 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
coverage:
require_ci_to_pass: true

status:
project:
default:
target: 90%
threshold: 50%

patch:
default:
target: 90%
threshold: 80%
Loading

0 comments on commit 23caf9b

Please sign in to comment.