Repository navigation
60 lines (54 loc) · 2.7 KB
/
Copy pathdotnet.yml
File metadata and controls
60 lines (54 loc) · 2.7 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main", "develop", "feature/*", "release/*", "hotfix/*", "support/*" ]
pull_request:
branches: [ "main", "develop" ]
types: [ opened, synchronize, reopened, ready_for_review ]
workflow_dispatch:
jobs:
build:
# strategy:
# matrix:
# runner: [ ubuntu-latest, self-hosted ]
# runs-on: ${{ matrix.runner }}
# disabled ubuntu-latest runner because .NET Framework 4.7.2 might have problem running
# runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Install GitVersion
run: dotnet tool restore
- name: Restore dependencies
run: dotnet restore ./src/Mammoth.Extensions.DependencyInjection.sln
- name: Determine version
run: dotnet tool run dotnet-gitversion /updateprojectfiles
- name: Build
run: dotnet build ./src/Mammoth.Extensions.DependencyInjection.sln --configuration Release --no-restore -p:ContinuousIntegrationBuild=True
- name: Test
run: dotnet test ./src/Mammoth.Extensions.DependencyInjection.sln --configuration Release --no-build --verbosity normal
- name: Native DI hot-cache regression
shell: pwsh
run: |
foreach ($framework in @("net472", "net8.0", "net9.0", "net10.0")) {
dotnet run --project ./repro/Issue46.NativeEnumeration -c Release -f $framework -p:DiVersion=10.0.0
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
- name: Pack
# only pack if the branch is main, release, or hotfix
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/')
run: dotnet pack ./src/Mammoth.Extensions.DependencyInjection.sln --configuration Release --no-build --output ./artifacts --include-symbols
- name: Publish
# only publish if the branch is main, release or hotfix
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/')
# with windows-latest, the path is D:\a\Mammoth.Extensions.DependencyInjection\Mammoth.Extensions.DependencyInjection\artifacts\*.nupkg
# with ubuntu-latest, the path is ./artifacts/*.nupkg
run: dotnet nuget push 'D:\a\Mammoth.Extensions.DependencyInjection\Mammoth.Extensions.DependencyInjection\artifacts\*.nupkg' --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}