Repository navigation
73 lines (71 loc) · 2.14 KB
/
Copy pathci.yml
File metadata and controls
73 lines (71 loc) · 2.14 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
67
68
69
70
71
72
73
name: Build & Test
on: push
jobs:
ci:
name: Build & Test
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: ["8.0", "9.0", "10.0"]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
permissions:
contents: read
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Tool Restore
run: dotnet tool restore
- name: Restore
run: dotnet restore
- name: Check formatting
run: dotnet tool run csharpier -- check .
- name: Build
run: dotnet build --framework net${{ matrix.dotnet }} --no-restore
- name: Test
run: >
dotnet test
--project src/LeanCode.ContractsGenerator.Tests/LeanCode.ContractsGenerator.Tests.csproj
--no-build
--framework net${{ matrix.dotnet }}
- name: Process test results
if: always()
run: |
# Strip BOM from JSON files
find TestResults -name '*.json' | xargs -n 1 sed -i "$(printf '1s/^\357\273\277//')"
# Merge coverage XML files
dotnet tool run dotnet-coverage merge TestResults/*.xml -o TestResults/cobertura.xml -f cobertura
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: TestResults/cobertura.xml
flags: net${{ matrix.dotnet }}
fail_ci_if_error: false
if: always()
- name: Publish test report
uses: ctrf-io/github-test-reporter@v1
if: always()
with:
report-path: 'TestResults/*.json'
summary-report: true
failed-folded-report: true
skipped-report: true
annotate: true
pull-request: true
overwrite-comment: true
comment-tag: 'net${{ matrix.dotnet }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}