-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
3 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,44 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- releases/v*.*.* | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
id: go | ||
|
||
- name: Checkout code into the Go module directory | ||
uses: actions/checkout@v3 | ||
|
||
- name: Make .env file | ||
run: | | ||
touch ./.env | ||
echo "${{ secrets.DOT_ENV }}" > ./.env | ||
- name: Build | ||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: linux | ||
GOARCH: amd64 | ||
run: make build | ||
|
||
- name: Test | ||
run: make test | ||
|
||
- name: Publish coverage.html as an artifact | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: coverage | ||
path: artifacts/coverage.html |
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,28 @@ | ||
name: golang linter | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- releases/v*.*.* | ||
|
||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
id: go | ||
|
||
- name: Checkout code into the Go module directory | ||
uses: actions/checkout@v3 | ||
|
||
- name: Lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
args: --timeout=5m |
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 |
---|---|---|
|
@@ -15,4 +15,4 @@ build | |
artifacts | ||
|
||
# binary | ||
customerd | ||
main |
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 @@ | ||
ARTIFACT_DIR := artifacts | ||
|
||
build: go.sum | ||
go build -mod=readonly -o main main.go | ||
|
||
test: | ||
mkdir -p $(ARTIFACT_DIR) | ||
go test -covermode=count -coverprofile=$(ARTIFACT_DIR)/coverage.out ./... | ||
go tool cover -html=$(ARTIFACT_DIR)/coverage.out -o $(ARTIFACT_DIR)/coverage.html | ||
|
||
lint: | ||
golangci-lint run --timeout 5m0s --allow-parallel-runners | ||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s | ||
go mod verify | ||
|
||
clean: | ||
rm -rf build/ |
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