Repository navigation
60 lines (56 loc) · 2.01 KB
/
Copy pathtest-run.yml
File metadata and controls
60 lines (56 loc) · 2.01 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
name: Coverage - Run Tests
on:
push: # workflow for pushes to the main branch
branches:
- master
paths:
- 'src/**'
pull_request: # workflow when opening PRs
branches:
- master
paths:
- 'src/**'
# workflow_call makes it possible to call this from another workflow, such as cloud deployment
workflow_call:
workflow_dispatch:
# permissions needed for assuming the IAM role below
permissions:
contents: read # This is required for actions/checkout
id-token: write # This is required for requesting the JWT
jobs:
execute-tests:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Run tests with coverage
run: mvn clean install
- uses: actions/upload-artifact@v4
with:
path: target/site/jacoco/jacoco.xml
name: jacoco.xml # Just a single artifact so keep the name simple
cs-coverage-check:
runs-on: ubuntu-24.04
needs: [ execute-tests ]
if: always()
steps:
- uses: actions/checkout@v4
with:
# fetch everything so that `cs-coverage check` can find merge-base.
fetch-depth: 0
# Download all artifacts/coverage files: https://github.com/actions/download-artifact#download-all-artifacts
# this also affects `coverage-files` property in the subsequent step
- name: download coverage
uses: actions/download-artifact@v5
with:
path: coverage/
- uses: ./.github/actions/check-coverage
if: always()
with:
access-token: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
project-id: "72308"
# Include coverage files from all the artifacts (jobs)
# NOTE:: if only one component is analyzed then there's only a single coverage/lcov.info file
# not nested as if multiple components: coverage/features.lcov.info/lcov.info, coverage/cloud.worker.lcov.info/lcov.info, etc.
coverage-files: "**/coverage/jacoco.xml"