11name : CI
22on :
3- push :
4- branches : [master, release-*]
5- tags :
6- - ' [0-9]+.[0-9]+.[0-9]+'
7- - ' [0-9]+.[0-9]+.[0-9]+-*'
8- pull_request :
9- workflow_dispatch :
3+ push :
4+ branches : [master, release-*]
5+ tags :
6+ - " [0-9]+.[0-9]+.[0-9]+"
7+ - " [0-9]+.[0-9]+.[0-9]+-*"
8+ pull_request :
9+ workflow_dispatch :
1010env :
11- DOTNET_NOLOGO : true
11+ DOTNET_NOLOGO : true
1212jobs :
13- build :
14- name : Build
15- runs-on : ubuntu-22.04
16- steps :
17- - name : Checkout
18- uses : actions/checkout@v4.1.2
19- with :
20- fetch-depth : 0
21- - name : Install .NET SDK
22- uses : actions/setup-dotnet@v4.0.0
23- with :
24- dotnet-version : 9.0.x
25- - name : Build
26- run : dotnet build LibGit2Sharp.sln --configuration Release
27- - name : Upload packages
28- uses : actions/upload-artifact@v4.3.1
29- with :
30- name : NuGet packages
31- path : artifacts/package/
32- retention-days : 7
33- - name : Verify trimming compatibility
34- run : dotnet publish TrimmingTestApp
35-
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- uses : actions/checkout@v4.1.2
58- with :
59- fetch-depth : 0
60- - name : Install .NET SDK
61- uses : actions/setup-dotnet@v4.0.0
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- uses : actions/checkout@v4.1.2
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"
103-
104- nuget-push :
105- 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'
109- runs-on : ubuntu-22.04
110- steps :
111- - uses : actions/download-artifact@v4
112- with :
113- path : staging
114- - name : Push package to feed 🐙
115- id : push-feed
116- shell : bash
117- env :
118- FEED_API_KEY : ${{ secrets.FEED_API_KEY }}
119- FEED_SOURCE : ${{ secrets.FEED_SOURCE }}
120- run : dotnet nuget push staging/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE"
13+ build :
14+ name : Build
15+ runs-on : ubuntu-22.04
16+ steps :
17+ - name : Checkout
18+ uses : actions/checkout@v6
19+ with :
20+ fetch-depth : 0
21+ - name : Install .NET SDK
22+ uses : actions/setup-dotnet@v5
23+ with :
24+ dotnet-version : 9.0.x
25+ - name : Compute version suffix for branch builds
26+ if : ${{ !startsWith(github.ref, 'refs/tags/') }}
27+ id : version
28+ run : |
29+ # Sanitize branch name: lowercase, replace non-alphanumeric with hyphen, trim to 20 chars
30+ BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
31+ SAFE_BRANCH=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//' | cut -c1-20)
32+ echo "override=${SAFE_BRANCH}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
33+ - name : Build
34+ run : dotnet build LibGit2Sharp.sln --configuration Release ${{ steps.version.outputs.override && format('/p:MinVerDefaultPreReleaseIdentifiers="{0}"', steps.version.outputs.override) || '' }}
35+ - name : Upload packages
36+ uses : actions/upload-artifact@v7
37+ with :
38+ name : NuGet packages
39+ path : artifacts/package/
40+ retention-days : 7
41+ - name : Verify trimming compatibility
42+ run : dotnet publish TrimmingTestApp
43+
44+ test :
45+ name : Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
46+ runs-on : ${{ matrix.os }}
47+ strategy :
48+ matrix :
49+ arch : [x64]
50+ os : [windows-2022, macos-14]
51+ tfm : [net472, net8.0, net9.0]
52+ exclude :
53+ - os : macos-14
54+ tfm : net472
55+ include :
56+ - arch : arm64
57+ os : macos-14
58+ tfm : net8.0
59+ - arch : arm64
60+ os : macos-14
61+ tfm : net9.0
62+ fail-fast : false
63+ steps :
64+ - name : Checkout
65+ uses : actions/checkout@v6
66+ with :
67+ fetch-depth : 0
68+ - name : Install .NET SDK
69+ uses : actions/setup-dotnet@v5
70+ with :
71+ dotnet-version : |
72+ 9.0.x
73+ 8.0.x
74+ - name : Run ${{ matrix.tfm }} tests
75+ run : dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
76+ test-linux :
77+ name : Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
78+ runs-on : ${{ matrix.runnerImage }}
79+ strategy :
80+ matrix :
81+ arch : [amd64, arm64]
82+ distro :
83+ [
84+ alpine.3.20,
85+ alpine.3.21,
86+ alpine.3.22,
87+ centos.stream.9,
88+ debian.12,
89+ fedora.41,
90+ fedora.42,
91+ ubuntu.22.04,
92+ ubuntu.24.04,
93+ ]
94+ sdk : ["8.0", "9.0"]
95+ include :
96+ - sdk : " 8.0"
97+ tfm : net8.0
98+ - sdk : " 9.0"
99+ tfm : net9.0
100+ - arch : amd64
101+ runnerImage : ubuntu-22.04
102+ - arch : arm64
103+ runnerImage : ubuntu-22.04-arm
104+ fail-fast : false
105+ steps :
106+ - name : Checkout
107+ uses : actions/checkout@v6
108+ with :
109+ fetch-depth : 0
110+ - name : Run ${{ matrix.tfm }} tests
111+ run : |
112+ git_command="git config --global --add safe.directory /app"
113+ test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
114+ docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" -w /app -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"
115+
116+ nuget-push :
117+ name : Octopus NuGet Push
118+ needs : [build, test, test-linux]
119+ # && github.ref == 'refs/heads/octopus/master'
120+ if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule'
121+ runs-on : ubuntu-22.04
122+ steps :
123+ - uses : actions/download-artifact@v8
124+
125+ with :
126+ path : staging
127+ - name : Push package to feed 🐙
128+ id : push-feed
129+ shell : bash
130+ env :
131+ FEED_API_KEY : ${{ secrets.FEED_API_KEY }}
132+ FEED_SOURCE : ${{ secrets.FEED_SOURCE }}
133+ run : dotnet nuget push staging/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE" --skip-duplicate
0 commit comments