-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#106] Refactor circleci config to remove deploy steps
- Loading branch information
Showing
1 changed file
with
28 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,134 +1,44 @@ | ||
# Javascript Node CircleCI 2.1 configuration file | ||
## Javascript Node CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
# | ||
version: 2.1 | ||
executors: | ||
docker-publisher: | ||
environment: | ||
IMAGE_NAME: italia/developers-italia-onboarding | ||
docker: | ||
- image: circleci/buildpack-deps:stretch | ||
jobs: | ||
build: | ||
# Check https://circleci.com/docs/2.0/ for more details | ||
|
||
references: | ||
working_directory: /tmp/onboarding | ||
|
||
load_image: &load_image | ||
docker: | ||
- image: circleci/node:lts | ||
|
||
working_directory: ~/repo | ||
steps: | ||
- checkout | ||
- run: | ||
name: npm install | ||
command: npm install | ||
- run: | ||
name: npm lint | ||
command: npm run lint | ||
docker-build-prod: | ||
executor: docker-publisher | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: Build Docker image | ||
command: | | ||
docker build -t $IMAGE_NAME:latest . | ||
- run: | ||
name: Archive Docker image | ||
command: docker save -o $IMAGE_NAME_PROD $IMAGE_NAME | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./*.tar | ||
docker-build-dev: | ||
executor: docker-publisher | ||
install_dependencies: &install_dependencies | ||
run: | ||
name: npm-install | ||
command: | | ||
npm install | ||
lint: &lint | ||
run: | ||
name: lint | ||
command: | | ||
npm run lint | ||
version: 2 | ||
jobs: | ||
test: | ||
<<: *load_image | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: Build Docker image | ||
command: | | ||
docker build -t $IMAGE_NAME:development . | ||
- run: | ||
name: Archive Docker image | ||
command: docker save -o $IMAGE_NAME_DEV $IMAGE_NAME | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./*.tar | ||
deploy-prod: | ||
machine: | ||
enabled: true | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: rsync -avz /tmp/workspace/$IMAGE_NAME_PROD circleci@$SSH_HOST:/tmp/$IMAGE_NAME_PROD | ||
- run: | ||
name: deploy on prod | ||
command: | | ||
ssh circleci@$SSH_HOST $SSH_COMMAND_PROD | ||
deploy-dev: | ||
machine: | ||
enabled: true | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: rsync -avz /tmp/workspace/$IMAGE_NAME_DEV circleci@$SSH_HOST:/tmp/$IMAGE_NAME_DEV | ||
- run: | ||
name: deploy on dev | ||
command: | | ||
ssh circleci@$SSH_HOST $SSH_COMMAND_DEV | ||
- << : *install_dependencies | ||
- << : *lint | ||
|
||
workflows: | ||
version: 2 | ||
# For any branch other than master, | ||
# run CI tests at each commit | ||
on-commit-test: | ||
jobs: | ||
- build: | ||
- test: | ||
filters: | ||
branches: | ||
ignore: | ||
- development | ||
- master | ||
on-commit-build-and-deploy_prod: | ||
jobs: | ||
- build: | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
- docker-build-prod: | ||
requires: | ||
- build | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
- deploy-prod: | ||
requires: | ||
- build | ||
- docker-build-prod | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
on-commit-build-and-deploy_dev: | ||
jobs: | ||
- build: | ||
filters: | ||
branches: | ||
only: | ||
- development | ||
- docker-build-dev: | ||
requires: | ||
- build | ||
filters: | ||
branches: | ||
only: | ||
- development | ||
- deploy-dev: | ||
requires: | ||
- build | ||
- docker-build-dev | ||
filters: | ||
branches: | ||
only: | ||
- development |