-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
5 changed files
with
54 additions
and
38 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 |
---|---|---|
@@ -1,51 +1,53 @@ | ||
defaults: &defaults | ||
working_directory: /go/src/moul.io/golang-repo-template | ||
docker: | ||
- image: circleci/golang:1.12 | ||
environment: | ||
GO111MODULE: "on" | ||
version: 2.1 | ||
|
||
install_retry: &install_retry | ||
run: | ||
name: install retry | ||
command: | | ||
command -v wget &>/dev/null && wget -O /tmp/retry "https://github.com/moul/retry/releases/download/v0.5.0/retry_$(uname -s)_$(uname -m)" || true | ||
if [ ! -f /tmp/retry ]; then command -v curl &>/dev/null && curl -L -o /tmp/retry "https://github.com/moul/retry/releases/download/v0.5.0/retry_$(uname -s)_$(uname -m)"; fi | ||
chmod +x /tmp/retry | ||
/tmp/retry --version | ||
executors: | ||
golang: | ||
working_directory: /go/src/moul.io/golang-repo-template | ||
docker: | ||
- image: circleci/golang:1.12 | ||
environment: | ||
GO111MODULE: "on" | ||
DOCKER_IMAGE: moul/golang-repo-template | ||
|
||
commands: | ||
install-retry: | ||
steps: | ||
- run: command -v wget &>/dev/null && wget -O /tmp/retry "https://github.com/moul/retry/releases/download/v0.5.0/retry_$(uname -s)_$(uname -m)" || true | ||
- run: if [ ! -f /tmp/retry ]; then command -v curl &>/dev/null && curl -L -o /tmp/retry "https://github.com/moul/retry/releases/download/v0.5.0/retry_$(uname -s)_$(uname -m)"; fi | ||
- run: chmod +x /tmp/retry | ||
- run: /tmp/retry --version | ||
install-golangci-lint: | ||
steps: | ||
- run: /tmp/retry -m 3 curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0 | ||
|
||
orbs: | ||
codecov: codecov/codecov@1.0.2 | ||
|
||
version: 2 | ||
jobs: | ||
go.build: | ||
<<: *defaults | ||
go-build: | ||
executor: golang | ||
steps: | ||
- checkout | ||
- *install_retry | ||
- install-retry | ||
- run: /tmp/retry -m 3 go mod download | ||
- run: /tmp/retry -m 3 make install | ||
- run: /tmp/retry -m 3 go test -v ./... | ||
- run: /tmp/retry -m 3 curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0 | ||
- run: /tmp/retry -m 3 make test | ||
- install-golangci-lint | ||
- run: PATH=$PATH:$(pwd)/bin /tmp/retry -m 3 make lint | ||
- codecov/upload: | ||
file: coverage.txt | ||
|
||
docker.build: | ||
<<: *defaults | ||
docker-build: | ||
executor: golang | ||
steps: | ||
- checkout | ||
#- run: | ||
# name: Install Docker Compose | ||
# command: | | ||
# umask 022 | ||
# curl -L https://github.com/docker/compose/releases/download/1.11.4/docker-compose-`uname -s`-`uname -m` > ~/docker-compose | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- *install_retry | ||
- run: /tmp/retry -m 3 docker build -t moul/golang-repo-template . | ||
|
||
- install-retry | ||
- run: /tmp/retry -m 3 docker build -t ${DOCKER_IMAGE} . | ||
|
||
workflows: | ||
version: 2 | ||
build_and_integration: | ||
main: | ||
jobs: | ||
- go.build | ||
- docker.build | ||
# requires: docker.build? | ||
- go-build | ||
- docker-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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*~ | ||
*# | ||
.#* | ||
coverage.txt | ||
|
||
# Vendors | ||
node_modules/ | ||
|
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
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,6 @@ | ||
package main | ||
|
||
func Example() { | ||
main() | ||
// Output: Hello World! | ||
} |