Skip to content

Commit

Permalink
chore(ci): Add circle ci tests for go
Browse files Browse the repository at this point in the history
  • Loading branch information
drubin committed Oct 24, 2018
1 parent aac49fd commit 772d6ef
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 13 deletions.
69 changes: 57 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,60 @@
#
version: 2
jobs:
build-go:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/garden-io/garden
steps:
- checkout
- restore_cache:
keys:
- pkg-cache-{{ checksum "Gopkg.lock" }}
- run:
name: Install dep
command: |
if [ ! -d /go/src/github.com/garden-io/garden/vendor ]; then
curl -L -s https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /go/bin/dep
chmod +x /go/bin/dep
/go/bin/dep ensure
fi
- save_cache:
key: pkg-cache-{{ checksum "Gopkg.lock" }}
paths:
- "/go/src/github.com/garden-io/garden/vendor"
- run:
name: Build All
command: |
cd garden-cli
package_name="garden"
platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/amd64")
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
env GOOS=$GOOS GOARCH=$GOARCH go build -o build/$output_name
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done
- store_artifacts:
path: garden-cli/build
destination: /downloads
test-node:
docker:
# specify the version you desire here
- image: circleci/node:10
steps:
- checkout
- run: sudo apt-get update && sudo apt-get install rsync
- setup_remote_docker:
docker_layer_caching: true

- run: sudo apt-get update && sudo apt-get install rsync

# Download and cache dependencies
- restore_cache:
keys:
Expand All @@ -25,6 +68,7 @@ jobs:
# Install npm deps
- run: npm ci
- run: node_modules/.bin/lerna bootstrap --ci

- save_cache:
paths: [node_modules]
key: root-{{ checksum "package-lock.json" }}
Expand All @@ -40,17 +84,18 @@ jobs:
# build, lint and run tests
- run:
name: npm build
command: npm run build
name: ci-build
command: npm run ci-build
- run:
name: npm lint
name: npm run lint
command: npm run lint
- run:
name: npm test
command: npm test
command: npm ci-test

workflows:
version: 2
all-tests:
jobs:
- test-node
version: 2
all-tests:
jobs:
- build-go
- test-node
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
"preversion": "npm test",
"release": "./bin/publish",
"release-canary": "./bin/publish-canary",
"test": "npm run lint && npm run clean && gulp test"
"test": "npm run lint && npm run clean && gulp test",
"ci-build": "gulp garden-service:build",
"ci-test": "gulp test"
},
"husky": {
"hooks": {
Expand Down

0 comments on commit 772d6ef

Please sign in to comment.