Skip to content

Instantly share code, notes, and snippets.

@MarbilleJuntado
Created February 28, 2019 11:12
Show Gist options
  • Save MarbilleJuntado/3a9a10df846963e7c6215ca7cfdba494 to your computer and use it in GitHub Desktop.
Save MarbilleJuntado/3a9a10df846963e7c6215ca7cfdba494 to your computer and use it in GitHub Desktop.
application's semaphore configuration
version: v1.0
name: First pipeline example
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: "Setup"
task:
jobs:
- name: Install deps
commands:
- kiex install 1.6.6 && kiex use 1.6.6
- nvm install 9.11.1 && nvm use 9.11.1
- checkout
- mix do local.rebar --force, local.hex --force
- cache restore deps-$(checksum mix.lock)
- mix deps.get
- cache store deps-$(checksum mix.lock) deps
- cache restore node-modules-$(checksum apps/enterprise/yarn.lock)
- (cd apps/enterprise/ && yarn install)
- cache store node-modules-$(checksum apps/enterprise/yarn.lock) apps/enterprise/node_modules
- name: "Test"
task:
env_vars:
- name: MIX_ENV
value: test
- name: DATABASE_URL
value: postgres://postgres:postgres@0.0.0.0/enterprise_test
prologue:
commands:
- checkout
- cache restore deps-$(checksum mix.lock)
- cache restore build-$(checksum mix.lock)
- cache restore node-modules-$(checksum apps/enterprise/yarn.lock)
- docker build -t generative-test -f Dockerfile.test .
jobs:
- name: Lint CSS
commands:
- docker run -v "$(pwd):/app" generative-test sh -c 'cd apps/enterprise && yarn run lint:css'
- name: Lint JS
commands:
- docker run -v "$(pwd):/app" generative-test sh -c 'cd apps/enterprise && yarn prettier:check'
- name: Lint Elixir
commands:
- docker run -v "$(pwd):/app" generative-test sh -c 'mix credo --strict'
- name: Test Elixir
commands:
- docker run -v "$(pwd):/app" generative-test sh -c 'mix test'
task:
env_vars:
- name: AWS_DEFAULT_REGION
value: eu-west-2
- name: ECR_REGISTRY
value: [redacted].dkr.ecr.eu-west-2.amazonaws.com/generative
secrets:
- name: AWS
prologue:
commands:
- sudo pip install awscli
- checkout
- aws ecr get-login --no-include-email | bash
jobs:
- name: Build
commands:
- docker build -t generative -f Dockerfile.production .
- docker tag generative:latest "${ECR_REGISTRY}:latest"
- docker push "${ECR_REGISTRY}:latest"
- aws ecs update-service --cluster generative-staging --service generative-staging-app --force-new-deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment