|
1 | 1 | name: CI |
2 | 2 | on: |
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: |
10 | 10 | env: |
11 | | - DOTNET_NOLOGO: true |
| 11 | + DOTNET_NOLOGO: true |
12 | 12 | jobs: |
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=octopus.${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 |
| 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 | 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: [ alpine.3.20, alpine.3.21, alpine.3.22, centos.stream.9, debian.12, fedora.41, fedora.42, ubuntu.22.04, ubuntu.24.04 ] |
83 | | - sdk: [ '8.0', '9.0' ] |
84 | | - include: |
85 | | - - sdk: '8.0' |
86 | | - tfm: net8.0 |
87 | | - - sdk: '9.0' |
88 | | - tfm: net9.0 |
89 | | - - arch: amd64 |
90 | | - runnerImage: ubuntu-22.04 |
91 | | - - arch: arm64 |
92 | | - runnerImage: ubuntu-22.04-arm |
93 | | - fail-fast: false |
94 | | - steps: |
95 | | - - name: Checkout |
96 | | - uses: actions/checkout@v6 |
97 | | - with: |
98 | | - fetch-depth: 0 |
99 | | - - name: Run ${{ matrix.tfm }} tests |
100 | | - run: | |
101 | | - git_command="git config --global --add safe.directory /app" |
102 | | - test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING" |
103 | | - 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" |
| 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" -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command" |
104 | 115 |
|
105 | | - nuget-push: |
106 | | - name: Octopus NuGet Push |
107 | | - needs: [build, test, test-linux] |
108 | | - # && github.ref == 'refs/heads/octopus/master' |
109 | | - if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule' |
110 | | - runs-on: ubuntu-22.04 |
111 | | - steps: |
112 | | - - uses: actions/download-artifact@v8 |
| 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 |
113 | 124 |
|
114 | | - with: |
115 | | - path: staging |
116 | | - - name: Push package to feed 🐙 |
117 | | - id: push-feed |
118 | | - shell: bash |
119 | | - env: |
120 | | - FEED_API_KEY: ${{ secrets.FEED_API_KEY }} |
121 | | - FEED_SOURCE: ${{ secrets.FEED_SOURCE }} |
122 | | - run: dotnet nuget push staging/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE" --skip-duplicate |
| 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