Skip to content

Commit

Permalink
Improve circleci execution
Browse files Browse the repository at this point in the history
  • Loading branch information
caleeli committed Aug 16, 2021
1 parent 4e1f5fe commit eafb509
Showing 1 changed file with 59 additions and 9 deletions.
68 changes: 59 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,74 @@ version: 2.1
orbs:
# use Cypress orb from CircleCI registry
cypress: cypress-io/[email protected]

executors:
with-chrome:
docker:
- image: 'cypress/browsers:node12.8.1-chrome80-ff72'
- image: 'cypress/browsers:node14.16.0-chrome89-ff86'
workflows:
build:
jobs:
# runs tests using Chrome browser in custom executor (Cypress docker image)
- cypress/install
# runs tests using Chrome browser in custom executor (Cypress docker image)
- cypress/run:
requires:
- cypress/install
start: apt-get install -y sed && circleci tests glob "tests/e2e/*/*.js" | circleci tests split > circleci.tests && sed -i 's/No timing found for "//g' circleci.tests && sed -i 's/"//g' circleci.tests && sed -i 's/tests\/e2e\/plugins\/index.js//g' circleci.tests && sed -i 's/tests\/e2e\/.eslintrc.js//g' circleci.tests && sed -i 's/tests\/unit\/.eslintrc.js//g' circleci.tests && grep "\S" circleci.tests > uno.txt && mv uno.txt circleci.tests && cat circleci.tests && npm rebuild node-sass && npx browserslist@latest --update-db && npm run serve
wait-on: 'http://localhost:8080'
executor: with-chrome
browser: chrome
command: 'npm install -g npm@latest && npm run lint && npm test'
#command: 'npm install -g npm@latest && npm run lint && npm test'
command: 'npm install -g npm@latest && npm run lint && TZ=UTC npx vue-cli-service test:e2e --mode test --headless --browser chrome --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml --spec $(cat circleci.tests | tr "\n" ",")'
parallel: true
parallelism: 10
post-steps:
- run: mkdir coverage && mv .nyc_output/out.json coverage/coverage-$CIRCLE_NODE_INDEX-$(date +"%s%N").json
- save_cache:
paths:
coverage/
key: pm-{{ .Environment.CIRCLE_NODE_INDEX }}-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- run: ls -la coverage
- cypress/run:
requires:
- cypress/run
command: npm run test-unit
post-steps:
- restore_cache:
keys:
- pm-0-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-1-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-2-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-3-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-4-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-5-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-6-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-7-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-8-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- restore_cache:
keys:
- pm-9-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-coverage.json
- run: ls -la coverage && cp jest-coverage/coverage-final.json coverage/from-jest.json
- run: npx nyc merge coverage && mkdir .nyc_output
- run: mv coverage.json .nyc_output/out.json
- run: npx nyc report --reporter html --reporter text --reporter json-summary --report-dir combined-coverage
- store_artifacts:
path: coverage
path: combined-coverage
- store_test_results:
path: test_summary_reports
- store_artifacts:
path: test_summary_reports/mocha/test-results.xml
- store_artifacts:
path: test_summary_reports/jest/junit.xml
path: test_summary_reports

0 comments on commit eafb509

Please sign in to comment.