-
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.63 KB
/
coverage.yml
File metadata and controls
56 lines (47 loc) · 1.63 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
name: Coverage
on:
push:
branches: ["main"]
pull_request:
permissions:
contents: read
jobs:
coverage:
name: dotnet test + coverlet → Codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore PostQuantum.FileFormat.sln
- name: Build
run: dotnet build PostQuantum.FileFormat.sln --no-restore -c Release
- name: Test with coverage (Cobertura XML)
# coverlet.collector is referenced by both test projects so the
# `--collect:"XPlat Code Coverage"` switch produces a per-project
# coverage.cobertura.xml under TestResults.
run: |
dotnet test PostQuantum.FileFormat.sln --no-build -c Release \
--collect:"XPlat Code Coverage" \
--results-directory coverage-out
- name: Locate coverage files
id: locate
run: |
set -euo pipefail
files=$(find coverage-out -name 'coverage.cobertura.xml' | tr '\n' ',' | sed 's/,$//')
echo "files=$files" >> "$GITHUB_OUTPUT"
echo "coverage files: $files"
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: ${{ steps.locate.outputs.files }}
fail_ci_if_error: false
verbose: true
env:
# CODECOV_TOKEN is required for private repos; for public repos
# tokenless upload works. Set the secret if you switch to private.
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}