diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..74ed920 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,117 @@ +version: 2.1 + +executors: + build: + parameters: + go-version: + type: string + docker: + - image: circleci/golang:<< parameters.go-version >> + environment: + GO111MODULE: "on" + working_directory: /go/src/github.com/skanehira/tson + +commands: + go_mod_download: + steps: + - restore_cache: + name: Restore go modules cache + keys: + - go-modules-{{ checksum "go.sum" }} + + - run: go mod download + + - save_cache: + name: Save go modules cache + key: go-modules-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" + +jobs: + build: + parameters: + go-version: + type: string + + executor: + name: build + go-version: << parameters.go-version >> + + steps: + - checkout + + - go_mod_download + + lint: + parameters: + go-version: + type: string + golangci-lint-version: + type: string + + executor: + name: build + go-version: << parameters.go-version >> + + steps: + - checkout + + - go_mod_download + + - run: + name: Install GolangCI-Lint + command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v<< parameters.golangci-lint-version >> + + - run: + name: Run GolangCI-Lint + command: ./bin/golangci-lint run --disable-all --enable=goimports --enable=govet + + release: + parameters: + go-version: + type: string + + executor: + name: build + go-version: << parameters.go-version >> + + steps: + - checkout + - go_mod_download + - run: + name: Run goreleaser + command: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist + +workflows: + stable-build: + jobs: + - lint: + go-version: "1.13.3" + golangci-lint-version: "1.17.1" + - build: + go-version: "1.13.3" + requires: + - lint + + latest-build: + jobs: + - lint: + go-version: "1.13.3" + golangci-lint-version: "1.17.1" + - build: + go-version: "1.13.3" + requires: + - lint + + release: + jobs: + - lint: + go-version: "1.13.3" + golangci-lint-version: "1.17.1" + - release: + go-version: "1.13.3" + filters: + branches: + ignore: /.*/ + tags: + only: /[0-9]+(\.[0-9]+)(\.[0-9]+)/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..2def6fa --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,21 @@ +project_name: tson + +builds: + - env: + - CGO_ENABLED=0 + - GO111MODULE=on + +archives: + - replacements: + darwin: Darwin + linux: Linux + amd64: x86_64 + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + skip: true