-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (70 loc) · 2.05 KB
/
Copy pathcontinuous-integration.yml
File metadata and controls
84 lines (70 loc) · 2.05 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Continuous Integration
on:
push:
branches: [develop, master]
paths-ignore:
- '**.md'
- '.gitignore'
- 'LICENSE'
- 'docs/**'
concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
ci:
name: CI Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test & Coverage
run: |
dotnet test --no-build --configuration Release \
--collect:"XPlat Code Coverage" \
--results-directory ./coverage-results
- name: Pack NuGet (validation)
run: |
dotnet pack --no-restore --configuration Release \
-p:IncludeSymbols=true \
-p:IncludeSource=true \
--output ./nupkgs
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: nupkgs
path: ./nupkgs/
retention-days: 30
- name: Upload coverage
uses: actions/upload-artifact@v7
with:
name: coverage-results
path: ./coverage-results/
retention-days: 30
- name: Security audit
run: dotnet list package --vulnerable --include-transitive
- name: Push to GitHub Packages (master only)
if: github.ref_name == 'master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for pkg in ./nupkgs/*.nupkg; do
if [[ "$pkg" != *.snupkg ]]; then
dotnet nuget push "$pkg" \
--source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
--api-key "${{ secrets.GITHUB_TOKEN }}" \
--skip-duplicate
fi
done