-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (62 loc) · 2.11 KB
/
ci.yml
File metadata and controls
78 lines (62 loc) · 2.11 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
name: CI - Build, Test, and Publish
permissions:
contents: read
on:
push:
branches: main
pull_request:
branches: main
jobs:
dotnet-sdk:
name: .NET SDK
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: ./src
strategy:
matrix:
dotnet-version: ["8.0.x"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for nbgv to calculate version
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Setup Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Restore source dependencies
run: dotnet restore dirs.proj
- name: Restore test dependencies
run: dotnet restore tests.proj
- name: Build source projects
run: dotnet build dirs.proj --no-restore --configuration Release
- name: Build test projects
run: dotnet build tests.proj --no-restore --configuration Release
- name: Run tests
run: dotnet test tests.proj --no-build --configuration Release --verbosity normal
- name: Pack NuGet packages
id: pack
run: dotnet pack dirs.proj --configuration Release --output ../NuGetPackages
- name: Verify package was created
run: |
if ! ls ../NuGetPackages/*.nupkg 1> /dev/null 2>&1; then
echo "Error: No package file was created"
exit 1
fi
echo "✅ Package created successfully (NU5017 is a known false positive with centralized package management)"
ls -lh ../NuGetPackages/*.nupkg
- name: Copy NuGet packages
run: |
mkdir -p ~/drop/dotnet/NuGetPackages && cp -v ../NuGetPackages/*.nupkg $_
- name: Upload NuGet packages as artifact
uses: actions/upload-artifact@v4
with:
name: dotnet-packages-${{ github.run_number }}
path: ~/drop/dotnet/NuGetPackages/*