Permalink
Fetching contributors…
Cannot retrieve contributors at this time
128 lines (117 sloc) 4.52 KB
# Node CircleCI 2.0 configuration file to DTA cloud 2.0
version: 2
jobs:
# DEPLOY-STAGING JOB
# installing dependencies, building assets and deploying to staging
build-and-test-uikit:
docker:
- image: circleci/node:8.12.0 # NodeLTS as of 10/2018
working_directory: ~/uikit
steps:
- checkout # get the files from the repo (why would you ever not want the files????)
- run:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
name: Install packages for puppeteer
command: sudo apt install -yq --no-install-recommends gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdbus-1-3 libgconf-2-4 libgtk-3-0 libnspr4 libxcomposite1 libxcursor1 libxi6 libxrandr2 libxss1 libxtst6 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
- run:
name: Install dependencies
command: npm install # duh
- run:
name: Bootstrap the packages
command: npm run bootstrap # installing all dependencies of all packages
- run:
name: Build all packages
command: npm run build # installing all dependencies of all packages
- run:
name: Run all tests
command: npm test
- persist_to_workspace:
root: ~/uikit
paths:
- packages/*/tests/
- .deploy/
- index.html
deploy-staging:
docker:
- image: govau/cf-cli
steps:
- attach_workspace:
at: ~/uikit
- run:
name: Deploying to y.cld.gov.au
command: |
cd ~/uikit
mkdir -p site/
cp .deploy/nginx/mime.types site/
cp .deploy/nginx/.htpasswd site/
mv .deploy/nginx/nginx-staging.conf site/nginx.conf
mv packages/ site/
mv index.html site/
mv .deploy/manifest-staging.yml site/
cd site/
cf login -a $CF_API_STAGING -o $CF_ORG_STAGING -s $CF_SPACE_STAGING -u $CF_USER_STAGING -p $CF_PASSWORD_STAGING
cf zero-downtime-push uikit -f manifest-staging.yml
deploy-testing:
docker:
- image: govau/cf-cli
steps:
- attach_workspace:
at: ~/uikit
- run:
name: Deploying to y.cld.gov.au
command: |
cd ~/uikit
mkdir -p site/
cp .deploy/nginx/mime.types site/
cp .deploy/nginx/.htpasswd site/
mv .deploy/nginx/nginx-testing.conf site/nginx.conf
mv packages/ site/
mv index.html site/
mv .deploy/manifest-testing.yml site/
cd site/
cf login -a $CF_API_STAGING -o $CF_ORG_STAGING -s $CF_SPACE_STAGING -u $CF_USER_STAGING -p $CF_PASSWORD_STAGING
cf zero-downtime-push uikit -f manifest-testing.yml
deploy-prod:
docker:
- image: govau/cf-cli
steps:
- attach_workspace:
at: ~/uikit
- run:
name: Deploying to b.cld.gov.au
command: |
cd ~/uikit
mkdir -p site/
cp .deploy/nginx/mime.types site/
mv .deploy/nginx/nginx-production.conf site/nginx.conf
mv packages/ site/
mv index.html site/
mv .deploy/manifest-production.yml site/
cd site/
cf login -a $CF_API_PROD -o $CF_ORG_PROD -s $CF_SPACE_PROD -u $CF_USER_PROD -p $CF_PASSWORD_PROD
cf zero-downtime-push uikit -f manifest-production.yml
# OUR WORKFLOW
# this is where we orchestrate our jobs
workflows:
version: 2
build-and-deploy:
jobs:
- build-and-test-uikit
- deploy-staging: # run deploy staging
filters:
branches:
only: develop # and only on the `develop` branch
requires:
- build-and-test-uikit
- deploy-testing: # run test branches
filters:
branches:
only: /.*-test/ # and only on the branches that end with `-test`
requires:
- build-and-test-uikit
- deploy-prod: # run deploy production
filters:
branches:
only: master # and only on the `master` branch
requires:
- build-and-test-uikit