Skip to content

Instantly share code, notes, and snippets.

@atomaka
Created April 23, 2017 21:47
Show Gist options
  • Save atomaka/11260657749a464232d1443609c99ad0 to your computer and use it in GitHub Desktop.
Save atomaka/11260657749a464232d1443609c99ad0 to your computer and use it in GitHub Desktop.
Example .gitlab-ci.yml
stages:
- prepare
- analyze
- test
- build
- ship
variables:
DATABASE_HOST: "postgres"
build-test:
stage: prepare
script:
- docker build -t tma-test --build-arg BUNDLE_WITHOUT="" --build-arg RAILS_ENV=development .
tags:
- docker
rubocop:
stage: analyze
script:
- rubocop
image: tma-test
tags:
- docker
brakeman:
stage: analyze
script:
- brakeman
image: tma-test
tags:
- docker
bundler-audit:
stage: analyze
script:
- bundle-audit
image: tma-test
tags:
- docker
rubycritic:
stage: analyze
script:
- rubycritic --path tmp/analysis/rubycritic app
image: tma-test
tags:
- docker
allow_failure: true
artifacts:
paths:
- tmp/analysis/rubycritic
when: always
rails_best_practices:
stage: analyze
script:
- rails_best_practices --format html --output-file tmp/analysis .
image: tma-test
tags:
- docker
allow_failure: true
artifacts:
paths:
- tmp/analysis
when: always
sandi_meter:
stage: analyze
script:
- sandi_meter --path app/ --output-path tmp/analysis/sandi_meter --graph --quiet
image: tma-test
tags:
- docker
allow_failure: true
artifacts:
paths:
- tmp/analysis/sandi_meter
when: always
erd:
stage: test
script:
- bundle install
- bundle exec rake db:create db:migrate
- bundle exec erd
artifacts:
paths:
- erd.pdf
services:
- postgres:latest
when: manual
tags:
- ruby
rspec:
stage: test
script:
- RAILS_ENV=test bundle exec rake db:create db:migrate
- RAILS_ENV=test bundle exec rspec
artifacts:
paths:
- coverage/*
when: on_failure
image: tma-test
tags:
- docker
services:
- postgres:latest
build-deployable:
stage: build
script:
- docker build -t travel-manager-api .
tags:
- docker
only:
- tags
push-development:
stage: ship
script:
- docker build -t travel-manager-api .
- docker tag travel-manager-api:la
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment