|
| 1 | +# 1. Set-up |
1 | 2 | env: |
2 | | - global: |
3 | | - CC_TEST_REPORTER_ID="$CC_TEST_REPORTER_ID" |
4 | | - CC_TEST_REPORTER_TYPE= |
| 3 | + global: CC_TEST_REPORTER_ID="$CC_TEST_REPORTER_ID" CC_TEST_REPORTER_TYPE= |
5 | 4 |
|
6 | 5 | language: node_js |
| 6 | + |
| 7 | +cache: npm |
| 8 | + |
| 9 | +# 1.1. Run quality assurance (QA) gates on all |
| 10 | +# supported Node.js versions... |
7 | 11 | node_js: |
8 | | - - v11 |
9 | | - - v10 |
10 | | - - v8 |
11 | | - - v6 |
| 12 | + - "11" |
| 13 | + - "10" |
| 14 | + - "8" |
| 15 | + - "6" |
12 | 16 |
|
| 17 | +# 1.2. ...on both Linux and MacOS |
| 18 | +# @see https://github.com/nodejs/Release#release-schedule |
13 | 19 | os: |
14 | 20 | - linux |
15 | 21 | - osx |
16 | 22 |
|
| 23 | +# 1.3. Do a shallow-clone to speed up analysis |
| 24 | +# (fail fast!) |
17 | 25 | git: |
18 | 26 | depth: 1 |
19 | 27 |
|
20 | 28 | before_install: |
21 | | - # npm |
22 | | - - "[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest" |
23 | | - # FOSSA: install fossa-cli to run Provided Builds |
24 | | - # @see https://docs.fossa.com/docs/provided-builds |
| 29 | + # 2. Before installation (before_install) steps: |
| 30 | + |
| 31 | + # 2.1. Set up dependency manager (node package manager "npm") |
| 32 | + - '[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest' |
| 33 | + # 2.2. FOSS license-compliance evaluator (fossa-cli for Provided Builds) |
| 34 | + # Grant execution permission |
| 35 | + # @see https://docs.fossa.com/docs/provided-builds |
25 | 36 | - chmod +x ./.github/ci/legal/fossa-init.sh |
| 37 | + |
| 38 | + # 2.3. CodeClimate source code quality assessor |
| 39 | + # Grant execution permission |
26 | 40 | - chmod +x ./.github/ci/qa/code-climate-init.sh |
27 | 41 |
|
28 | 42 | install: |
| 43 | + # 3. Installation step (install): |
29 | 44 | - npm i |
30 | 45 |
|
31 | 46 | before_script: |
| 47 | + # 4. Before running unit tests... |
| 48 | + # 4.1. Initialize FOSSA for OSS license compliance evaluation |
32 | 49 | - ./.github/ci/legal/fossa-init.sh |
| 50 | + |
| 51 | + # 4.2. Initialize CodeClimate for quality assurance code review |
| 52 | + # automatically sent as comments during a Merge Request |
| 53 | + # to master. |
33 | 54 | - ./.github/ci/qa/code-climate-init.sh |
| 55 | + |
| 56 | + # 4.3. Initialize CodeClimate Code Coverage reporter |
34 | 57 | - $TRAVIS_BUILD_DIR/cc-test-reporter before-build || exit 0 |
35 | 58 |
|
36 | 59 | script: |
| 60 | + # 5. Test! |
37 | 61 | - npm test |
| 62 | + - npm run security:audit:dependencies |
38 | 63 |
|
39 | 64 | after_script: |
40 | | - - npm run ci:coverage:codacy |
41 | | - - npm run ci:coverage:coveralls |
42 | | - - $TRAVIS_BUILD_DIR/cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || exit 0 |
| 65 | + # 5.1. Share code coverage with |
| 66 | + # - Codacy, |
| 67 | + # - Coveralls, |
| 68 | + - npm run ci:coverage |
| 69 | + |
| 70 | + # - and CodeClimate |
| 71 | + - $TRAVIS_BUILD_DIR/cc-test-reporter after-build --exit-code |
| 72 | + $TRAVIS_TEST_RESULT || exit 0 |
43 | 73 |
|
44 | 74 | jobs: |
45 | 75 | include: |
46 | 76 | - stage: release |
| 77 | + name: 'Publish to NPM (public registry)' |
| 78 | + # 7. Deploy from the lastest Node.js Long-Term Support |
| 79 | + # (LTS) build. |
47 | 80 | node_js: lts/* |
48 | 81 | deploy: |
49 | 82 | provider: script |
50 | 83 | skip_cleanup: true |
51 | 84 | script: |
52 | | - - npx travis-deploy-once "npx semantic-release" |
| 85 | + # 7.1. Bump semantic version by commit message headers' "type" |
| 86 | + # 7.2. Generate GitHub Release Notes |
| 87 | + # 7.3. Append change list to the CHANGELOG.md |
| 88 | + # 7.4. Bump package.json#version |
| 89 | + # 7.5. Stage and commit all of the above |
| 90 | + # 7.6. Push to Git remote origin master |
| 91 | + # 7.7. Trigger all CI quality gates on master |
| 92 | + # 7.8. All gates pass (steps 1-6)? Bump semver and |
| 93 | + # 7.8.1. Squash and merge into origin/master |
| 94 | + # 7.8.2. Publish a GitHub release with notes and CHANGELOG |
| 95 | + # 7.8.3. Publish on NPM (including README) |
| 96 | + # 7.9. Any gate fails? Roll back and abort all release steps. |
| 97 | + - npx semantic-release |
0 commit comments