scratch-www/.circleci/config.yml

196 lines
5.2 KiB
YAML
Raw Normal View History

2020-10-27 14:10:50 -04:00
version: 2.1
2020-10-29 10:52:45 -04:00
aliases:
- &defaults
docker:
- image: cimg/node:12.20.1-browsers
2020-10-29 10:52:45 -04:00
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
working_directory: ~/repo
- &save_git_cache
save_cache:
paths:
- .git
key: v1-git-{{ .Revision }}
- &restore_git_cache
restore_cache:
keys:
- v1-git-{{ .Revision }}
- v1-git-
2020-10-30 17:18:40 -04:00
- &save_npm_cache
save_cache:
paths:
- node_modules
2020-11-09 11:10:27 -05:00
key: v1-npm-{{ checksum "package-lock.json" }}
2020-10-30 17:23:11 -04:00
- &restore_npm_cache
2020-10-30 17:18:40 -04:00
restore_cache:
keys:
- v1-npm-{{ checksum "package-lock.json" }}
- &save_build_cache
save_cache:
paths:
- ./build
- ./intl
2020-11-09 11:10:27 -05:00
key: v1-build-{{ .Revision }}
- &restore_build_cache
restore_cache:
keys:
- v1-build-{{ .Revision }}
- v1-build-
- &build
2020-10-29 10:52:45 -04:00
<<: *defaults
resource_class: medium+
2020-10-29 10:52:45 -04:00
steps:
- *restore_git_cache
- checkout
- run:
name: "setup"
command: |
npm --production=false ci
mkdir ./test/results
- run:
name: "run lint tests"
command: |
npm run test:lint:ci
- run:
name: "run npm build"
command: |
WWW_VERSION=${CIRCLE_SHA1:0:5} npm run build
- run:
name: "Run unit tests"
command: |
JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run test:unit:jest:unit -- --reporters=jest-junit
JEST_JUNIT_OUTPUT_NAME=localization-jest-results.xml npm run test:unit:jest:localization -- --reporters=jest-junit
npm run test:unit:tap -- --output-file ./test/results/unit-raw.tap
npm run test:unit:convertReportToXunit
- *save_npm_cache
- *save_git_cache
- *save_build_cache
- store_test_results:
path: test/results
- store_artifacts:
path: build.zip
- &deploy
<<: *defaults
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- *restore_build_cache
- run:
name: "setup python"
command: |
curl https://bootstrap.pypa.io/3.5/get-pip.py -o get-pip.py
python3 get-pip.py pip==21.0.1
2021-02-10 10:34:25 -05:00
pip install s3cmd==2.1.0
- run:
name: "deploy to staging"
command: |
npm run deploy
- &integration_jest
<<: *defaults
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- run:
name: "integration tests with Jest"
command: |
JEST_JUNIT_OUTPUT_NAME=integration-jest-results.xml npm run test:integration:jest:remote -- --reporters=jest-junit
- store_test_results:
path: test/results
- &integration_tap
<<: *defaults
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- run:
name: "integration tests with Tap"
command: |
mkdir ./test/results
npm run test:smoke:sauce -- --output-file ./test/results/integration-raw-tap.tap
npm run test:smoke:convertReportToXunit
- store_test_results:
path: test/results
jobs:
build-staging:
<<: *build
build-production:
<<: *build
deploy-staging:
<<: *deploy
deploy-production:
# <<: *deploy
integration-staging-jest:
<<: *integration_jest
integration-staging-tap:
<<: *integration_tap
integration-production-jest:
# <<: *integration_jest
integration-production-tap:
# <<: *integration_tap
2020-10-29 10:52:45 -04:00
2020-10-27 14:10:50 -04:00
workflows:
2021-02-18 14:45:59 -05:00
build-staging-production: # build-test-deploy
2020-10-27 14:10:50 -04:00
jobs:
- build-staging:
context:
- scratch-www-all
- scratch-www-staging
filters:
branches:
only:
- develop
- /^hotfix\/.*/
- /^release\/.*/
- build-production:
context:
- scratch-www-all
- scratch-www-production
filters:
branches:
only:
- master
# - deploy-staging:
# context:
# - scratch-www-all
# - scratch-www-staging
# requires:
# - build-staging
# filters:
# branches:
# only:
# - develop
# - /^hotfix\/.*/
# - /^release\/.*/
# - circleCI-configure-tests
# - integration-staging-jest:
# context:
# - scratch-www-all
# - scratch-www-staging
# requires:
# - deploy-staging
# filters:
# branches:
# only:
# - develop
# - /^hotfix\/.*/
# - /^release\/.*/
# - circleCI-configure-tests
# - integration-staging-tap:
# context:
# - scratch-www-all
# - scratch-www-staging
# requires:
# - deploy-staging
# filters:
# branches:
# only:
# - develop
# - /^hotfix\/.*/
# - /^release\/.*/
# - circleCI-configure-tests