-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add basic circleci config
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 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,65 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
golang: | ||
docker: | ||
- image: cimg/go:1.21 | ||
|
||
jobs: | ||
lint: | ||
executor: golang | ||
steps: | ||
- checkout | ||
# Download and cache dependencies | ||
- restore_cache: &restore-cache | ||
keys: | ||
- go-mod-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install dependencies | ||
command: | | ||
go mod download | ||
- run: | ||
name: Go fmt | ||
command: | | ||
RES="$(gofmt -s -l .)" | ||
if [ -n "${RES}" ] | ||
then | ||
echo "${RES}" | ||
exit 1 | ||
fi | ||
- run: | ||
name: Install golangci-lint | ||
command: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 | ||
- run: | ||
name: GolangCI Lint | ||
command: golangci-lint run | ||
- save_cache: &save-cache | ||
paths: | ||
- /home/circleci/go/pkg/mod | ||
key: go-mod-{{ checksum "go.sum" }} | ||
test: | ||
executor: golang | ||
steps: | ||
- setup_remote_docker | ||
- checkout | ||
- restore_cache: | ||
<<: *restore-cache | ||
- run: | ||
name: Install dependencies | ||
command: go mod download | ||
- run: | ||
name: Test | ||
command: | | ||
env | ||
unset DOCKER_MACHINE_NAME | ||
make test | ||
- save_cache: | ||
<<: *save-cache | ||
|
||
workflows: | ||
lint_test: | ||
jobs: | ||
- lint | ||
- test: | ||
requires: | ||
- lint |