1
+ # This workflow will build a .NET project
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3
+
4
+ name : dotnet build and test
5
+
6
+ on :
7
+ push :
8
+ branches : [ "main" ]
9
+ pull_request :
10
+ branches : [ "main" ]
11
+
12
+ jobs :
13
+ build :
14
+ runs-on : ubuntu-latest
15
+ strategy :
16
+ matrix :
17
+ dotnet-version : ['8.x' ]
18
+
19
+ steps :
20
+ - uses : actions/checkout@v4
21
+ - name : Setup .NET Core 6.x
22
+ uses : actions/setup-dotnet@v3
23
+ with :
24
+ dotnet-version : |
25
+ 6.0.x
26
+ 8.0.x
27
+ # cache: true
28
+ - name : Display dotnet version
29
+ run : dotnet --version
30
+ env :
31
+ DOTNET_NOLOGO : 1
32
+ DOTNET_CLI_TELEMETRY_OPTOUT : 1
33
+ # - name: Setup dotnet ${{ matrix.dotnet-version }}
34
+ # uses: actions/setup-dotnet@v3
35
+ # with:
36
+ # dotnet-version: ${{ matrix.dotnet-version }}
37
+
38
+ # - name: Cache libchdb.so
39
+ # id: cache-libchdb
40
+ # uses: actions/cache@v4
41
+ # with:
42
+ # path: libchdb.so
43
+ # key: ${{ runner.os }}-libchdb
44
+ - name : Download chdb library
45
+ if : steps.cache-libchdb.outputs.cache-hit != 'true'
46
+ run : ./update_libchdb.sh v1.2.0
47
+ # - uses: actions/cache@v3
48
+ # with:
49
+ # path: ~/.nuget/packages
50
+ # key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
51
+ # restore-keys: |
52
+ # ${{ runner.os }}-nuget-
53
+
54
+ - name : Restore
55
+ run : dotnet restore
56
+ - name : Build
57
+ run : dotnet build --no-restore --configuration Release
58
+ - name : Test
59
+ run : dotnet test --configuration Release --no-build --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
60
+ - name : Upload dotnet test results
61
+ uses : actions/upload-artifact@v4
62
+ with :
63
+ name : dotnet-results-${{ matrix.dotnet-version }}
64
+ path : TestResults-${{ matrix.dotnet-version }}
65
+ # Use always() to always run this step to publish test results when there are test failures
66
+ if : ${{ always() }}
67
+ - name : Pack
68
+ run : dotnet pack -c Release --include-symbols
69
+ - name : Publish the package to nuget.org
70
+ run : dotnet nuget push nupkg/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
71
+ env :
72
+ NUGET_AUTH_TOKEN : ${{ secrets.NUGET_TOKEN }}
0 commit comments