mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-13 15:08:39 +00:00
* Do not compile contrib when running screenshotter * Add test job to CircleCI * Update config.yml * Fail if PR exists but running on the forked repo * Update Screenshotter README.md * Store artifact at the root * Add CircleCI badge * Add `codecov` to CircleCI * Change build directory to `dist`
106 lines
2.4 KiB
YAML
106 lines
2.4 KiB
YAML
checkout_submodule: &checkout_submodule
|
|
run:
|
|
name: Checkout submodule
|
|
command: |
|
|
git submodule sync
|
|
git submodule update --init --recursive
|
|
|
|
npm_cache_key: &npm_cache_key
|
|
npm-deps-v1-{{ checksum "package.json" }}
|
|
|
|
restore_npm_cache: &restore_npm_cache
|
|
restore_cache:
|
|
keys:
|
|
- *npm_cache_key
|
|
- npm-deps-v1-
|
|
|
|
npm_install: &npm_install
|
|
run:
|
|
name: Install npm dependencies
|
|
command: npm install
|
|
|
|
screenshotter: &screenshotter
|
|
steps:
|
|
- checkout
|
|
- *checkout_submodule
|
|
|
|
- *restore_npm_cache
|
|
- *npm_install
|
|
|
|
- run:
|
|
name: Verify screenshots and generate diffs and new screenshots
|
|
command: 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
|
|
|
|
version: 2
|
|
jobs:
|
|
test:
|
|
docker:
|
|
- image: circleci/node:6
|
|
steps:
|
|
- run:
|
|
name: Check whether the build is running on the main repository
|
|
command: |
|
|
if [[ $CIRCLE_PULL_REQUEST && $CIRCLE_PROJECT_USERNAME != "Khan" ]]; then
|
|
echo "Please disable CircleCI on your forked repository!"
|
|
exit 1
|
|
fi
|
|
|
|
- checkout
|
|
- *checkout_submodule
|
|
|
|
- *restore_npm_cache
|
|
- *npm_install
|
|
- save_cache:
|
|
key: *npm_cache_key
|
|
paths:
|
|
- node_modules
|
|
|
|
- run:
|
|
name: Run tests
|
|
command: npm test -- -- --coverage
|
|
- run:
|
|
name: Install codecov and upload results
|
|
command: |
|
|
sudo npm install -g codecov
|
|
codecov
|
|
|
|
- run:
|
|
name: Build KaTeX
|
|
command: npm run build
|
|
|
|
- store_artifacts:
|
|
path: dist/katex.js
|
|
destination: katex.js
|
|
- store_artifacts:
|
|
path: dist/katex.css
|
|
destination: katex.css
|
|
- store_artifacts:
|
|
path: dist/fonts
|
|
destination: fonts
|
|
|
|
firefox:
|
|
docker:
|
|
- image: circleci/node:6
|
|
- image: selenium/standalone-firefox:2.48.2
|
|
<<: *screenshotter
|
|
chrome:
|
|
docker:
|
|
- image: circleci/node:6
|
|
- image: selenium/standalone-chrome:2.48.2
|
|
<<: *screenshotter
|
|
|
|
workflows:
|
|
version: 2
|
|
screenshotter:
|
|
jobs:
|
|
- test
|
|
- firefox
|
|
- chrome
|