22
33name : CI
44
5- # Controls when the action will run.
65on : [push, pull_request]
76
8- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
7+ env :
8+ TARGET_COVERAGE_NODE_VERSION : ' 20'
9+
910jobs :
10- # This workflow contains a single job called "build"
11- test :
12- # The type of runner that the job will run on
11+ report-coverage :
1312 runs-on : ubuntu-latest
13+ permissions :
14+ contents : read
15+ pull-requests : write
16+ issues : write
17+ checks : write
1418 strategy :
1519 matrix :
1620 node_version :
@@ -28,30 +32,26 @@ jobs:
2832 - run : npm install
2933 - run : npm test
3034 # - name: Lint
35+ # if: matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
3136 # run: npm run lint
3237 # - name: Upload checkstyle report
38+ # if: matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
3339 # uses: jwgmeligmeyling/checkstyle-github-action@master
3440 # with:
3541 # path: '**/checkstyle-result.xml'
3642 - name : Coverage
43+ if : matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
3744 run : npm run coverage
38- # Required for generating html artifact, can be skipped if not generating html artifact
39- # - name: Report coverage
40- # uses: hrishikesh-kadam/setup-lcov@v1
41- # - name: Upload coverage report
42- # uses: kefasjw/lcov-pull-request-report@v1
43- # with:
44- # # Lcov file location. For example, coverage/lcov.info
45- # lcov-file: coverage/lcov.info
46-
47- # # Github token required for getting list of changed files and posting comments
48- # github-token: ${{ secrets.GITHUB_TOKEN }}
49- # ... Generate LCOV files or download it from a different job
50- # - name: Setup LCOV
51- # uses: hrishikesh-kadam/setup-lcov@v1
52- # - name: Report coverage
53- # uses: zgosalvez/github-actions-report-lcov@v4
54- # with:
55- # coverage-files: coverage/lcov.info
56- # github-token: ${{ secrets.ACTIONS_TOKEN }}
57- # update-comment: true
45+ - name : Setup LCOV
46+ if : matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
47+ uses : hrishikesh-kadam/setup-lcov@v1
48+ with :
49+ ref : v1.16
50+ - name : Report code coverag
51+ if : matrix.node_version == env.TARGET_COVERAGE_NODE_VERSION
52+ uses : zgosalvez/github-actions-report-lcov@v4
53+ with :
54+ coverage-files : coverage/lcov.info
55+ artifact-name : code-coverage-report
56+ github-token : ${{ secrets.REPO_TOKEN }}
57+ update-comment : true
0 commit comments