Skip to content

Commit 21654fa

Browse files
authored
Update libgit2 and fix build (#9)
1 parent ad7caf7 commit 21654fa

9 files changed

Lines changed: 67 additions & 47 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ on:
33
push:
44
branches: [master, release-*]
55
tags:
6-
- '[0-9]+.[0-9]+.[0-9]+'
7-
- '[0-9]+.[0-9]+.[0-9]+-*'
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+-*"
88
pull_request:
99
workflow_dispatch:
1010
jobs:
@@ -16,13 +16,13 @@ jobs:
1616
strategy:
1717
matrix:
1818
include:
19-
- os: windows-2019
19+
- os: windows-2022
2020
name: win-x86
2121
param: -x86
22-
- os: windows-2019
22+
- os: windows-2022
2323
name: win-x64
2424
param: -x64
25-
- os: windows-2019
25+
- os: windows-2022
2626
name: win-arm64
2727
param: -arm64
2828
- os: ubuntu-24.04
@@ -39,14 +39,14 @@ jobs:
3939
name: linux-musl-arm
4040
- os: ubuntu-24.04
4141
name: linux-musl-arm64
42-
- os: macos-13
42+
- os: macos-26-intel
4343
name: osx-x64
44-
- os: macos-13
44+
- os: macos-26
4545
name: osx-arm64
4646
fail-fast: false
4747
steps:
4848
- name: Checkout
49-
uses: actions/checkout@v4.2.2
49+
uses: actions/checkout@v6.0.2
5050
with:
5151
submodules: true
5252
- name: Build Windows
@@ -56,39 +56,53 @@ jobs:
5656
if: runner.os == 'macOS'
5757
run: ./build.libgit2.sh
5858
- name: Setup QEMU
59-
if: matrix.name == 'linux-musl-arm' || matrix.name == 'linux-musl-arm64'
60-
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
59+
if: runner.os == 'Linux' && (matrix.name == 'linux-arm' || matrix.name == 'linux-arm64' || matrix.name == 'linux-ppc64le' || matrix.name == 'linux-musl-arm' || matrix.name == 'linux-musl-arm64')
60+
uses: docker/setup-qemu-action@v4
61+
- name: Set up Docker Buildx
62+
if: runner.os == 'Linux'
63+
uses: docker/setup-buildx-action@v4
6164
- name: Build Linux
6265
if: runner.os == 'Linux'
6366
run: ./dockerbuild.sh
6467
- name: Upload artifacts
65-
uses: actions/upload-artifact@v4.4.3
68+
uses: actions/upload-artifact@v7.0.0
6669
with:
6770
name: ${{ matrix.name }}
6871
path: nuget.package/runtimes/${{ matrix.name }}
6972
package:
70-
name: Create package
71-
needs: build
72-
runs-on: ubuntu-24.04
73-
env:
74-
DOTNET_NOLOGO: true
75-
steps:
73+
name: Create package
74+
needs: build
75+
runs-on: ubuntu-24.04
76+
env:
77+
DOTNET_NOLOGO: true
78+
steps:
7679
- name: Checkout
77-
uses: actions/checkout@v4.2.2
80+
uses: actions/checkout@v6.0.2
7881
with:
7982
fetch-depth: 0
8083
- name: Setup .NET SDK
81-
uses: actions/setup-dotnet@v4.1.0
84+
uses: actions/setup-dotnet@v5.2.0
8285
with:
8386
dotnet-version: 9.0.x
8487
- name: Download artifacts
85-
uses: actions/download-artifact@v4.1.8
88+
uses: actions/download-artifact@v8.0.1
8689
with:
8790
path: nuget.package/runtimes/
8891
- name: Create package
8992
run: dotnet pack nuget.package
9093
- name: Upload NuGet package
91-
uses: actions/upload-artifact@v4.4.3
94+
uses: actions/upload-artifact@v7.0.0
9295
with:
9396
name: NuGet package
9497
path: ./nuget.package/*.nupkg
98+
ci:
99+
name: ci
100+
needs: [build, package]
101+
runs-on: ubuntu-24.04
102+
steps:
103+
- name: Check results
104+
run: |
105+
if [ "${{ needs.build.result }}" != "success" ] || [ "${{ needs.package.result }}" != "success" ]; then
106+
echo "One or more jobs failed"
107+
exit 1
108+
fi

Dockerfile.linux

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
FROM bording/crossbuild
2-
ARG ARCH='amd64'
3-
ENV CROSS_TRIPLE=${ARCH}
4-
RUN apt update && apt -y install pkg-config
1+
FROM debian:bookworm-slim
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
build-essential \
5+
cmake \
6+
pkg-config \
7+
ca-certificates \
8+
git \
9+
&& rm -rf /var/lib/apt/lists/*
510

611
WORKDIR /nativebinaries
712
COPY . /nativebinaries/
813

9-
CMD ["/bin/bash", "-c", "./build.libgit2.sh"]
14+
CMD ["/bin/bash", "-c", "./build.libgit2.sh"]

Dockerfile.linux-musl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ARG ARCH='amd64'
2-
FROM multiarch/alpine:${ARCH}-v3.13
1+
FROM alpine:3.19
2+
33
RUN apk add --no-cache bash build-base cmake
44

55
WORKDIR /nativebinaries
66
COPY . /nativebinaries/
77

8-
CMD ["/bin/bash", "-c", "./build.libgit2.sh"]
8+
CMD ["/bin/bash", "-c", "./build.libgit2.sh"]

dockerbuild.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
set -e
44
echo "building for $RID"
55

6+
# Map RID to Docker platform for native builds (no cross-compilation).
67
if [[ $RID =~ arm64 ]]; then
7-
arch="arm64"
8+
platform="linux/arm64"
89
elif [[ $RID =~ arm ]]; then
9-
arch="armhf"
10+
platform="linux/arm/v7"
1011
elif [[ $RID =~ ppc64le ]]; then
11-
arch="powerpc64le"
12+
platform="linux/ppc64le"
1213
else
13-
arch="amd64"
14+
platform="linux/amd64"
1415
fi
1516

1617
if [[ $RID == linux-musl* ]]; then
@@ -19,9 +20,9 @@ else
1920
dockerfile="Dockerfile.linux"
2021
fi
2122

22-
docker buildx build -t $RID -f $dockerfile --build-arg ARCH=$arch .
23+
docker buildx build --platform "$platform" --load -t $RID -f $dockerfile .
2324

24-
docker run -t -e RID=$RID --name=$RID $RID
25+
docker run --platform "$platform" -t -e RID=$RID --name=$RID $RID
2526

2627
docker cp $RID:/nativebinaries/nuget.package/runtimes nuget.package
2728

libgit2

Submodule libgit2 updated 444 files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<libgit2_propsfile>$(MSBuildThisFileFullPath)</libgit2_propsfile>
4-
<libgit2_hash>3f4182d15eab74a302718f2de454ffadb1995626</libgit2_hash>
5-
<libgit2_filename>git2-3f4182d</libgit2_filename>
4+
<libgit2_hash>ca225744b992bf2bf24e9a2eb357ddef78179667</libgit2_hash>
5+
<libgit2_filename>git2-ca22574</libgit2_filename>
66
</PropertyGroup>
77
</Project>

nuget.package/build/net46/LibGit2Sharp.NativeBinaries.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project>
22
<PropertyGroup>
33
<libgit2_propsfile>$(MSBuildThisFileFullPath)</libgit2_propsfile>
4-
<libgit2_hash>3f4182d15eab74a302718f2de454ffadb1995626</libgit2_hash>
5-
<libgit2_filename>git2-3f4182d</libgit2_filename>
4+
<libgit2_hash>ca225744b992bf2bf24e9a2eb357ddef78179667</libgit2_hash>
5+
<libgit2_filename>git2-ca22574</libgit2_filename>
66
</PropertyGroup>
77
<ItemGroup>
88
<ContentWithTargetPath Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\*" TargetPath="lib\win32\x86\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<configuration>
2-
<dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-3f4182d" target="lib/linux-x64/libgit2-3f4182d.so" />
3-
<dllmap os="linux" cpu="arm" wordsize="32" dll="git2-3f4182d" target="lib/linux-arm/libgit2-3f4182d.so" />
4-
<dllmap os="linux" cpu="armv8" wordsize="64" dll="git2-3f4182d" target="lib/linux-arm64/libgit2-3f4182d.so" />
5-
<dllmap os="linux" cpu="ppc64le" wordsize="64" dll="git2-3f4182d" target="lib/linux-ppc64le/libgit2-3f4182d.so" />
6-
<dllmap os="osx" cpu="x86-64" wordsize="64" dll="git2-3f4182d" target="lib/osx-x64/libgit2-3f4182d.dylib" />
7-
<dllmap os="osx" cpu="armv8" wordsize="64" dll="git2-3f4182d" target="lib/osx-arm64/libgit2-3f4182d.dylib" />
2+
<dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-ca22574" target="lib/linux-x64/libgit2-ca22574.so" />
3+
<dllmap os="linux" cpu="arm" wordsize="32" dll="git2-ca22574" target="lib/linux-arm/libgit2-ca22574.so" />
4+
<dllmap os="linux" cpu="armv8" wordsize="64" dll="git2-ca22574" target="lib/linux-arm64/libgit2-ca22574.so" />
5+
<dllmap os="linux" cpu="ppc64le" wordsize="64" dll="git2-ca22574" target="lib/linux-ppc64le/libgit2-ca22574.so" />
6+
<dllmap os="osx" cpu="x86-64" wordsize="64" dll="git2-ca22574" target="lib/osx-x64/libgit2-ca22574.dylib" />
7+
<dllmap os="osx" cpu="armv8" wordsize="64" dll="git2-ca22574" target="lib/osx-arm64/libgit2-ca22574.dylib" />
88
</configuration>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3f4182d15eab74a302718f2de454ffadb1995626
1+
ca225744b992bf2bf24e9a2eb357ddef78179667

0 commit comments

Comments
 (0)