Repository navigation
138 lines (123 loc) · 6.34 KB
/
Copy pathCSharpTest.yml
File metadata and controls
138 lines (123 loc) · 6.34 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: 'C# Test'
# No path filters, on purpose: this is the suite, and every change is one it can break.
# That also means it cannot carry the defect that silenced the benchmark for ninety-eight
# merged PRs -- a leading "./" in a path filter matches nothing, because filters are globs
# relative to the repository root. Check that before adding any filter here.
# https://github.com/asc-community/AngouriMath/issues/775
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
Test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
# id-token is what the codecov step signs in with. Naming one permission sets every other to
# none, so contents: read is there for the checkout.
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
dotnet-quality: 'preview'
- name: Build Tests # We need it to be able to retry
run: |
dotnet add "Sources/Tests/UnitTests" package GitHubActionsTestLogger
dotnet build Sources/Tests/UnitTests
# No coverage on these two legs: the Windows leg's report is the one uploaded. With coverlet's
# MSBuild integration they printed `AngouriMath | 0%` on every run, because VSTest stops the
# test host before coverlet writes its hits (coverlet's KnownIssues.md), and instrumenting
# the suite took about two fifths of its time, measured locally.
# https://github.com/asc-community/AngouriMath/issues/397
- name: Test if not to send
if: ${{ matrix.os != 'windows-latest' }}
run: |
dotnet test "Sources/Tests/UnitTests" -c Release -l GitHubActions -l "trx;LogFileName=results.trx" --results-directory "Sources/Tests/UnitTests/TestResults"
# Where the suite's time goes, by the Area trait every test class carries, written to the
# job's summary. One leg is enough to see the breakdown, and running the tool builds the
# library once more. https://github.com/asc-community/AngouriMath/issues/1183
- name: 'Time by area'
if: ${{ always() && matrix.os == 'ubuntu-latest' }}
run: dotnet run AreaTimes
working-directory: Sources/Utils/Utils
# Release, as the other two legs test, and bash, which stops the step at the first command
# that fails. Under PowerShell the step took the result of its last command, so a test host
# that crashed still went green. From 2026-09-15 it crashed on most runs: in a Debug build,
# Simplify on the cubic row of RationalIntegralsTest recursed deeper than a 1 MB stack holds,
# and the leg ran 2,094 to 8,507 of the tests. A Release build passes that row on 512 KB.
# https://github.com/asc-community/AngouriMath/issues/397
- name: Test if to send
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: |
cd Sources/Tests/UnitTests
dotnet test -c Release --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
cd ../../Utils/Utils
dotnet run CopyCovReport
- name: Info about the coverage report
if: ${{ matrix.os == 'windows-latest' }}
run: dir ./Sources/Tests/UnitTests/coverage.opencover.xml
# A report can be well formed and record nothing. From a crashed test host this one listed
# all 81,664 sequence points of the kernel with 0 visited, and Codecov took it as 0%. Fail
# here instead, as the C++ leg does for an empty report.
# https://github.com/asc-community/AngouriMath/issues/397
- name: 'The report records hits'
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: grep -q 'visitedSequencePoints="[1-9]' ./Sources/Tests/UnitTests/coverage.opencover.xml
- name: 'Upload report as artifact'
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v6
with:
name: Report
path: ./Sources/Tests/UnitTests/coverage.opencover.xml
retention-days: 3
# The corpus gate reports solved / unsolved / wrong / error / timeout rather than pass or
# fail, and until now those numbers existed only in this job's log, which expires. This is
# the artefact half of https://github.com/asc-community/AngouriMath/issues/746 item 36; the
# per-commit history half is Sources/Tests/UnitTests/Corpus/corpus-baseline.tsv, which is
# committed, because an artefact cannot be diffed, cannot be attributed to the commit that
# moved a number, and expires.
#
# if: always() because a suite that fell over part way still measured the cases that ran,
# and those are the interesting ones when something has just broken. Uploaded from every
# operating system in the matrix: a verdict that differs between them is a finding.
#
# The glob spans bin/Debug and bin/Release because the two test steps above do not agree on
# the configuration -- the Windows one takes the default.
- name: 'Retain the corpus results'
if: always()
uses: actions/upload-artifact@v6
with:
name: corpus-report-${{ matrix.os }}-${{ github.sha }}
path: Sources/Tests/UnitTests/bin/**/corpus-report.tsv
if-no-files-found: warn
retention-days: 90
# `files`, not `file`. v5 of the action does not take `file`: it warns about an unexpected
# input, ignores the path, and searches the workspace instead, so the named report was never
# what made this flag.
# Codecov takes an upload from a branch of this repository only with a token, and without one
# it rejected them while this step stayed green: master's newest report there is from
# 2022-11-28. use_oidc gets a token for the run; on a fork's pull request the action skips it,
# and Codecov takes that upload without one. A rejected upload fails the run on a push to
# master only, so that an outage at Codecov does not fail a pull request. See
# Sources/AngouriMath/Docs/Contributing/Coverage.md.
- name: 'Send to codecov'
if: ${{ matrix.os == 'windows-latest' }}
uses: codecov/codecov-action@v5
with:
files: ./Sources/Tests/UnitTests/coverage.opencover.xml
flags: csharp
use_oidc: true
fail_ci_if_error: ${{ github.event_name == 'push' }}