77 - ' [0-9]+.[0-9]+.[0-9]+-*'
88 pull_request :
99 workflow_dispatch :
10+ inputs :
11+ nightly :
12+ description : ' Build as nightly version'
13+ required : false
14+ type : boolean
15+ default : false
16+ schedule :
17+ - cron : ' 0 15 * * *' # Run at 3 PM UTC (1 AM Melbourne AEST / 2 AM AEDT)
1018env :
1119 DOTNET_NOLOGO : true
1220jobs :
2331 with :
2432 dotnet-version : 9.0.x
2533 - name : Build
26- run : dotnet build LibGit2Sharp.sln --configuration Release
34+ run : |
35+ if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
36+ $gitDescribe = git describe --tags --abbrev=0 2>$null
37+ # Extract the base version number if it exists, if not don't override
38+ if ($gitDescribe -match '^v?(\d+\.\d+\.\d+)') {
39+ $baseVersion = $matches[1]
40+
41+ $branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', ''
42+ $version = "$baseVersion-octopus-$branchName.${{ github.run_number }}"
43+
44+ Write-Host "PR build - overriding version to: $version"
45+ $env:MINVERVERSIONOVERRIDE = $version
46+ }
47+ }
48+
49+ dotnet build LibGit2Sharp.sln --configuration Release
50+ shell : pwsh
51+ - name : Show version
52+ run : |
53+ $package = Get-ChildItem artifacts/package/*.nupkg | Select-Object -First 1
54+ Write-Host "Built package: $($package.Name)"
55+ shell : pwsh
2756 - name : Upload packages
28572958 with :
@@ -33,86 +62,94 @@ jobs:
3362 - name : Verify trimming compatibility
3463 run : dotnet publish TrimmingTestApp
3564
36- test :
37- name : Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
38- runs-on : ${{ matrix.os }}
39- strategy :
40- matrix :
41- arch : [ x64 ]
42- os : [ windows-2022, macos-14 ]
43- tfm : [ net472, net8.0, net9.0 ]
44- exclude :
45- - os : macos-14
46- tfm : net472
47- include :
48- - arch : arm64
49- os : macos-14
50- tfm : net8.0
51- - arch : arm64
52- os : macos-14
53- tfm : net9.0
54- fail-fast : false
55- steps :
56- - name : Checkout
57- 58- with :
59- fetch-depth : 0
60- - name : Install .NET SDK
61- 62- with :
63- dotnet-version : |
64- 9.0.x
65- 8.0.x
66- - name : Run ${{ matrix.tfm }} tests
67- run : dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
68- test-linux :
69- name : Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
70- runs-on : ${{ matrix.runnerImage }}
71- strategy :
72- matrix :
73- arch : [ amd64, arm64 ]
74- distro : [ alpine.3.17, alpine.3.18, alpine.3.19, alpine.3.20, centos.stream.9, debian.12, fedora.40, ubuntu.20.04, ubuntu.22.04, ubuntu.24.04 ]
75- sdk : [ '8.0', '9.0' ]
76- exclude :
77- - distro : alpine.3.17
78- sdk : ' 9.0'
79- - distro : alpine.3.18
80- sdk : ' 9.0'
81- - distro : alpine.3.19
82- sdk : ' 9.0'
83- include :
84- - sdk : ' 8.0'
85- tfm : net8.0
86- - sdk : ' 9.0'
87- tfm : net9.0
88- - arch : amd64
89- runnerImage : ubuntu-22.04
90- - arch : arm64
91- runnerImage : ubuntu-22.04-arm
92- fail-fast : false
93- steps :
94- - name : Checkout
95- 96- with :
97- fetch-depth : 0
98- - name : Run ${{ matrix.tfm }} tests
99- run : |
100- git_command="git config --global --add safe.directory /app"
101- test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
102- docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"
65+ # test:
66+ # name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
67+ # runs-on: ${{ matrix.os }}
68+ # strategy:
69+ # matrix:
70+ # arch: [ x64 ]
71+ # os: [ windows-2022, macos-14 ]
72+ # tfm: [ net472, net8.0, net9.0 ]
73+ # exclude:
74+ # - os: macos-14
75+ # tfm: net472
76+ # include:
77+ # - arch: arm64
78+ # os: macos-14
79+ # tfm: net8.0
80+ # - arch: arm64
81+ # os: macos-14
82+ # tfm: net9.0
83+ # fail-fast: false
84+ # steps:
85+ # - name: Checkout
86+ 87+ # with:
88+ # fetch-depth: 0
89+ # - name: Install .NET SDK
90+ 91+ # with:
92+ # dotnet-version: |
93+ # 9.0.x
94+ # 8.0.x
95+ # - name: Run ${{ matrix.tfm }} tests
96+ # run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
97+ # test-linux:
98+ # name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
99+ # runs-on: ${{ matrix.runnerImage }}
100+ # strategy:
101+ # matrix:
102+ # arch: [ amd64, arm64 ]
103+ # distro: [ alpine.3.17, alpine.3.18, alpine.3.19, alpine.3.20, centos.stream.9, debian.12, fedora.40, ubuntu.20.04, ubuntu.22.04, ubuntu.24.04 ]
104+ # sdk: [ '8.0', '9.0' ]
105+ # exclude:
106+ # - distro: alpine.3.17
107+ # sdk: '9.0'
108+ # - distro: alpine.3.18
109+ # sdk: '9.0'
110+ # - distro: alpine.3.19
111+ # sdk: '9.0'
112+ # include:
113+ # - sdk: '8.0'
114+ # tfm: net8.0
115+ # - sdk: '9.0'
116+ # tfm: net9.0
117+ # - arch: amd64
118+ # runnerImage: ubuntu-22.04
119+ # - arch: arm64
120+ # runnerImage: ubuntu-22.04-arm
121+ # fail-fast: false
122+ # steps:
123+ # - name: Checkout
124+ 125+ # with:
126+ # fetch-depth: 0
127+ # - name: Run ${{ matrix.tfm }} tests
128+ # run: |
129+ # git_command="git config --global --add safe.directory /app"
130+ # test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
131+ # docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"
103132
104133 nuget-push :
105134 name : Octopus NuGet Push
106- needs : [build, test, test-linux]
107- # && github.ref == 'refs/heads/octopus/master'
108- if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule'
135+ needs : [build] # test, test-linux
136+ if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
109137 runs-on : ubuntu-22.04
110138 steps :
111139 - uses : actions/download-artifact@v4
112140 with :
113141 path : staging
114- - name : Push package to feed 🐙
115- id : push-feed
142+ - name : Push package to feed 🐙 (nightly)
143+ if : github.event_name == 'schedule' || inputs.nightly
144+ id : push-feed-nightly
145+ shell : bash
146+ env :
147+ FEED_API_KEY : ${{ secrets.FEED_API_KEY }}
148+ FEED_SOURCE : ${{ secrets.FEED_SOURCE }}
149+ run : dotnet nuget push staging/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE" --skip-duplicate
150+ - name : Push package to feed 🐙 (regular)
151+ if : github.event_name != 'schedule' && !inputs.nightly
152+ id : push-feed-regular
116153 shell : bash
117154 env :
118155 FEED_API_KEY : ${{ secrets.FEED_API_KEY }}
0 commit comments