Skip to content

Commit 80c773f

Browse files
committed
Make improvements to CI/CD pipeline
Make improvements to CI/CD pipeline: - Run unit tests and build on several versions of Node. - Break up tests into several parallel jobs. - Use cross-platform rimraf for clean scripts. - Separate clean scripts for main module and example.
1 parent 14945e0 commit 80c773f

File tree

5 files changed

+195
-33
lines changed

5 files changed

+195
-33
lines changed

.travis.yml

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
11
language: node_js
2-
node_js:
3-
- node
4-
after_success:
5-
- coveralls < coverage/lcov.info
6-
- npm run-s build
7-
- test $TRAVIS_BRANCH = "main" && cd example && npm install &&
8-
npm run build && cd ..
9-
deploy:
10-
- provider: pages
11-
local_dir: example/build
12-
skip_cleanup: true
13-
github_token: "$GITHUB_TOKEN"
14-
keep_history: true
15-
on:
16-
branch: main
17-
- provider: npm
18-
skip_cleanup: true
19-
20-
api_key: "$NPM_TOKEN"
21-
on:
22-
tags: true
23-
repo: ginkgobioworks/react-json-schema-form-builder
2+
node_js: node
3+
stages:
4+
- test
5+
- deploy
6+
jobs:
7+
include:
8+
- stage: test
9+
script: npm run-s test:lint
10+
- script: npm run-s test:flow
11+
12+
- script: npm run-s test:unit
13+
after_success: coveralls < coverage/lcov.info
14+
- node_js: 14
15+
script: npm run-s test:unit
16+
- node_js: 12
17+
script: npm run-s test:unit
18+
19+
- script: npm run-s build
20+
- node_js: 14
21+
script: npm run-s build
22+
- node_js: 12
23+
script: npm run-s build
24+
25+
- stage: deploy
26+
if: (repo = ginkgobioworks/react-json-schema-form-builder) AND (tag =~ ^v) AND NOT (type = pull_request)
27+
before_deploy: npm run-s build
28+
script: skip
29+
deploy:
30+
provider: npm
31+
skip_cleanup: true
32+
33+
api_key: "$NPM_TOKEN"
34+
- stage: deploy
35+
if: (repo = ginkgobioworks/react-json-schema-form-builder) AND (branch = main) AND NOT (type = pull_request)
36+
script: skip
37+
before_deploy: npm run-s build && cd example && npm install && npm run build && cd .
38+
deploy:
39+
provider: pages
40+
local_dir: example/build
41+
skip_cleanup: true
42+
github_token: "$GITHUB_TOKEN"
43+
keep_history: true
2444
env:
2545
global:
2646
- secure: Flqu795ioTwg6u3/v/Gf7quuH/d3OVCLj0IYnr7U9beYWqsILKfe1mh/gQ6yjku5Gx32+sroXdo7t1/qr1ZIdw+eWqDS7DIQtNTlXO5l6U1FpvtvSe7WQdHqalcIPrPYffLhv/w/+qZV1yC6tiZRAbujknn046MVIcWshrz3A4UjRMiViRgxW0GFpG17qv3XbnqYqItfLsF5Uz7ZnJ7NGEeodelHe6G1bkS1ovGsrS2vxCr7DQtzFzRSCSEfHharpqudD8cHjs9E1zEoz5Gvn7AU9hMwckk8TYeqA16eaiBiSs7KzfHZirZDfS9XYmUJO8KcAWOvbajiVCgfjBXK9nVsT+j2kb0uouQtV7+AC42ENTw1Rbrbi5fwhWrSmAOKumXqmBbBdxOOpF1zeSjwVMugOFDCz2LkNCMxSEhkI3cUmYbsxaB+5DAn9AmSCazbIq+0OOo0SDBggUn2mvxfg/XGyiBk/0qj3CAsnCiGpI+NyzGBK+1DaBRahMe58FlBEQlD0/uHD1ABYrzlr2DIhBzPBSz2J4h2VeX7ftuoSyE3Hrcdgm13lKgBdfkcEFTzTSCA3Mfw0ZCPeoIQJSC4u0Q/ipI47DbFXN5/e73hwyLZvVDcCEWYnV++ffV6x6vyTroU3oamSN9G4cddTjhRmTQCI2a4QiXtAKyUFp+nYTk=

example/package-lock.json

Lines changed: 120 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "node ../node_modules/react-scripts/bin/react-scripts.js build",
99
"test": "node ../node_modules/react-scripts/bin/react-scripts.js test",
1010
"eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject",
11-
"flow": "flow"
11+
"flow": "flow",
12+
"clean": "rimraf node_modules build"
1213
},
1314
"dependencies": {
1415
"react": "file:../node_modules/react",
@@ -18,7 +19,8 @@
1819
},
1920
"devDependencies": {
2021
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
21-
"flow-bin": "file:../node_modules/flow-bin"
22+
"flow-bin": "file:../node_modules/flow-bin",
23+
"rimraf": "^3.0.2"
2224
},
2325
"eslintConfig": {
2426
"extends": "react-app"

package-lock.json

Lines changed: 25 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
"node": ">=12"
2323
},
2424
"scripts": {
25-
"clean": "rm package-lock.json && rm -r -f node_modules && rm -r -f dist && rm -r -f coverage && cd example && rm package-lock.json && rm -r -f node_modules && rm -r -f build",
25+
"clean": "rimraf node_modules coverage dist",
2626
"build": "microbundle-crl --no-compress --format modern,cjs",
2727
"start": "microbundle-crl watch --no-compress --format modern,cjs",
2828
"flow": "flow",
2929
"flow:install-types": "flow-typed install",
3030
"test": "run-s test:unit test:lint test:flow",
31-
"test:flow": "flow && cd example && npm install && flow",
31+
"test:flow": "flow",
3232
"test:lint": "eslint .",
3333
"test:unit": "cross-env CI=1 react-scripts test --env=jsdom --coverage --coverageDirectory=coverage/",
3434
"test:watch": "react-scripts test --env=jsdom",
@@ -78,7 +78,8 @@
7878
"react": "^16.13.1",
7979
"react-dom": "^16.13.1",
8080
"react-json-editor-ajrm": "^2.5.13",
81-
"react-scripts": "^3.4.1"
81+
"react-scripts": "^3.4.1",
82+
"rimraf": "^3.0.2"
8283
},
8384
"dependencies": {
8485
"classnames": "^2.2.6",

0 commit comments

Comments
 (0)