Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup CI #6

Merged
merged 4 commits into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions aws/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ func createTestEC2Instance(t *testing.T, session *session.Session, name string)
Owners: []*string{awsgo.String("self"), awsgo.String("amazon")},
Filters: []*ec2.Filter{
&ec2.Filter{
Name: awsgo.String("root-device-type"),
Values: []*string{awsgo.String("ebs")},
},
&ec2.Filter{
Name: awsgo.String("virtualization-type"),
Values: []*string{awsgo.String("hvm")},
Name: awsgo.String("name"),
Values: []*string{awsgo.String("amzn-ami-hvm-2017.09.1.20180115-x86_64-gp2")},
},
},
})
Expand All @@ -36,7 +32,7 @@ func createTestEC2Instance(t *testing.T, session *session.Session, name string)

params := &ec2.RunInstancesInput{
ImageId: awsgo.String(imageID),
InstanceType: awsgo.String("t1.micro"),
InstanceType: awsgo.String("t2.micro"),
MinCount: awsgo.Int64(1),
MaxCount: awsgo.Int64(1),
}
Expand All @@ -47,7 +43,7 @@ func createTestEC2Instance(t *testing.T, session *session.Session, name string)
}

if len(runResult.Instances) == 0 {
assert.Fail(t, "Could not create test EC2 instance")
assert.Fail(t, "Could not create test EC2 instance in "+*session.Config.Region)
}

err = svc.WaitUntilInstanceExists(&ec2.DescribeInstancesInput{
Expand Down
95 changes: 95 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
defaults: &defaults
working_directory: /go/src/github.com/gruntwork-io/aws-nuke
docker:
- image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:latest

version: 2
jobs:
install_dependencies:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
- restore_cache:
keys:
- dep-{{ checksum "Gopkg.lock" }}
- run: dep ensure
- save_cache:
key: dep-{{ checksum "Gopkg.lock" }}
paths:
- /go/src/github.com/gruntwork-io/aws-nuke/vendor
- persist_to_workspace:
root: .
paths: vendor

test:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
- run: run-go-tests --circle-ci-2

build:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
- run: build-go-binaries --circle-ci-2 --app-name aws-nuke --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG"
- persist_to_workspace:
root: .
paths: bin

deploy:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /go/src/github.com/gruntwork-io/aws-nuke
- run: upload-github-release-assets bin/*

workflows:
version: 2
build-and-test:
jobs:
- install_dependencies:
filters:
tags:
only: /^v.*/
- test:
requires:
- install_dependencies
filters:
tags:
only: /^v.*/
- build:
requires:
- test
filters:
tags:
only: /^v.*/

- deploy:
requires:
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/


nightly:
triggers:
- schedule:
cron: "0 6 * * *"
filters:
branches:
only: master
jobs:
- install_dependencies
- test:
requires:
- install_dependencies