-
-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (102 loc) · 4.92 KB
/
dotnet.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
on: push
jobs:
buildtest:
name: Build, test and package
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Cache Nuget dependencies
uses: actions/cache@v4
with:
key: ubuntu-latest-nuget
path: ~/.nuget/packages
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
queries: +security-and-quality
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.12.0
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.12.0
- name: Display GitVersion outputs
run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}"
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}"
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
- name: .Net SDK
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 6.0.x
- name: Test
run: dotnet test --collect:"XPlat Code Coverage" --results-directory coverage --nologo -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov
- name: Rename lcov
shell: bash
run: mv `find coverage -type f` all.lcov
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:csharp"
- name: Pack Nuget package
run: dotnet pack LineReader/LineReader.csproj -c Release /p:Version=${{ steps.gitversion.outputs.majorMinorPatch }} -nologo -o dist
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: all.lcov
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- name: Upload built packages
uses: svenstaro/upload-release-action@2.9.0
if: contains(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload Nuget package
if: contains(github.ref, 'refs/tags/v')
run: dotnet nuget push dist/*.nupkg -k ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json