Skip to content

Commit

Permalink
Migrate to CircleCI 2.0 (#40)
Browse files Browse the repository at this point in the history
* Migrate to CircleCI 2.0

* fix commands format

* fix lang name

* remove sudo

* install software-properties-common

* use official go image

* use full paths

* tweak PATH

* use golang-glide

* tweak

* tweak go path

* hmm

* hmmm

* omg

* fuga

* ahh

* sigh

* add gocsv to glide

* tweak
  • Loading branch information
Hayato Matsuura authored Apr 1, 2018
1 parent d2360ec commit 4a3d54c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 28 deletions.
72 changes: 72 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
version: 2
jobs:
test:
docker:
- image: golang:1.10-stretch
environment:
GOROOT: ""
GOPATH: "/root/.go_project"
PATH: "/root/.go_project/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/go/bin"
IMPORT_PATH: "github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
steps:
- checkout
- run:
name: Install prerequired packges
command: |
apt update
apt install -y software-properties-common python3-software-properties
apt install -y librrd-dev golang-glide
mkdir -p $GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME
cd $GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME
ln -s /root/project $CIRCLE_PROJECT_REPONAME
cd $CIRCLE_PROJECT_REPONAME
glide i
- run:
name: Run tests
command: |
cd $GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
go test
deploy:
docker:
- image: golang:1.10-stretch
environment:
GOROOT: ""
GOPATH: "/root/.go_project"
PATH: "/root/.go_project/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/go/bin"
IMPORT_PATH: "github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
steps:
- checkout
- run:
name: Install prerequired packges
command: |
apt update
apt install -y software-properties-common python3-software-properties
apt install -y librrd-dev golang-glide
mkdir -p $GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME
cd $GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME
ln -s /root/project $CIRCLE_PROJECT_REPONAME
cd $CIRCLE_PROJECT_REPONAME
glide i
- run:
name: Deploy
tag: /v[0-9]+(\.[0-9]+)+/
command: |
cd $GOPATH/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
go get github.com/mitchellh/gox
go get github.com/tcnksm/ghr
gox -osarch "linux/amd64" -ldflags "-X main.Version=$BUILD_VERSION -X main.BuildDate=$BUILD_DATE" -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
gzip dist/*
ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace $(git describe --tags) dist/
workflows:
version: 2
test_and_deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
tags:
only: /v[0-9]+(\.[0-9]+)+/
branches:
ignore: /.*/
26 changes: 0 additions & 26 deletions circle.yml

This file was deleted.

6 changes: 4 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ import:
- package: github.com/BurntSushi/toml
version: ~0.2.0
- package: github.com/ziutek/rrd
- package: github.com/gocarina/gocsv

0 comments on commit 4a3d54c

Please sign in to comment.