-
Notifications
You must be signed in to change notification settings - Fork 234
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
1 parent
22af4f8
commit 3a3b8eb
Showing
2 changed files
with
68 additions
and
169 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,97 +1,86 @@ | ||
version: 2 | ||
jobs: | ||
test: | ||
|
||
orbs: | ||
codecov: circleci/[email protected] | ||
|
||
executors: | ||
go: | ||
docker: | ||
- image: circleci/golang:1.10 | ||
- image: circleci/golang:1.10 | ||
working_directory: /go/src/github.com/CircleCI-Public/circleci-cli | ||
|
||
jobs: | ||
test: | ||
executor: go | ||
steps: | ||
- checkout | ||
- run: | ||
command: make test | ||
- checkout | ||
- run: make test | ||
coverage: | ||
docker: | ||
- image: circleci/golang:1.10 | ||
working_directory: /go/src/github.com/CircleCI-Public/circleci-cli | ||
executor: go | ||
steps: | ||
- checkout | ||
- run: | ||
command: make cover | ||
- store_artifacts: | ||
path: ./coverage.txt | ||
destination: coverage.txt | ||
- run: | ||
name: Upload Coverage Results | ||
command: | | ||
curl --request POST --retry 3 --silent --show-error --fail --data-binary @coverage.txt \ | ||
"https://codecov.io/upload/v2?service=circleci\ | ||
&token=$CODECOV_TOKEN\ | ||
&commit=$CIRCLE_SHA1\ | ||
&branch=$CIRCLE_BRANCH\ | ||
&build=$CIRCLE_BUILD_NUM\ | ||
&job=$CIRCLE_NODE_INDEX\ | ||
&build_url=$CIRCLE_BUILD_URL\ | ||
&slug=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME\ | ||
&pr=$CIRCLE_PR_NUMBER" | ||
- checkout | ||
- run: make cover | ||
- store_artifacts: | ||
path: ./coverage.txt | ||
destination: coverage.txt | ||
- codecov/upload: | ||
path: coverage.txt | ||
|
||
lint: | ||
docker: | ||
- image: supinf/gometalinter:latest | ||
environment: | ||
CGO_ENABLED: 0 | ||
- image: supinf/gometalinter:latest | ||
working_directory: /go/src/github.com/CircleCI-Public/circleci-cli | ||
steps: | ||
- checkout | ||
- run: | ||
command: gometalinter --deadline 60s --vendor ./... | ||
- checkout | ||
- run: | ||
command: CGO_ENABLED=0 gometalinter --deadline 60s --vendor ./... --exclude=/usr/local/go/ | ||
deploy: | ||
docker: | ||
- image: circleci/golang:1.10 | ||
working_directory: /go/src/github.com/CircleCI-Public/circleci-cli | ||
executor: go | ||
environment: | ||
GORELEASER_URL: https://github.com/goreleaser/goreleaser/releases/download/v0.77.1/goreleaser_amd64.deb | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v2-goreleaser- | ||
- run: | ||
name: Install GoReleaser | ||
command: | | ||
[ -f ~/goreleaser_amd64.db ] || curl --silent --location --fail --retry 3 $GORELEASER_URL > ~/goreleaser_amd64.deb | ||
sudo apt install ~/goreleaser_amd64.deb | ||
- run: | ||
name: Tag Repo | ||
command: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Marc O'Morain" | ||
git tag -a "v0.1.$CIRCLE_BUILD_NUM" -m "Release v0.1.$CIRCLE_BUILD_NUM" | ||
git push origin "v0.1.$CIRCLE_BUILD_NUM" | ||
- run: | ||
name: Release | ||
command: goreleaser | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- run: | ||
name: Build Docker Image | ||
command: | | ||
docker build -t circlecidx/circleci-cli:0.1.$CIRCLE_BUILD_NUM . | ||
docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD | ||
docker push circlecidx/circleci-cli:0.1.$CIRCLE_BUILD_NUM | ||
- save_cache: | ||
key: v2-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }} | ||
paths: | ||
- ~/goreleaser_amd64.deb | ||
- checkout | ||
- restore_cache: | ||
keys: [v2-goreleaser-] | ||
- run: | ||
name: Install GoReleaser | ||
command: | | ||
[ -f ~/goreleaser_amd64.db ] || curl --silent --location --fail --retry 3 $GORELEASER_URL > ~/goreleaser_amd64.deb | ||
sudo apt install ~/goreleaser_amd64.deb | ||
- run: | ||
name: Tag Repo | ||
command: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Marc O'Morain" | ||
git tag -a "v0.1.$CIRCLE_BUILD_NUM" -m "Release v0.1.$CIRCLE_BUILD_NUM" | ||
git push origin "v0.1.$CIRCLE_BUILD_NUM" | ||
- run: | ||
name: Release | ||
command: goreleaser | ||
- setup_remote_docker: | ||
docker_layer_caching: true | ||
- run: | ||
name: Build Docker Image | ||
command: | | ||
docker build -t circlecidx/circleci-cli:0.1.$CIRCLE_BUILD_NUM . | ||
docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD | ||
docker push circlecidx/circleci-cli:0.1.$CIRCLE_BUILD_NUM | ||
- save_cache: | ||
key: v2-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }} | ||
paths: [~/goreleaser_amd64.deb] | ||
|
||
workflows: | ||
version: 2 | ||
ci: | ||
jobs: | ||
- test | ||
- coverage | ||
- lint | ||
- deploy: | ||
filters: | ||
branches: | ||
only: master | ||
requires: | ||
- test | ||
- coverage | ||
- lint | ||
- test | ||
- coverage | ||
- lint | ||
- deploy: | ||
requires: | ||
- test | ||
- coverage | ||
- lint | ||
filters: | ||
branches: | ||
only: master |