-
Notifications
You must be signed in to change notification settings - Fork 23
129 lines (128 loc) · 4.08 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
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
name: Continuous Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [windows-latest] #to consider later , ubuntu-latest, macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: "2.1.x"
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Run tests
run: dotnet test --collect:"XPlat Code Coverage"
- name: Upload coverage
uses: actions/upload-artifact@v2
with:
name: Code coverage ${{ matrix.os }}
path: "**/coverage.cobertura.xml"
coverage:
name: Coverage
needs: [test]
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
- uses: actions/download-artifact@v2
with:
name: Code coverage windows-latest
path: coverage-windows
- name: Generate coverage report
uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12
with:
reports: "**/coverage.cobertura.xml"
targetdir: "coverage-report"
reporttypes: "Cobertura"
# - name: Publish coverage report to Codacy
# uses: codacy/codacy-coverage-reporter-action@master
# if: github.repository == 'siemens/simatic-s7-webserver-api' && github.event_name == 'push'
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# coverage-reports: coverage-report/Cobertura.xml
pack:
name: Pack
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Create packages
run: dotnet pack --configuration Release --output ./packages
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: NuGet packages
path: packages/*.*
deploy:
name: Deploy
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [pack]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
- uses: actions/download-artifact@v2
with:
name: NuGet packages
path: packages
- name: Print Files in packages folder
run: dir packages
- name: Push packages
run: dotnet nuget push "packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- uses: dotnet/nbgv@v0.4.0
id: nbgv
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.nbgv.outputs.SemVer2 }}
release_name: v${{ steps.nbgv.outputs.SemVer2 }}
- name: Comment relevant issues and merge requests
uses: apexskier/github-release-commenter@v1.3.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-template: |
This is addressed in release {release_link}.
label-template: |
state: released