-
Notifications
You must be signed in to change notification settings - Fork 8
83 lines (69 loc) · 2.64 KB
/
ci.yml
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
name: CI
on:
push:
schedule:
- cron: '1 0 * * 1' # * is a special character in YAML, therefore this string needs to be quoted
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
ARTIFACT_DIR: ./Artifacts
PROJECT_NAME: AoCHelper
steps:
- uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: '[Ubuntu] Set version to -ci-${{ github.run_number }}'
if: matrix.os == 'ubuntu-latest'
shell: pwsh
run: |
$input_path = "src/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj"
$regex = "(?<=<Version>).*(?=</Version>)"
(Get-Content $input_path) -Replace $regex, '$0-ci-${{ github.run_number }}' | Out-File $input_path
- name: Build
run: dotnet build -c Release /p:DeterministicBuild=true
- name: Run tests
run: dotnet test -c Release --no-build --collect:"XPlat Code Coverage"
- name: '[Ubuntu] Pack'
if: matrix.os == 'ubuntu-latest'
run: |
dotnet pack -c Release --no-build src/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj --include-symbols -o ${{ env.ARTIFACT_DIR }}
- name: '[Ubuntu] Upload Artifact'
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-ci-${{ github.run_number }}
path: |
${{ env.ARTIFACT_DIR }}/*.nupkg
${{ env.ARTIFACT_DIR }}/*.snupkg
if-no-files-found: error
- name: '[Ubuntu] Generate test coverage report'
if: matrix.os == 'ubuntu-latest'
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: 'tests/**/*.cobertura.xml'
targetdir: 'coveragereport'
reporttypes: 'HtmlInline_AzurePipelines_Dark'
assemblyfilters: '+*'
classfilters: '+*;-*Exception'
filefilters: '+*'
verbosity: 'Info'
title: '${{ env.PROJECT_NAME }} #${{ github.run_number }} (${{ env.GITHUB_REF_SLUG }})'
tag: '${{ github.run_number }}_${{ github.run_id }}'
customSettings: 'numberOfReportsParsedInParallel=3;numberOfReportsMergedInParallel=3'
- name: '[Ubuntu] Upload test coverage report'
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-coverage-ci-${{ github.run_number }}
path: coveragereport/
if-no-files-found: error