1+ name : ' CI'
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ publish_release :
7+ description : If this build should publish nuget packages
8+ required : true
9+ type : boolean
10+ version_suffix :
11+ description : Suffix of the version number. Can be used to create a preview package.
12+ required : false
13+ type : string
14+ push :
15+ branches :
16+ - main
17+ paths-ignore :
18+ - ' **.md'
19+ pull_request :
20+
21+ env :
22+ configuration : Release
23+ publish_release : ${{ github.event.inputs.publish_release }}
24+ version_suffix : ${{ github.event.inputs.version_suffix }}
25+ tester_framework : net8.0
26+
27+ jobs :
28+ build :
29+ name : Build
30+ runs-on : ${{ matrix.os }}
31+ strategy :
32+ matrix :
33+ os : [ windows-latest, macos-latest, ubuntu-latest ]
34+
35+ steps :
36+ - name : Checkout with submodules
37+ uses : actions/checkout@v4
38+ with :
39+ submodules : ' true'
40+
41+ - name : Prepare .NET
42+ uses : actions/setup-dotnet@v4
43+ with :
44+ dotnet-version : |
45+ 6.0.x
46+ 8.0.x
47+
48+ - name : Verify code format
49+ if : matrix.os == 'ubuntu-latest'
50+ run : dotnet format --verify-no-changes
51+ working-directory : ' ./src'
52+
53+ - name : Run unit tests ubuntu
54+ if : matrix.os == 'ubuntu-latest'
55+ env :
56+ RuntimeIdentifier : unix
57+ run : dotnet test -c ${{ env.configuration }}
58+ working-directory : ' ./src'
59+
60+ - name : Run unit tests macos
61+ if : matrix.os == 'macos-latest'
62+ env :
63+ RuntimeIdentifier : unix
64+ run : dotnet test -c ${{ env.configuration }}
65+ working-directory : ' ./src'
66+
67+ - name : Run unit tests windows
68+ if : matrix.os == 'windows-latest'
69+ env :
70+ RuntimeIdentifier : windows
71+ run : dotnet test -c ${{ env.configuration }}
72+ working-directory : ' ./src'
73+
74+ - name : Build solution
75+ run : dotnet fsi build.fsx
76+ working-directory : ' ./src'
77+
78+ - name : Pack release version
79+ if : env.publish_release == 'true' && matrix.os == 'ubuntu-latest'
80+ run : dotnet pack WCharT.Net/WCharT.Net.csproj --no-build --nologo -c ${{ env.configuration }} --version-suffix "${{ env.version_suffix }}" -o ../Nuget
81+ working-directory : ' ./src'
82+
83+ - name : Publish to nuget org
84+ if : env.publish_release == 'true' && matrix.os == 'ubuntu-latest'
85+ run : dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s nuget.org
86+ working-directory : ' ./Nuget'
0 commit comments