-
Notifications
You must be signed in to change notification settings - Fork 11
63 lines (60 loc) · 2.58 KB
/
main.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
# 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: CI
on:
push:
branches: [ 'main', 'master' ]
pull_request:
branches: [ 'main', 'master' ]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
version: [ {setup: '6.x', target: "net6.0"}, {setup: '7.x', target: "net7.0"}, {setup: '8.x', target: "net8.0"}]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: OSLC4Net_SDK/
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
show-progress: false
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.version.setup }}
source-url: https://nuget.pkg.github.com/oslc/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Target ${{ matrix.version.target }} only
shell: pwsh
run: |
(Get-Content JsonProviderTests/OSLC4Net.Core.JsonProviderTests.csproj) |
ForEach-Object { $_ -replace '>net8.0<', '>${{ matrix.version.target }}<' } |
Set-Content JsonProviderTests/OSLC4Net.Core.JsonProviderTests.csproj
(Get-Content OSLC4Net.ChangeManagementTest/OSLC4Net.ChangeManagementTest.csproj) |
ForEach-Object { $_ -replace '>net8.0<', '>${{ matrix.version.target }}<' } |
Set-Content OSLC4Net.ChangeManagementTest/OSLC4Net.ChangeManagementTest.csproj
(Get-Content OSLC4Net.DotNetRdfProviderTests/OSLC4Net.Core.DotNetRdfProviderTests.csproj) |
ForEach-Object { $_ -replace '>net8.0<', '>${{ matrix.version.target }}<' } |
Set-Content OSLC4Net.DotNetRdfProviderTests/OSLC4Net.Core.DotNetRdfProviderTests.csproj
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --filter TestCategory!=RunningOslcServerRequired
# - name: Set version suffix
# id: version
# run: echo "::set-output name=suffix::$(date +'-ts.%y%m%d%H%M')"
- name: Build and publish NuGet package
shell: pwsh
run: |
dotnet pack -c Release --version-suffix "ts.$(Get-Date -Format 'yyyyMMddHHmm')" -o ./nupkg_out
dotnet nuget push '.\nupkg_out\*.nupkg' --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols
if: |
success() && github.ref == 'refs/heads/main'
&& matrix.version.target == 'net8.0' && matrix.os == 'windows-latest'