-
Notifications
You must be signed in to change notification settings - Fork 6
122 lines (122 loc) · 3.73 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
name: Continuous Integration
on:
push:
branches:
- main
- 'feature/**'
pull_request:
branches: [main]
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x
7.0.x
8.0.x
- name: Run tests
run: dotnet test --collect:"XPlat Code Coverage" --logger "GitHubActions"
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: Code coverage ${{ matrix.os }}
path: "**/coverage.cobertura.xml"
coverage:
name: Coverage
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
name: Code coverage ubuntu-latest
path: coverage-ubuntu
- uses: actions/download-artifact@v4
with:
name: Code coverage windows-latest
path: coverage-windows
- uses: actions/download-artifact@v4
with:
name: Code coverage macos-latest
path: coverage-macos
- name: Generate coverage report
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.0
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 == 'System-IO-Abstractions/System.IO.Abstractions.Extensions' && 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@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Create packages
run: dotnet pack --configuration Release --output ./packages
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
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@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
name: NuGet packages
path: 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.2
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.6
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-template: |
This is addressed in release {release_link}.
label-template: |
state: released