Skip to content

Commit

Permalink
Merge pull request #6 from gruntwork-io/setup-ci
Browse files Browse the repository at this point in the history
Setup CI
  • Loading branch information
brikis98 authored Feb 9, 2018
2 parents 069d76f + 968f7a1 commit f06752f
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 8 deletions.
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

0 comments on commit f06752f

Please sign in to comment.