From feceabe0b19dd40cea1510dbf81b711e4a659c08 Mon Sep 17 00:00:00 2001 From: Doguhan Uluca Date: Tue, 5 May 2020 00:55:10 -0400 Subject: [PATCH 1/2] build ch4 --- .circleci/config.ch4.yml | 42 -------- .circleci/config.ch9.yml | 85 ---------------- .circleci/config.yml | 206 +++++---------------------------------- 3 files changed, 26 insertions(+), 307 deletions(-) delete mode 100644 .circleci/config.ch4.yml delete mode 100644 .circleci/config.ch9.yml diff --git a/.circleci/config.ch4.yml b/.circleci/config.ch4.yml deleted file mode 100644 index 7de02f84..00000000 --- a/.circleci/config.ch4.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: 2.1 -jobs: - build: - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - checkout - - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - - - run: npm ci - - # force update the webdriver, so it runs with latest version of Chrome - - run: cd ./node_modules/protractor && npm i webdriver-manager@latest - - # because we use "npm ci" to install NPM dependencies - # we cache "~/.npm" folder - - save_cache: - key: v1-dependencies-{{ checksum "package-lock.json" }} - paths: - - ~/.npm - - - run: npm run style - - run: npm run lint - - - run: npm run build:prod - - run: npm run test:coverage -- --watch=false - - run: npm run e2e - - - run: - name: Tar & Gzip compiled app - command: tar zcf dist.tar.gz dist/local-weather-app - - store_artifacts: - path: dist.tar.gz -workflows: - version: 2 - build-and-test: - jobs: - - build diff --git a/.circleci/config.ch9.yml b/.circleci/config.ch9.yml deleted file mode 100644 index 7c84332e..00000000 --- a/.circleci/config.ch9.yml +++ /dev/null @@ -1,85 +0,0 @@ -version: 2.1 -orbs: - coveralls: coveralls/coveralls@1.0.4 -jobs: - build: - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - checkout - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: npm ci - - # force update the webdriver, so it runs with latest version of Chrome - - run: cd ./node_modules/protractor && npm i webdriver-manager@latest - - # because we use "npm ci" to install NPM dependencies - # we cache "~/.npm" folder - - save_cache: - paths: - - ~/.npm - key: v1-dependencies-{{ checksum "package-lock.json" }} - - - run: npm run style - - run: npm run lint - - - run: npm run build:prod - - run: npm run test:coverage -- --watch=false - - run: npm run e2e - - - store_test_results: - path: ./test_results - - store_artifacts: - path: ./coverage - - # upload coverage report to coveralls for readme badge support - # requires config.yml version 2.1 and orbs: coveralls: coveralls/coveralls@1.0.4 - # requires coveralls account and token named COVERALLS_REPO_TOKEN specific to repo to be stored in CircleCI - - coveralls/upload - - - run: - name: Tar & Gzip compiled app - command: tar zcf dist.tar.gz dist/local-weather-app - - store_artifacts: - path: dist.tar.gz - - - run: - name: Move compiled app to workspace - command: | - set -exu - mkdir -p /tmp/workspace/dist - mv dist/local-weather-app /tmp/workspace/dist/ - - persist_to_workspace: - root: /tmp/workspace - paths: - - dist/local-weather-app - deploy: - docker: - - image: circleci/node:lts - working_directory: ~/repo - steps: - - attach_workspace: - at: /tmp/workspace - - run: npx now --token $NOW_TOKEN --platform-version 2 --prod /tmp/workspace/dist/local-weather-app --confirm - -workflows: - version: 2 - build-test-and-approval-deploy: - jobs: - - build - - hold: - type: approval - requires: - - build - filters: - branches: - only: master - - deploy: - requires: - - hold diff --git a/.circleci/config.yml b/.circleci/config.yml index 04ea6078..3d810496 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,196 +1,42 @@ version: 2.1 -orbs: - coveralls: coveralls/coveralls@1.0.4 -commands: - install: - description: 'Install project dependencies' - parameters: - warm-cache: - type: boolean - default: false +jobs: + build: + docker: + - image: circleci/node:lts-browsers + working_directory: ~/repo steps: - checkout + - restore_cache: keys: - - node_modules-{{ checksum "package-lock.json" }} - - when: - condition: << parameters.warm-cache >> - steps: - - run: npm install - # Pre-build Angular modules - - run: npx ngcc --properties es2015 --async false # async false is temp CI build fix - # force update the webdriver, so it runs with latest version of Chrome - - run: cd ./node_modules/protractor && npm i webdriver-manager@latest - - save_cache: - key: node_modules-{{ checksum "package-lock.json" }} - paths: - - node_modules - lint: - description: 'Check for code style and linting errors' - steps: + - v1-dependencies-{{ checksum "package-lock.json" }} + + - run: npm ci + + # force update the webdriver, so it runs with latest version of Chrome + - run: cd ./node_modules/protractor && npm i webdriver-manager@latest + + # because we use "npm ci" to install NPM dependencies + # we cache "~/.npm" folder + - save_cache: + key: v1-dependencies-{{ checksum "package-lock.json" }} + paths: + - ~/.npm + - run: npm run style - run: npm run lint - build_and_test: - description: 'Build command that accepts Angular project name as parameter' - parameters: - project: - type: string - default: 'local-weather-app' - run-tests: - type: boolean - default: true - steps: - - run: npx ng build --prod --project << parameters.project >> - - when: - condition: << parameters.run-tests >> - steps: - - run: npx ng test --code-coverage --watch=false --project << parameters.project >> - - run: npx ng e2e << parameters.project >> - store: - description: 'Stores build_and_test artifacts' - parameters: - project: - type: string - default: 'local-weather-app' - steps: - - store_test_results: - path: ./test_results - - store_artifacts: - path: ./coverage - # upload coverage report to coveralls for readme badge support - # requires config.yml version 2.1 and orbs: coveralls: coveralls/coveralls@1.0.4 - # requires coveralls account and token named COVERALLS_REPO_TOKEN specific to repo to be stored in CircleCI - - coveralls/upload + - run: npx ng build ch4 --prod + - run: npx ng test --watch=false --project ch4 + - run: npx ng e2e --project ch4 - run: name: Tar & Gzip compiled app - command: tar zcf dist.tar.gz dist/<< parameters.project >> + command: tar zcf dist.tar.gz dist/local-weather-app - store_artifacts: path: dist.tar.gz - - - run: - name: Move compiled app to workspace - command: | - set -exu - mkdir -p /tmp/workspace/dist - mv dist/<< parameters.project >> /tmp/workspace/dist/ - - persist_to_workspace: - root: /tmp/workspace - paths: - - dist/<< parameters.project >> - deploy_now: - description: 'Deploys project to Zeit Now --> https://now.sh' - parameters: - project: - type: string - default: 'local-weather-app' - steps: - - attach_workspace: - at: /tmp/workspace - - run: npx now --token $NOW_TOKEN --platform-version 2 --prod /tmp/workspace/dist/<< parameters.project >> --confirm -jobs: - initialize: - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install: - warm-cache: true - default: - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - lint - - build_and_test - - store - deploy: - docker: - - image: circleci/node:lts - working_directory: ~/repo - steps: - - deploy_now - - ch2: # this job is only here to verify sample code from the book, remove it in your own projects - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - build_and_test: - project: 'ch2' - ch3: # this job is only here to verify sample code from the book, remove it in your own projects - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - build_and_test: - project: 'ch3' - run-tests: false - ch4: # this job is only here to verify sample code from the book, remove it in your own projects - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - build_and_test: - project: 'ch4' - ch5: # this job is only here to verify sample code from the book, remove it in your own projects - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - build_and_test: - project: 'ch5' - ch6: # this job is only here to verify sample code from the book, remove it in your own projects - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - build_and_test: - project: 'ch6' - ch12: # this job is only here to verify sample code from the book, remove it in your own projects - docker: - - image: circleci/node:lts-browsers - working_directory: ~/repo - steps: - - install - - build_and_test: - project: 'ch12' workflows: version: 2 - build-test-and-approval-deploy: + build-and-test: jobs: - - initialize - - default: - requires: - - initialize - - ch2: # this job is only here to verify sample code from the book, remove it in your own projects - requires: - - initialize - - ch3: # this job is only here to verify sample code from the book, remove it in your own projects - requires: - - initialize - - ch4: # this job is only here to verify sample code from the book, remove it in your own projects - requires: - - initialize - - ch5: # this job is only here to verify sample code from the book, remove it in your own projects - requires: - - initialize - - ch6: # this job is only here to verify sample code from the book, remove it in your own projects - requires: - - initialize - - ch12: # this job is only here to verify sample code from the book, remove it in your own projects - requires: - - initialize - - deploy: - requires: - - default - filters: - branches: - only: master + - build From 815ffa093614d8f8f5ed1479d89d0d390a86facb Mon Sep 17 00:00:00 2001 From: Doguhan Uluca Date: Tue, 5 May 2020 01:04:10 -0400 Subject: [PATCH 2/2] update to ch4 location --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3d810496..34650878 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ jobs: - run: name: Tar & Gzip compiled app - command: tar zcf dist.tar.gz dist/local-weather-app + command: tar zcf dist.tar.gz dist/ch4 - store_artifacts: path: dist.tar.gz workflows: