Merge pull request #10 from twentyhq/charles-bochet-circleci

Add CI and CD to the project
This commit is contained in:
Charles Bochet
2022-12-28 12:03:14 +01:00
committed by GitHub
2 changed files with 68 additions and 1 deletions

67
.circleci/config.yml Normal file
View File

@@ -0,0 +1,67 @@
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@8.2.1
aws-ecs: circleci/aws-ecs@03.2.0
slack: circleci/slack@4.12.0
node: circleci/node@5.0.3
jobs:
tests:
executor: node/default
steps:
- checkout
- run:
command: cd front && npm install
name: install node dependencies
- run:
command: cd front && npm run test
name: tests
workflows:
build-and-deploy:
jobs:
- tests
- aws-ecr/build-and-push-image:
filters:
branches:
only: main
requires:
- tests
dockerfile: Dockerfile
registry-id: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
repo: $AWS_ECR_REPO
tag: $CIRCLE_SHA1
- aws-ecs/deploy-service-update:
name: deploy-canary
requires:
- aws-ecr/build-and-push-image
family: $AWS_ECS_CONTAINER_NAME_CANARY
cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_CANARY,tag=${CIRCLE_SHA1}"
- slack/on-hold:
name: slack-notification
context: slack-secrets
requires:
- deploy-canary
- hold:
type: approval
requires:
- slack-notification
- aws-ecs/deploy-service-update:
name: deploy-prod
requires:
- hold
family: $AWS_ECS_CONTAINER_NAME_DEFAULT
cluster: $AWS_ECS_CLUSTER
container-image-name-updates: "container=$AWS_ECS_CONTAINER_NAME_DEFAULT,tag=${CIRCLE_SHA1}"
post-steps:
- slack/notify:
event: pass
template: basic_success_1
- slack/notify:
event: fail
template: basic_fail_1

View File

@@ -25,7 +25,7 @@
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public",
"coverage": "react-scripts test --coverage"
"coverage": "react-scripts test --coverage --watchAll"
},
"eslintConfig": {
"extends": [