Skip to content

Commit b48e7a4

Browse files
ci(core): add new npm scripts for clean, coverage (#905)
* ci(core): add new npm scripts for clean, coverage add new npm run script for clean, coverage, build moved google closure to dev dependencies updated sinon package to latest * ci(core): add GHA to publish unit test results add GHA to publish unit test results * ci(core): publish unit test results as PR comment publish unit test results as PR comment * chore(ci): add codecov to gate-keep.yml * chore(other): add lcov format for nyc reporting add lcov format for nyc reporting * test(core): add config unit tests add config unit tests * test(core): add config unit tests add config unit tests * test(core): modify test/branch-deps to include config unit tests modify test/branch-deps to include config unit tests
1 parent 480a638 commit b48e7a4

File tree

11 files changed

+4491
-3239
lines changed

11 files changed

+4491
-3239
lines changed

.github/workflows/deploy-qa.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,20 @@ jobs:
2828
cache: 'npm'
2929

3030
- name: Install dependencies
31-
run: npm install
31+
run: npm run ci
3232

3333
- name: Run tests
3434
id: runTests
3535
run: npm run test
3636

37+
- name: Run coverage
38+
id: runCover
39+
if: steps.runTests.outcome == 'success'
40+
run: npm run cover
41+
3742
- name : upload codecov
3843
uses: codecov/codecov-action@v3
39-
if: steps.runTests.outcome == 'success'
40-
with:
41-
token: ${{ secrets.CODECOV_TOKEN }}
44+
if: steps.runCover.outcome == 'success'
4245

4346
test-lint:
4447
name: Lint
@@ -54,7 +57,7 @@ jobs:
5457
cache: 'npm'
5558

5659
- name: Install dependencies
57-
run: npm install
60+
run: npm run ci
5861

5962
- name: Lint tests
6063
run: npm run lint
@@ -80,7 +83,7 @@ jobs:
8083
distribution: ${{ env.JAVA_DISTRIBUTION }}
8184

8285
- name: Install dependencies
83-
run: npm install
86+
run: npm run ci
8487

8588
- name: Call the Build bash script for QA
8689
id: build

.github/workflows/gate-keep.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ on:
33
pull_request:
44
types: [opened,reopened,edited,synchronize]
55
branches:
6-
- main
6+
- master
77
- production
88
paths-ignore:
99
- docs/**
1010
- README.md
1111
env:
12-
BRANCH_NAME: '${{ github.event.inputs.branch_name || github.head_ref || github.ref_name }}'
1312
NODE_VERSION: 16
1413
JAVA_VERSION: 11
1514
JAVA_DISTRIBUTION: 'adopt'
@@ -29,10 +28,32 @@ jobs:
2928
cache: 'npm'
3029

3130
- name: Install dependencies
32-
run: npm install
31+
run: npm run ci
3332

3433
- name: Run tests
35-
run: npm run test
34+
run: npm run test-report
35+
36+
- name: Test Report
37+
uses: dorny/test-reporter@v1
38+
if: success() || failure()
39+
with:
40+
name: Unit Tests
41+
fail-on-error: true,
42+
path: test-results.json # Path to test results
43+
reporter: mocha-json # Format of test results
44+
45+
- name: Publish Test Results
46+
uses: EnricoMi/publish-unit-test-result-action@v2
47+
id: test-results
48+
if: always()
49+
with:
50+
files: "test-results.json"
51+
52+
- name: Run cover
53+
run: npm run cover
54+
55+
- name : upload codecov
56+
uses: codecov/codecov-action@v3
3657

3758
test-lint:
3859
name: Lint
@@ -48,7 +69,7 @@ jobs:
4869
cache: 'npm'
4970

5071
- name: Install dependencies
51-
run: npm install
72+
run: npm run ci
5273

5374
- name: Lint tests
5475
run: npm run lint
@@ -73,7 +94,7 @@ jobs:
7394
distribution: ${{ env.JAVA_DISTRIBUTION }}
7495

7596
- name: Install dependencies
76-
run: npm install
97+
run: npm run ci
7798

7899
- name: Call the Build bash script for QA
79100
run: bash ${GITHUB_WORKSPACE}/deployment/build-test.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ local-testbench
3333
index.html
3434
dist
3535
.nyc_output
36+
test-results.json

.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
module.exports = {
99
require: ['./node_modules/google-closure-library', './test/branch-deps.js', './node_modules/jsdom-global/register.js', './test/test-utils.js', './node_modules/sinon/lib/sinon.js'],
10-
spec: ['./test/1_utils.js','./test/6_branch_new.js', './test/journeys_utils.js']
10+
spec: ['./test/0_config.js','./test/1_utils.js','./test/6_branch_new.js', './test/journeys_utils.js']
1111
};

.nycrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"reporter": [
33
"text-summary",
4-
"html"
4+
"html",
5+
"lcov"
56
],
7+
"all": true,
68
"include": [
79
"src/**"
810
],

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ test/branch-deps.js: $(SOURCES)
4343
--f node_modules/google-closure-library/closure/goog/deps.js \
4444
--root src \
4545
--root test \
46-
--exclude src/0_config.js \
47-
--exclude test/branch-deps.js > test/branch-deps.js.tmp
48-
echo "// jscs:disable" | cat - test/branch-deps.js.tmp | sed -e 's#src/0_config.js#test/web-config.js#' > test/branch-deps.js && \
49-
rm test/branch-deps.js.tmp
46+
--exclude test/web-config.js \
47+
--exclude test/branch-deps.js > test/branch-deps.js
5048

5149
dist/build.js: $(SOURCES) $(EXTERN)
5250
mkdir -p dist && \

0 commit comments

Comments
 (0)