-
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (66 loc) · 3.05 KB
/
PullRequest.yml
File metadata and controls
87 lines (66 loc) · 3.05 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
name: Pull Request
on: pull_request
env:
DOTNET_NOLOGO: true
LOWEST_FRAMEWORK: net8.0
HIGHEST_FRAMEWORK: net10.0
jobs:
build_and_test_debug:
name: Build and test with CodeCov (DEBUG)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- run: dotnet restore --verbosity minimal
- run: dotnet build --configuration Debug /p:ContinuousIntegrationBuild=true
- name: Run tests with code coverage
run: dotnet run --project ./code/WorldDomination.SimpleObservability.Tests/WorldDomination.SimpleObservability.Tests.csproj --configuration Debug --no-build --framework ${{ env.HIGHEST_FRAMEWORK }} -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml
- name: Code coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./code/WorldDomination.SimpleObservability.Tests/**/coverage.cobertura.xml
fail_ci_if_error: true
build_and_test_release:
name: Build and test (RELEASE)
runs-on: ubuntu-latest
strategy:
matrix:
framework: [net8.0, net10.0]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build version prefix/suffix
run: |
echo "VERSION_PREFIX=$(( ${{ github.run_number }} )).0.0" >> $GITHUB_ENV
echo "VERSION_SUFFIX=alpha" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- run: dotnet restore --verbosity minimal
- run: dotnet build --configuration Release -p:ContinuousIntegrationBuild=true -p:DebugType=Embedded -p:VersionPrefix=$VERSION_PREFIX --version-suffix $VERSION_SUFFIX
- name: Run tests (${{ matrix.framework }})
run: dotnet run --project ./code/WorldDomination.SimpleObservability.Tests/WorldDomination.SimpleObservability.Tests.csproj --configuration Release --no-build --framework ${{ matrix.framework }}
- run: dotnet pack --configuration Release --no-build --output ./artifacts -p:DebugType=Embedded -p:VersionPrefix=$VERSION_PREFIX --version-suffix $VERSION_SUFFIX
if: matrix.framework == env.LOWEST_FRAMEWORK
- name: Publish artifacts
uses: actions/upload-artifact@v6
if: matrix.framework == env.LOWEST_FRAMEWORK
with:
name: NuGetPackage.${{ env.VERSION_PREFIX }}-${{ env.VERSION_SUFFIX }}
path: ./artifacts/