213 lines
5.0 KiB
YAML
213 lines
5.0 KiB
YAML
version: 2.1
|
|
orbs:
|
|
#snyk: snyk/snyk@0.0.8
|
|
#cypress: cypress-io/cypress@1.23.0
|
|
aws-s3: circleci/aws-s3@4.0.0
|
|
eb: circleci/aws-elastic-beanstalk@2.0.1
|
|
jira: circleci/jira@2.1.0
|
|
jobs:
|
|
api-deploy:
|
|
docker:
|
|
- image: cimg/node:18.18.2
|
|
steps:
|
|
- checkout
|
|
- eb/setup
|
|
- run:
|
|
command: |
|
|
eb init imex-online-production-api -r ca-central-1 -p "Node.js 18 running on 64bit Amazon Linux 2"
|
|
eb status --verbose
|
|
eb deploy
|
|
eb status
|
|
- jira/notify
|
|
|
|
hasura-migrate:
|
|
docker:
|
|
- image: cimg/node:16.15.0
|
|
parameters:
|
|
secret:
|
|
type: string
|
|
default: $HASURA_PROD_SECRET
|
|
working_directory: ~/repo/hasura
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
- run:
|
|
name: Execute migration
|
|
command: |
|
|
npm install hasura-cli -g
|
|
hasura migrate apply --endpoint https://db.imex.online/ --admin-secret << parameters.secret >>
|
|
hasura metadata apply --endpoint https://db.imex.online/ --admin-secret << parameters.secret >>
|
|
hasura metadata reload --endpoint https://db.imex.online/ --admin-secret << parameters.secret >>
|
|
|
|
app-build:
|
|
docker:
|
|
- image: cimg/node:16.15.0
|
|
|
|
working_directory: ~/repo/client
|
|
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
- run:
|
|
name: Install Dependencies
|
|
command: npm i
|
|
|
|
- run: npm run build
|
|
|
|
- aws-s3/sync:
|
|
from: build
|
|
to: "s3://imex-online-production/"
|
|
arguments: "--exclude '*.map'"
|
|
- jira/notify
|
|
|
|
app-beta-build:
|
|
docker:
|
|
- image: cimg/node:18.18.2
|
|
resource_class: xlarge
|
|
working_directory: ~/repo/client
|
|
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
- run:
|
|
name: Install Dependencies
|
|
command: npm i
|
|
|
|
- run: npm run build
|
|
|
|
- aws-s3/sync:
|
|
from: build
|
|
to: "s3://imex-online-beta/"
|
|
arguments: "--exclude '*.map'"
|
|
- jira/notify
|
|
|
|
test-hasura-migrate:
|
|
docker:
|
|
- image: cimg/node:16.15.0
|
|
parameters:
|
|
secret:
|
|
type: string
|
|
default: $HASURA_TEST_SECRET
|
|
working_directory: ~/repo/hasura
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
- run:
|
|
name: Execute migration
|
|
command: |
|
|
npm install hasura-cli -g
|
|
echo ${HASURA_TEST_SECRET}
|
|
hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >>
|
|
hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >>
|
|
hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >>
|
|
|
|
test-app-build:
|
|
docker:
|
|
- image: cimg/node:16.15.0
|
|
|
|
working_directory: ~/repo/client
|
|
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
- run:
|
|
name: Install Dependencies
|
|
command: npm i
|
|
|
|
- run: npm run build:test
|
|
|
|
- aws-s3/sync:
|
|
from: build
|
|
to: "s3://imex-online-test/"
|
|
arguments: "--exclude '*.map'"
|
|
- jira/notify
|
|
|
|
test-app-beta-build:
|
|
docker:
|
|
- image: cimg/node:18.18.2
|
|
resource_class: snaptsoft/pfic
|
|
working_directory: ~/repo/client
|
|
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
|
|
- run:
|
|
name: Install Dependencies
|
|
command: npm i
|
|
|
|
- run: npm run build:test
|
|
|
|
- aws-s3/sync:
|
|
from: build
|
|
to: "s3://imex-online-test-beta/"
|
|
arguments: "--exclude '*.map'"
|
|
- jira/notify
|
|
|
|
admin-app-build:
|
|
docker:
|
|
- image: cimg/node:16.15.0
|
|
|
|
working_directory: ~/repo/admin
|
|
|
|
steps:
|
|
- checkout:
|
|
path: ~/repo
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-{{ checksum "package.json" }}
|
|
# fallback to using the latest cache if no exact match is found
|
|
- v1-dependencies-
|
|
- run: npm i
|
|
|
|
- save_cache:
|
|
paths:
|
|
- node_modules
|
|
- ~/.npm
|
|
- ~/.cache
|
|
key: v1-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run: npm run build
|
|
|
|
- aws-s3/sync:
|
|
from: build
|
|
to: "s3://adm.imex.online/"
|
|
|
|
workflows:
|
|
deploy_and_build:
|
|
jobs:
|
|
- api-deploy:
|
|
filters:
|
|
branches:
|
|
only: master
|
|
- app-build:
|
|
filters:
|
|
branches:
|
|
only: master
|
|
- app-beta-build:
|
|
filters:
|
|
branches:
|
|
only: master-beta
|
|
- hasura-migrate:
|
|
secret: ${HASURA_PROD_SECRET}
|
|
filters:
|
|
branches:
|
|
only: master
|
|
- test-app-build:
|
|
filters:
|
|
branches:
|
|
only: test
|
|
- test-app-beta-build:
|
|
filters:
|
|
branches:
|
|
only: test-beta
|
|
- test-hasura-migrate:
|
|
secret: ${HASURA_TEST_SECRET}
|
|
filters:
|
|
branches:
|
|
only: test
|
|
#- admin-app-build:
|
|
#filters:
|
|
#branches:
|
|
#only: master |