version: 2.1 executors: linux: docker: - image: cimg/base:stable orbs: node: circleci/node@4.5.1 browser-tools: circleci/browser-tools@1.1.3 jobs: npm-audit: executor: linux steps: - checkout - node/install: install-npm: true node-version: lts/fermium - run: npm install - run: npm audit --audit-level=low test: parameters: node-version: type: string browser: type: string executor: linux steps: - checkout - restore_cache: key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }} - node/install: install-npm: false node-version: << parameters.node-version >> - run: npm install - when: condition: equal: [ "FirefoxESR", <> ] steps: - browser-tools/install-firefox: version: "91.2.0esr" #https://archive.mozilla.org/pub/firefox/releases/ - when: condition: equal: [ "FirefoxHeadless", <> ] steps: - browser-tools/install-firefox - when: condition: equal: [ "ChromeHeadless", <> ] steps: - browser-tools/install-chrome: replace-existing: false - save_cache: key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }} paths: - ~/.npm - ~/.cache - node_modules - when: condition: equal: [ "", <> ] #Only run linting when browsers are not running to save time steps: - run: npm run lint - when: condition: << parameters.browser >> #Truthy evaluation to only run when browser is specified steps: - run: npm run test:coverage -- --browsers=<> - store_test_results: path: dist/reports/tests/ - store_artifacts: path: dist/reports/ workflows: matrix-tests: jobs: - test: post-steps: - run: command: curl -Os https://uploader.codecov.io/latest/linux/codecov;chmod +x codecov;./codecov name: node10-chrome node-version: lts/dubnium browser: ChromeHeadless - test: name: node12-build-lint node-version: lts/erbium browser: "" #Skip unit tests - test: name: node14-build-lint node-version: lts/fermium browser: "" #Skip unit tests nightly: jobs: - test: name: node10-chrome-nightly node-version: lts/dubnium browser: ChromeHeadless - test: name: node12-firefoxESR-nightly node-version: lts/erbium browser: FirefoxESR - test: name: node14-firefox-nightly node-version: lts/fermium browser: FirefoxHeadless - npm-audit triggers: - schedule: cron: "0 0 * * *" filters: branches: only: - master