This CloudFormation template will launch a continuous integration pipeline for Github using AWS Codebuild.
- New/Updated pull request webhooks from Github hit the API endpoint in AWS
- Github status is changed to pending if its a new or updated pull request, a Lambda is triggered to download the Github source to S3 bucket
- A CloudWatch rule detects the .zip download in S3 and triggers another Lambda to start Codebuild process using source
- Another CloudWatch rule detects Codebuild status on completion, and triggers a final Lambda to report back Github status with an included link to the build log.
$:> git clone https://github.com/bayko/codebuild-github-ci.git
$:> cd codebuild-github-ci
$:> cd lambda-github-webhook
$:> sudo ./package.sh
...
version: 0.2
phases:
install:
commands:
- bundle install
pre_build:
commands:
- export RAILS_ENV=test
build:
commands:
- bundle exec rake db:create
- bundle exec rake db:schema:load
- bundle exec rake db:migrate
post_build:
commands:
- bundle exec rspec
- bundle exec cucumber