version: 2.1 executors: firefox: docker: - image: circleci/node:10 - image: selenium/standalone-firefox:3.141.59-20200525 chrome: docker: - image: circleci/node:10 - image: selenium/standalone-chrome:3.141.59-20200525 commands: checkout_repo: steps: - checkout - run: name: Checkout submodule command: | git submodule sync git submodule update --init --recursive skip_if_only_changed: parameters: filter: type: string steps: - run: name: Skip tests if only "<< parameters.filter >>" are changed command: git diff --name-only << pipeline.git.base_revision >>... | grep -qvE '<< parameters.filter >>' || circleci step halt install_dependencies: steps: - restore_cache: keys: - yarn-deps-v5-{{ checksum "yarn.lock" }} - yarn-deps-v5- - run: name: Install dependencies command: yarn --immutable - save_cache: key: yarn-deps-v5-{{ checksum "yarn.lock" }} paths: - .yarn - .pnp.js jobs: test: docker: - image: circleci/node:10 steps: - run: name: Check whether the build is running on the main repository command: | if [[ $CIRCLE_PULL_REQUEST && $CIRCLE_PROJECT_USERNAME != "KaTeX" ]]; then echo "Please disable CircleCI on your forked repository!" exit 1 fi - checkout_repo - skip_if_only_changed: filter: '^docs/|^LICENSE|\.md$' - install_dependencies - run: name: Lint code command: yarn test:lint - skip_if_only_changed: filter: '^static/|^website/' - run: name: Run Flow and Jest tests command: | yarn test:flow yarn test:jest --coverage --runInBand - run: name: Upload code coverage reports to Codecov command: yarn codecov screenshotter: parameters: browser: type: executor executor: << parameters.browser >> steps: - checkout_repo - skip_if_only_changed: filter: '^docs/|^static/|^website/|^LICENSE|\.md$' - install_dependencies - run: name: Verify screenshots and generate diffs and new screenshots command: yarn node dockers/screenshotter/screenshotter.js --selenium-ip localhost -b $CIRCLE_JOB --verify --diff --new - store_artifacts: path: test/screenshotter/new destination: new - store_artifacts: path: test/screenshotter/diff destination: diff workflows: test: jobs: - test - screenshotter: name: firefox browser: firefox - screenshotter: name: chrome browser: chrome