Skip to content

Commit

Permalink
Merge pull request #98 from adhocteam/sj-reduce-ci-jobs
Browse files Browse the repository at this point in the history
CI: Cleanup docker-executor, split lint_and_audit job
  • Loading branch information
rahearn authored Dec 23, 2020
2 parents 8338ff7 + ddfb6ca commit 6a99e65
Showing 1 changed file with 45 additions and 54 deletions.
99 changes: 45 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ orbs:
executors:
docker-executor:
# for docker you must specify an image to use for the primary container
docker:
- image: circleci/node:12.20.0-browsers
docker-postgres-executor:
docker:
- image: circleci/node:12.20.0-browsers
environment:
Expand Down Expand Up @@ -122,10 +125,10 @@ parameters:
default: "main"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "sj-cd-use-db-url"
default: "sj-reduce-ci-jobs"
type: string
jobs:
build:
build_and_lint:
executor: docker-executor
steps:
- checkout
Expand All @@ -142,60 +145,51 @@ jobs:
- node_modules
- frontend/node_modules
key: v2-yarn-deps-{{ checksum "combined-yarnlock.txt" }}
- run:
name: Lint backend
command: yarn lint:ci
- run:
name: Lint frontend
command: yarn --cwd frontend lint:ci
- store_artifacts: # store backend lint reports
path: reports
- store_artifacts: # store frontend lint reports
path: frontend/reports
- persist_to_workspace:
root: .
paths:
- .
lint_audit:
executor: docker-executor
test_backend:
executor: docker-postgres-executor
steps:
- attach_workspace:
at: .
- run:
name: Lint backend
command: yarn run lint:ci
- run:
name: Lint frontend
command: yarn --cwd frontend run lint:ci
- run: # Fail audit only for moderate and higher vulnerabilities
name: Audit vulnerability of backend node_modules
command: |
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh; \
EXIT_CODE=$?; \
(($EXIT_CODE >= 4)) && exit $EXIT_CODE || exit 0
- run: # Fail audit only for moderate and higher vulnerabilities
name: Audit vulnerability of frontend node_modules
command: |
cd frontend
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh; \
EXIT_CODE=$?; \
(($EXIT_CODE >= 4)) && exit $EXIT_CODE || exit 0
- store_artifacts:
path: reports
- store_artifacts:
path: frontend/reports
test_backend:
executor: docker-executor
steps:
- attach_workspace:
at: .
./run-yarn-audit.sh;
- run:
name: Run migrations ci
command: yarn run db:migrate:ci
command: yarn db:migrate:ci
- run:
name: Test backend
command: yarn run test:ci
command: yarn test:ci
- store_test_results:
path: reports/
- store_artifacts:
path: coverage/
test_frontend:
executor: docker-executor
executor: docker-postgres-executor
steps:
- attach_workspace:
at: .
- run:
name: Audit vulnerability of frontend node_modules
command: |
cd frontend
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh;
- run:
name: Test frontend
command: yarn --cwd frontend run test:ci
Expand All @@ -204,7 +198,7 @@ jobs:
- store_artifacts:
path: frontend/coverage/
cucumber_test:
executor: docker-executor
executor: docker-postgres-executor
steps:
- attach_workspace:
at: .
Expand All @@ -216,11 +210,10 @@ jobs:
background: true
- run:
name: Run migrations ci
command: yarn run db:migrate:ci
command: yarn db:migrate:ci
- run:
name: Run cucumber
command: |
mkdir reports
sleep 5
yarn cucumber:ci
- store_artifacts:
Expand Down Expand Up @@ -254,13 +247,13 @@ jobs:
-t http://server:8080 \
-c zap.conf -I -i
accessibility_scan:
executor: docker-executor
executor: docker-postgres-executor
steps:
- attach_workspace:
at: .
- run:
name: Run migrations ci
command: yarn run db:migrate:ci
command: yarn db:migrate:ci
- run:
name: Build
command: yarn build
Expand All @@ -271,7 +264,6 @@ jobs:
- run:
name: Run axe
command: |
mkdir reports
sleep 5
yarn axe:ci
- store_artifacts:
Expand Down Expand Up @@ -359,31 +351,27 @@ jobs:
workflows:
build_test_deploy:
jobs:
- build
- lint_audit:
requires:
- build
- build_and_lint
- test_backend:
requires:
- build
- build_and_lint
- test_frontend:
requires:
- build
- build_and_lint
- cucumber_test:
requires:
- build
- build_and_lint
- dynamic_security_scan:
requires:
- build
- build_and_lint
- accessibility_scan:
requires:
- build
- build_and_lint
- deploy:
requires:
- lint_audit
- test_backend
- cucumber_test
- test_frontend
- cucumber_test
- dynamic_security_scan
- accessibility_scan
filters:
Expand All @@ -405,10 +393,13 @@ workflows:
- << pipeline.parameters.staging_git_branch >>
- << pipeline.parameters.prod_git_branch >>
jobs:
- build
- lint_audit:
- build_and_lint
- test_backend:
requires:
- build_and_lint
- test_frontend:
requires:
- build
- build_and_lint
- dynamic_security_scan:
requires:
- build
- build_and_lint

0 comments on commit 6a99e65

Please sign in to comment.