mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-24 06:22:28 -05:00
197 lines
4.9 KiB
YAML
197 lines
4.9 KiB
YAML
version: 2.1
|
|
|
|
aliases:
|
|
- &defaults
|
|
docker:
|
|
- image: cimg/node:16.14.2-browsers
|
|
auth:
|
|
username: $DOCKERHUB_USERNAME
|
|
password: $DOCKERHUB_PASSWORD
|
|
working_directory: ~/repo
|
|
- &setup
|
|
name: "setup"
|
|
command: |
|
|
npm --production=false ci
|
|
mkdir ./test/results
|
|
- &lint
|
|
name: "run lint tests"
|
|
command: |
|
|
npm run test:lint:ci
|
|
- &build
|
|
name: "run npm build"
|
|
command: |
|
|
WWW_VERSION=${CIRCLE_SHA1:0:5} npm run build
|
|
- &unit
|
|
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
|
|
- &setup_python
|
|
name: "setup python"
|
|
command: |
|
|
curl https://bootstrap.pypa.io/pip/3.5/get-pip.py -o get-pip.py
|
|
python3 get-pip.py pip==21.0.1
|
|
pip install s3cmd==2.1.0
|
|
- &deploy
|
|
name: "deploy"
|
|
command: |
|
|
npm run deploy
|
|
- &integration
|
|
name: "integration tests with Jest"
|
|
command: |
|
|
JEST_JUNIT_OUTPUT_NAME=integration-jest-results.xml npm run test:integration:remote -- --reporters=jest-junit
|
|
- &build_no_deploy
|
|
<<: *defaults
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
<<: *setup
|
|
- run:
|
|
<<: *lint
|
|
- run:
|
|
<<: *build
|
|
- run:
|
|
<<: *unit
|
|
- store_test_results:
|
|
path: test/results
|
|
- &build_and_deploy
|
|
<<: *defaults
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
<<: *setup
|
|
- run:
|
|
<<: *lint
|
|
- run:
|
|
<<: *build
|
|
- run:
|
|
<<: *unit
|
|
- run:
|
|
<<: *setup_python
|
|
- run:
|
|
<<: *deploy
|
|
- store_test_results:
|
|
path: test/results
|
|
- run:
|
|
name: Compress Artifacts
|
|
command: tar -cvzf build.tar build
|
|
- store_artifacts:
|
|
path: build.tar
|
|
- &integration_tests_and_store
|
|
<<: *defaults
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
<<: *setup
|
|
- run:
|
|
<<: *integration
|
|
- store_test_results:
|
|
path: test/results
|
|
- &update-translations
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: "setup"
|
|
command: npm --production=false ci
|
|
- run:
|
|
name: "run i18n script"
|
|
command: npm run i18n:push
|
|
|
|
# build-test-deploy requires two separately named jobs
|
|
jobs:
|
|
build-and-deploy-staging:
|
|
<<: *build_and_deploy
|
|
build-and-deploy-production:
|
|
<<: *build_and_deploy
|
|
integration-tests:
|
|
<<: *integration_tests_and_store
|
|
update-translations:
|
|
<<: *update-translations
|
|
build-no-deploy:
|
|
<<: *build_no_deploy
|
|
|
|
workflows:
|
|
build-test-deploy:
|
|
jobs:
|
|
- build-and-deploy-staging:
|
|
context:
|
|
- scratch-www-all
|
|
- scratch-www-staging
|
|
- dockerhub-credentials
|
|
filters:
|
|
branches:
|
|
only:
|
|
- develop
|
|
- beta
|
|
- /^hotfix\/.*/
|
|
- /^release\/.*/
|
|
- integration-tests:
|
|
requires:
|
|
- build-and-deploy-staging
|
|
context:
|
|
- scratch-www-all
|
|
- scratch-www-staging
|
|
- dockerhub-credentials
|
|
filters:
|
|
branches:
|
|
only:
|
|
- develop
|
|
- beta
|
|
- /^hotfix\/.*/
|
|
- /^release\/.*/
|
|
- build-and-deploy-production:
|
|
context:
|
|
- scratch-www-all
|
|
- scratch-www-production
|
|
- dockerhub-credentials
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- integration-tests:
|
|
requires:
|
|
- build-and-deploy-production
|
|
context:
|
|
- scratch-www-all
|
|
- scratch-www-production
|
|
- dockerhub-credentials
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
Update-translations:
|
|
triggers:
|
|
- schedule: # every evening at 7pm EST (8pm EDT, Midnight UTC)
|
|
cron: "0 0 * * *"
|
|
filters:
|
|
branches:
|
|
only: develop
|
|
jobs:
|
|
- update-translations:
|
|
context:
|
|
- scratch-www-all
|
|
- scratch-www-staging
|
|
- dockerhub-credentials
|
|
filters:
|
|
branches:
|
|
only:
|
|
- develop
|
|
build-test-no-deploy:
|
|
jobs:
|
|
- build-no-deploy:
|
|
context:
|
|
- dockerhub-credentials
|
|
filters:
|
|
branches:
|
|
ignore:
|
|
- develop
|
|
- master
|
|
- beta
|
|
- /^hotfix\/.*/
|
|
- /^release\/.*/
|