Repository navigation
66 lines (55 loc) · 1.71 KB
/
Copy pathcode-coverage.yml
File metadata and controls
66 lines (55 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Code Coverage (generate data and trigger analysis)
on:
schedule:
- cron: "0 4 * * 1-5"
workflow_dispatch:
permissions:
contents: read # This is required for actions/checkout
jobs:
code-coverage-data:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- uses: './.github/actions/setup'
# silence a warning when running tests
- name: Configure Git
run: git config --global advice.defaultBranchName false
- name: Pretest
run: npm run pretest
env:
CI: true
- name: Generate code coverage
run: npm run test:coverage:dual
env:
CI: true
- name: Upload statement coverage data
uses: ./.github/actions/upload-coverage
if: always()
with:
cs-token: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
format: lcov
metric: function-coverage
file: coverage/lcov.info
- name: Upload branch coverage data
uses: ./.github/actions/upload-coverage
if: always()
with:
cs-token: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
format: lcov
metric: branch-coverage
file: coverage/lcov.info
trigger-analysis:
runs-on: ubuntu-24.04 # 24.04 needed to support `curl --retry-all-errors`
needs: [ code-coverage-data ]
if: always()
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Trigger codescene-vscode project analysis
env:
CS_TOKEN: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
CS_PROJECT_ID: 36131
run: |
curl --fail -X POST -H "Authorization: Bearer $CS_TOKEN" "https://api.codescene.io/v2/projects/${CS_PROJECT_ID}/run-analysis"