-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: enable circleci
- Loading branch information
Showing
4 changed files
with
69 additions
and
61 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,12 +1,16 @@ | ||
version: 2 | ||
version: 2.1 | ||
docker_job_setup: &docker_job | ||
docker: | ||
- image: circleci/golang:1.13.6 | ||
working_directory: /go/src/github.com/VolantMQ/volantmq | ||
|
||
attach_workspace: &workspace | ||
attach_workspace: | ||
at: /go/src/github.com/VolantMQ/volantmq | ||
at: /go/src/github.com/VolantMQ | ||
|
||
orbs: | ||
codecov: codecov/[email protected] | ||
docker: circleci/[email protected] | ||
|
||
jobs: | ||
pull-sources: | ||
|
@@ -23,6 +27,7 @@ jobs: | |
lint: | ||
<<: *docker_job | ||
steps: | ||
- <<: *workspace | ||
- run: | ||
name: Install golangci-lint | ||
command: | | ||
|
@@ -36,74 +41,93 @@ jobs: | |
steps: | ||
- <<: *workspace | ||
- run: | ||
name: Setup Code Climate test-reporter | ||
command: | | ||
# download test reporter as a static binary | ||
mkdir -p /tmp/codeclimate | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/codeclimate/cc-test-reporter | ||
chmod +x /tmp/codeclimate/cc-test-reporter | ||
- run: | ||
shell: /bin/bash | ||
name: Tests | ||
command: | | ||
/tmp/codeclimate/cc-test-reporter before-build | ||
./go.test.sh | ||
/tmp/codeclimate/cc-test-reporter --coverage-input-type coverage --exit-code $? | ||
test-build-docker: | ||
./go.test.codecov.sh | ||
- codecov/upload: | ||
file: coverage.txt | ||
test-docker-build: | ||
<<: *docker_job | ||
steps: | ||
- <<: *workspace | ||
- run: | ||
name: Docker build | ||
command: | | ||
./dockerBuildLocal.sh | ||
build-docker: | ||
- setup_remote_docker | ||
- docker/build: | ||
dockerfile: local.Dockerfile | ||
image: volantmq/volantmq | ||
tag: 'latest' | ||
release-docker: | ||
<<: *docker_job | ||
steps: | ||
- <<: *workspace | ||
- setup_remote_docker | ||
- docker/build: | ||
dockerfile: local.Dockerfile | ||
lint-dockerfile: false | ||
treat-warnings-as-errors: false | ||
image: volantmq/volantmq | ||
tag: 'latest' | ||
- run: | ||
name: Docker build | ||
name: Tag docker image | ||
command: | | ||
./dockerBuildLocal.sh volantmq/volantmq:${CIRCLE_TAG} | ||
docker login -u \$DOCKER_USERNAME -p \$DOCKER_PASSWORD | ||
docker push volantmq/volantmq:${CIRCLE_TAG} | ||
docker tag volantmq/volantmq:latest volantmq/volantmq:${CIRCLE_TAG} | ||
- docker/check: | ||
docker-username: DOCKER_LOGIN | ||
docker-password: DOCKER_PASSWORD | ||
- docker/push: | ||
image: volantmq/volantmq | ||
tag: '${CIRCLE_TAG},latest' | ||
workflows: | ||
version: 2 | ||
version: 2.1 | ||
test-on-commit: | ||
jobs: | ||
- pull-sources: | ||
filters: | ||
tags: | ||
ignore: /.*/ | ||
- test: | ||
- lint: | ||
requires: | ||
- pull-sources | ||
filters: | ||
tags: | ||
ignore: /.*/ | ||
- test-build-docker: | ||
- test: | ||
requires: | ||
- lint | ||
filters: | ||
tags: | ||
ignore: /.*/ | ||
- test-docker-build: | ||
requires: | ||
- test | ||
filters: | ||
tags: | ||
ignore: /.*/ | ||
release: | ||
jobs: | ||
- pull-source: | ||
- pull-sources: | ||
filters: | ||
tags: | ||
only: /^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/ | ||
branches: | ||
ignore: /.*/ | ||
- lint: | ||
requires: | ||
- pull-sources | ||
filters: | ||
tags: | ||
only: /^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/ | ||
branches: | ||
ignore: /.*/ | ||
- test: | ||
requires: | ||
- pull-source | ||
- lint | ||
filters: | ||
tags: | ||
only: /^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/ | ||
branches: | ||
ignore: /.*/ | ||
- build-docker: | ||
- release-docker: | ||
context: volantmq | ||
requires: | ||
- test | ||
|
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
echo "starting tests" | ||
|
||
for pkg in $(go list ./... | grep -v main); do | ||
go test -coverprofile=$(echo ${pkg} | tr / -).cover ${pkg} | ||
done | ||
|
||
echo "mode: set" > c.out | ||
grep -h -v "^mode:" ./*.cover >> c.out | ||
rm -f *.cover | ||
|
||
echo "tests finished" |
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,6 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
echo "" > coverage.txt | ||
|
||
for d in $(go list ./... | grep -v vendor); do | ||
|