-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (54 loc) · 1.72 KB
/
CI.yml
File metadata and controls
70 lines (54 loc) · 1.72 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
name: CI
on:
create:
branches:
- release/**
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'FluentValidationGenerator.sln'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
includePrerelease: true
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
configFilePath: GitVersion.yml
- name: Set version in all AssemblyInfo.cs files
uses: secondbounce/assemblyinfo-update@v2
with:
version: "${{ steps.gitversion.outputs.assemblySemVer }}"
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{secrets.NUGET_API_KEY}}
- name: Restore dependencies
run: nuget restore $SOLUTION
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x.x
- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$GITVERSION_ASSEMBLYSEMVER --no-restore
- name: Run tests
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Publish
if: startsWith(github.ref, 'refs/heads/release')
run: nuget push **/*.nupkg -Source 'https://api.nuget.org/v3/index.json' -NoSymbols