Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 145 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.2.4
commitlint: conventional-changelog/commitlint@1.0.0
node: circleci/node@5.0.2
aliases:
- &save_git_cache
save_cache:
Expand Down Expand Up @@ -40,20 +44,67 @@ aliases:
- v3-npm-
- &defaults
docker:
- image: circleci/node:10-browsers
# TODO: fix scratch-audio and change this to `cimg/node:lts-browsers`
- image: cimg/node:14.20-browsers
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
executor: node/default
working_directory: ~/repo

jobs:
build-test-no-cache:
<<: *defaults
resource_class: large
environment:
DETECT_CHROMEDRIVER_VERSION: "true"
JEST_JUNIT_OUTPUT_DIR: test-results
NODE_OPTIONS: --max-old-space-size=4000
steps:
- *restore_git_cache
- checkout
- browser-tools/install-chrome # must be before node/install-packages
- node/install-packages
- run:
name: "build scratch-vm for smalruby"
command: npm run setup-scratch-vm
- 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
- run:
name: Integration
environment:
JEST_JUNIT_OUTPUT_NAME: integration-results.xml
command: |
google-chrome --version
npx --no -- chromedriver --version
npm run test:integration -- --reporters="default" --reporters="jest-junit"
- store_artifacts:
path: coverage
- store_test_results:
path: test-results
setup:
<<: *defaults
environment:
DETECT_CHROMEDRIVER_VERSION: "true"
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- run: |
rm -rf node_modules/scratch-vm
npm install
(cd node_modules/scratch-vm && npm install && $(npm bin)/webpack --colors --bail --silent)
- browser-tools/install-chrome # must be before node/install-packages
- node/install-packages
- run:
name: "build scratch-vm for smalruby"
command: npm run setup-scratch-vm
- *save_git_cache
- *save_npm_cache
lint:
Expand Down Expand Up @@ -86,6 +137,7 @@ jobs:
path: test-results
build:
<<: *defaults
resource_class: large
environment:
NODE_ENV: production
NODE_OPTIONS: --max-old-space-size=4000
Expand Down Expand Up @@ -120,16 +172,35 @@ jobs:
- checkout
- *restore_npm_cache
- *restore_build_cache
- browser-tools/install-chrome
- run:
name: Integration
environment:
JEST_JUNIT_OUTPUT_DIR: test-results/integration
command: |
google-chrome --version
npx --no -- 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:
<<: *defaults
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- *restore_dist_cache
- run:
name: adjust config for hotfix if necessary
command: |
# double brackets are important for matching the wildcard
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then
sed -e "s|hotfix/REPLACE|${CIRCLE_BRANCH}|" --in-place release.config.js
fi
- run: npx semantic-release

deploy-gh-pages:
<<: *defaults
steps:
Expand All @@ -145,28 +216,78 @@ jobs:

workflows:
version: 2
commitlint:
jobs:
- commitlint/lint:
target-branch: develop

build-test-no-deploy:
jobs:
- build-test-no-cache:
context:
- dockerhub-credentials
filters:
branches:
ignore:
- master
- develop
- /^hotfix\/.*/
build-test-deploy:
jobs:
- setup
- 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
- deploy-gh-pages:
filters:
branches:
only:
- master
- develop
- /^hotfix\/.*/
- deploy-npm:
context:
- dockerhub-credentials
requires:
- lint
- unit
Expand All @@ -175,4 +296,20 @@ workflows:
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.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*.js text eol=lf
*.js.map text eol=lf
*.json text eol=lf
*.json5 text eol=lf
*.jsx text eol=lf
*.md text eol=lf
*.vert text eol=lf
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
Loading