Spaces:
Configuration error
Configuration error
version: 2.1 | |
orbs: | |
browser-tools: circleci/browser-tools@1.2.4 | |
aliases: | |
- | |
save_cache: | |
paths: | |
- .git | |
key: v3-git-{{ .Revision }} | |
- | |
restore_cache: | |
keys: | |
- v3-git-{{ .Revision }} | |
- v3-git- | |
- | |
save_cache: | |
paths: | |
- build | |
key: v3-build-{{ .Revision }} | |
- | |
restore_cache: | |
keys: | |
- v3-build-{{ .Revision }} | |
- | |
save_cache: | |
paths: | |
- dist | |
key: v3-dist-{{ .Revision }} | |
- | |
restore_cache: | |
keys: | |
- v3-dist-{{ .Revision }} | |
- | |
save_cache: | |
paths: | |
- node_modules | |
key: v3-npm-{{ checksum "package-lock.json" }} | |
- | |
restore_cache: | |
keys: | |
- v3-npm-{{ checksum "package-lock.json" }} | |
- v3-npm- | |
- | |
docker: | |
- image: cimg/node:12.22.11-browsers | |
auth: | |
username: $DOCKERHUB_USERNAME | |
password: $DOCKERHUB_PASSWORD | |
working_directory: ~/repo | |
jobs: | |
build-test-no-cache: | |
<<: | |
environment: | |
JEST_JUNIT_OUTPUT_DIR: test-results | |
NODE_OPTIONS: --max-old-space-size=4000 | |
steps: | |
- | |
- checkout | |
- run: npm ci | |
- run: | |
name: Lint | |
command: npm run test:lint -- --quiet --output-file test-results/eslint-results.xml --format junit | |
- run: | |
name: Unit | |
environment: | |
JEST_JUNIT_OUTPUT_NAME: unit-results.xml | |
command: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov --maxWorkers="2" | |
- run: | |
name: Build | |
environment: | |
NODE_ENV: production | |
command: npm run build | |
- browser-tools/install-chrome | |
- browser-tools/install-chromedriver | |
- run: | |
name: Integration | |
environment: | |
JEST_JUNIT_OUTPUT_NAME: integration-results.xml | |
command: | | |
google-chrome --version | |
chromedriver --version | |
npm run test:integration -- --reporters="default" --reporters="jest-junit" | |
- store_artifacts: | |
path: coverage | |
- store_test_results: | |
path: test-results | |
setup: | |
<<: | |
steps: | |
- | |
- checkout | |
- run: npm ci | |
- | |
- | |
lint: | |
<<: | |
steps: | |
- | |
- checkout | |
- | |
- run: | |
name: Lint | |
command: npm run test:lint -- --quiet --output-file test-results/eslint/results.xml --format junit | |
- store_test_results: | |
path: test-results | |
unit: | |
<<: | |
environment: | |
JEST_JUNIT_OUTPUT_NAME: results.xml | |
steps: | |
- | |
- checkout | |
- | |
- run: | |
name: Unit | |
environment: | |
JEST_JUNIT_OUTPUT_DIR: test-results/unit | |
command: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov --maxWorkers="2" | |
- store_artifacts: | |
path: coverage | |
- store_test_results: | |
path: test-results | |
build: | |
<<: | |
environment: | |
NODE_ENV: production | |
NODE_OPTIONS: --max-old-space-size=4000 | |
steps: | |
- | |
- checkout | |
- | |
- run: | |
name: Build | |
command: npm run build | |
- | |
- | |
store_build: | |
<<: | |
steps: | |
- | |
- store_artifacts: | |
path: build | |
store_dist: | |
<<: | |
steps: | |
- | |
- store_artifacts: | |
path: dist | |
integration: | |
<<: | |
parallelism: 2 | |
environment: | |
JEST_JUNIT_OUTPUT_NAME: results.txt | |
steps: | |
- | |
- checkout | |
- | |
- | |
- browser-tools/install-chrome | |
- browser-tools/install-chromedriver | |
- run: | |
name: Integration | |
environment: | |
JEST_JUNIT_OUTPUT_DIR: test-results/integration | |
command: | | |
google-chrome --version | |
chromedriver --version | |
export TESTFILES=$(circleci tests glob "test/integration/*.test.js" | circleci tests split --split-by=timings) | |
$(npm bin)/jest ${TESTFILES} --reporters="default" --reporters="jest-junit" --runInBand | |
- store_test_results: | |
path: test-results | |
deploy-npm: | |
<<: | |
environment: | |
NODE_OPTIONS: --max-old-space-size=4000 | |
steps: | |
- | |
- | |
- checkout | |
- run: | | |
echo export RELEASE_VERSION="0.1.0-prerelease.$(date +'%Y%m%d%H%M%S')" >> $BASH_ENV | |
echo export NPM_TAG=latest >> $BASH_ENV | |
if [ "$CIRCLE_BRANCH" == "master" ] | |
then echo export NPM_TAG=stable >> $BASH_ENV | |
fi | |
if [[ "$CIRCLE_BRANCH" == hotfix/* ]] # double brackets are important for matching the wildcard | |
then echo export NPM_TAG=hotfix >> $BASH_ENV | |
fi | |
- run: npm version --no-git-tag-version $RELEASE_VERSION | |
- run: | | |
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN | |
npm publish --tag $NPM_TAG | |
- run: git tag $RELEASE_VERSION | |
- run: git push $CIRCLE_REPOSITORY_URL $RELEASE_VERSION | |
deploy-gh-pages: | |
<<: | |
steps: | |
- | |
- checkout | |
- | |
- | |
- run: | | |
git config --global user.email $(git log --pretty=format:"%ae" -n1) | |
git config --global user.name $(git log --pretty=format:"%an" -n1) | |
- run: npm run deploy -- -e $CIRCLE_BRANCH | |
push-translations: | |
<<: | |
steps: | |
- | |
- checkout | |
- | |
- run: npm run i18n:src | |
- run: npm run i18n:push | |
workflows: | |
version: 2 | |
push-translations: | |
triggers: | |
- schedule: | |
cron: 0 0 * * * # daily at 12 UTC, 8 ET | |
filters: | |
branches: | |
only: | |
- develop | |
jobs: | |
- setup: | |
context: | |
- dockerhub-credentials | |
- push-translations: | |
context: | |
- dockerhub-credentials | |
requires: | |
- setup | |
build-test-no-deploy: | |
jobs: | |
- build-test-no-cache: | |
context: | |
- dockerhub-credentials | |
filters: | |
branches: | |
ignore: | |
- master | |
- develop | |
- /^hotfix\/.*/ | |
build-test-deploy: | |
jobs: | |
- setup: | |
context: | |
- dockerhub-credentials | |
filters: | |
branches: | |
only: | |
- master | |
- develop | |
- /^hotfix\/.*/ | |
- lint: | |
context: | |
- dockerhub-credentials | |
requires: | |
- setup | |
- unit: | |
context: | |
- dockerhub-credentials | |
requires: | |
- setup | |
- build: | |
context: | |
- dockerhub-credentials | |
requires: | |
- setup | |
- integration: | |
context: | |
- dockerhub-credentials | |
requires: | |
- build | |
- store_build: | |
context: | |
- dockerhub-credentials | |
requires: | |
- build | |
filters: | |
branches: | |
only: | |
- master | |
- develop | |
- /^hotfix\/.*/ | |
- store_dist: | |
context: | |
- dockerhub-credentials | |
requires: | |
- build | |
filters: | |
branches: | |
only: | |
- master | |
- develop | |
- /^hotfix\/.*/ | |
- deploy-npm: | |
context: | |
- dockerhub-credentials | |
requires: | |
- lint | |
- unit | |
- integration | |
- build | |
filters: | |
branches: | |
only: | |
- master | |
- develop | |
- /^hotfix\/.*/ | |
- deploy-gh-pages: | |
context: | |
- dockerhub-credentials | |
requires: | |
- lint | |
- unit | |
- integration | |
- build | |
filters: | |
branches: | |
ignore: | |
- /^dependabot/.*/ | |
- /^renovate/.*/ | |
- /^pull/.*/ # don't deploy to gh pages on PRs. | |