Skip to content

Commit

Permalink
ci: update CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
manekinekko committed Feb 29, 2020
1 parent a79d431 commit d725e63
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 93 deletions.
172 changes: 82 additions & 90 deletions .circleci/config.yml
@@ -1,117 +1,109 @@
version: 2
jobs:
"ci/build-app":
docker:
- image: circleci/node:12.13.0

working_directory: ~/repo
var_1: &cache_key v1-dependencies-{{ checksum "package.json" }}
var_2: &run_node
docker:
- image: circleci/node:12.13.0
var_3: &run_cypress
docker:
- image: cypress/base:12.13.0

jobs:
install:
<<: *run_node
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

key: *cache_key
- run: npm install
- run:
name: Install JUnit coverage reporter
command: npm i -D jest-junit

- save_cache:
key: *cache_key
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- run: npm run build.library.all && npm run app.build.prod

"ci/build-all librarys":
docker:
- image: circleci/node:12.13.0

working_directory: ~/repo

lint:
<<: *run_node
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install
- run:
name: Install JUnit coverage reporter
command: npm i -D jest-junit

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- run:
command: npm run build.library.all
key: *cache_key
- run: npm run lint ||
(echo "Lint errors detected. Please run ''npm lint --fix''" ; exit 1)

"ci/test":
docker:
- image: cypress/base:12.13.0
test:
<<: *run_node
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-

- run: npm install

- save_cache:
paths:
- ~/.cache
key: v2-dependencies-{{ checksum "package.json" }}

- run: npm run build.library.all
key: *cache_key
- run: npm run test.ci -- --reporters=default --reporters=jest-junit --maxWorkers=2
test-e2e:
<<: *run_cypress
steps:
- checkout
- run: npm install
- restore_cache:
key: *cache_key
- run: npm run e2e

"ci/lint":
docker:
- image: circleci/node:12.13.0
build-libs:
<<: *run_node
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install
- save_cache:
key: *cache_key
- run:
command: npm run build.all.libraries
- persist_to_workspace:
root: dist
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- run: npm run lint ||
(echo "Lint errors detected. Please run ''npm lint --fix''" ; exit 1)
- ./*
build-app:
<<: *run_node
steps:
- checkout
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- run:
command: npm run app.build.prod

workflows:
version: 2
# lint_test_build:
# jobs:
# - lint
# - test:
# requires:
# - lint
# - "build-app":
# requires:
# - test
"ci/lint":
jobs:
- "ci/lint"
"ci/test":
jobs:
- "ci/test"
"ci/build-app":
install-lint-test-build:
jobs:
- "ci/build-app"
- install:
filters:
tags:
only: /.*/
- lint:
requires:
- install
- test:
requires:
- install
filters:
tags:
only: /.*/
- test-e2e:
requires:
- test
filters:
tags:
only: /.*/
- build-libs:
requires:
- install
- test
- test-e2e
filters:
tags:
only: /.*/
- build-app:
requires:
- install
- test
- test-e2e
- build-libs
filters:
tags:
only: /.*/
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -5,13 +5,13 @@
"ng": "ng",
"--dev--": "",
"start": "ng serve --configuration hmr",
"prestart": "npm run build.library.all",
"prestart": "npm run build.all.libraries",
"--build--": "",
"app.build.dev": "ng build",
"app.build.prod": "ng build --prod",
"app.build.stamp": "bash scripts/stamp-build.bash",
"build.library.all": "node ./scripts/build-all-libraries.js",
"build": "run-s -l build.library.all app.build.prod app.build.stamp",
"build.all.libraries": "node ./scripts/build-all-libraries.js",
"build": "run-s -l build.all.libraries app.build.prod app.build.stamp",
"--test--": "",
"test": "jest",
"test.update": "jest --updateSnapshot tests/integration",
Expand Down

0 comments on commit d725e63

Please sign in to comment.