Skip to content

Commit 7ae19d6

Browse files
committedAug 12, 2021
Switch to GitHub Actions
1 parent ea4140e commit 7ae19d6

10 files changed

+120
-293
lines changed
 

‎.github/workflows/ci.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master, release-*]
5+
tags: ["*.*.*"]
6+
pull_request:
7+
workflow_dispatch:
8+
jobs:
9+
build:
10+
name: ${{ matrix.name }}
11+
runs-on: ${{ matrix.os }}
12+
env:
13+
RID: ${{ matrix.name }}
14+
strategy:
15+
matrix:
16+
include:
17+
- os: windows-2019
18+
name: win-x86
19+
param: -x86
20+
- os: windows-2019
21+
name: win-x64
22+
param: -x64
23+
- os: ubuntu-20.04
24+
name: linux-x64
25+
- os: ubuntu-20.04
26+
name: linux-musl-x64
27+
- os: ubuntu-20.04
28+
name: linux-arm64
29+
- os: ubuntu-20.04
30+
name: linux-arm
31+
- os: macos-10.15
32+
name: osx-x64
33+
fail-fast: false
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v2.3.4
37+
with:
38+
submodules: true
39+
- name: Build Windows
40+
if: runner.os == 'Windows'
41+
run: ./build.libgit2.ps1 ${{ matrix.param }}
42+
- name: Build macOS
43+
if: runner.os == 'macOS'
44+
run: ./build.libgit2.sh
45+
- name: Build Linux
46+
if: runner.os == 'Linux'
47+
run: ./dockerbuild.sh
48+
- name: Upload artifacts
49+
uses: actions/upload-artifact@v2.2.2
50+
with:
51+
name: ${{ matrix.name }}
52+
path: nuget.package/runtimes/${{ matrix.name }}
53+
package:
54+
name: Create package
55+
needs: build
56+
runs-on: windows-2019
57+
env:
58+
DOTNET_NOLOGO: true
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v2.3.4
62+
with:
63+
fetch-depth: 0
64+
- name: Setup .NET SDK
65+
uses: actions/setup-dotnet@v1.7.2
66+
with:
67+
dotnet-version: 5.0.x
68+
- name: Install MinVer
69+
run: dotnet tool install --global minver-cli
70+
- name: Run MinVer
71+
id: minver
72+
run: echo "::set-output name=version::$(minver)"
73+
- name: Download artifacts
74+
uses: actions/download-artifact@v2.0.10
75+
with:
76+
path: nuget.package/runtimes/
77+
- name: Create package
78+
run: ./nuget.exe Pack nuget.package/NativeBinaries.nuspec -Version ${{ steps.minver.outputs.version }} -NoPackageAnalysis
79+
- name: Upload NuGet package
80+
uses: actions/upload-artifact@v2.2.2
81+
with:
82+
name: NuGet package
83+
path: ./*.nupkg

‎.travis.yml

-42
This file was deleted.

‎appveyor.yml

-28
This file was deleted.

‎build.libgit2.ps1

+35-31
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<#
22
.SYNOPSIS
33
Builds a version of libgit2 and copies it to the nuget packaging directory.
4-
.PARAMETER vs
5-
Version of Visual Studio project files to generate. Cmake supports "10" (default), "11" and "12".
64
.PARAMETER test
75
If set, run the libgit2 tests on the desired version.
86
.PARAMETER debug
9-
If set, build the "Debug" configuration of libgit2, rather than "RelWithDebInfo" (default).
7+
If set, build the "Debug" configuration of libgit2, rather than "Release" (default).
108
#>
119

1210
Param(
13-
[string]$vs = '10',
1411
[string]$libgit2Name = '',
1512
[switch]$test,
16-
[switch]$debug
13+
[switch]$debug,
14+
[switch]$x86,
15+
[switch]$x64
1716
)
1817

1918
Set-StrictMode -Version Latest
@@ -34,7 +33,7 @@ if (![string]::IsNullOrEmpty($libgit2Name)) {
3433
$build_clar = 'OFF'
3534
if ($test.IsPresent) { $build_clar = 'ON' }
3635

37-
$configuration = "RelWithDebInfo"
36+
$configuration = "Release"
3837
if ($debug.IsPresent) { $configuration = "Debug" }
3938

4039
function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) {
@@ -106,33 +105,38 @@ try {
106105
$cmake = Find-CMake
107106
$ctest = Join-Path (Split-Path -Parent $cmake) "ctest.exe"
108107

109-
Write-Output "Building 32-bit..."
110-
Run-Command -Quiet { & remove-item build -recurse -force }
108+
Run-Command -Quiet { & remove-item build -recurse -force -ErrorAction Ignore }
111109
Run-Command -Quiet { & mkdir build }
112110
cd build
113-
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" .. }
114-
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
115-
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
116-
cd $configuration
117-
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
118-
Run-Command -Quiet { & rm *.exp }
119-
Run-Command -Quiet { & rm $x86Directory\* }
120-
Run-Command -Quiet { & mkdir -fo $x86Directory }
121-
Run-Command -Quiet -Fatal { & copy -fo * $x86Directory -Exclude *.lib }
122-
123-
Write-Output "Building 64-bit..."
124-
cd ..
125-
Run-Command -Quiet { & mkdir build64 }
126-
cd build64
127-
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -A x64 -D THREADSAFE=ON -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" ../.. }
128-
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
129-
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
130-
cd $configuration
131-
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
132-
Run-Command -Quiet { & rm *.exp }
133-
Run-Command -Quiet { & rm $x64Directory\* }
134-
Run-Command -Quiet { & mkdir -fo $x64Directory }
135-
Run-Command -Quiet -Fatal { & copy -fo * $x64Directory -Exclude *.lib }
111+
112+
if ($x86.IsPresent) {
113+
Write-Output "Building 32-bit..."
114+
Run-Command -Fatal { & $cmake -G "Visual Studio 16 2019" -D ENABLE_TRACE=ON -D USE_SSH=OFF -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" .. }
115+
Run-Command -Fatal { & $cmake --build . --config $configuration }
116+
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
117+
cd $configuration
118+
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
119+
Run-Command -Quiet { & rm *.exp }
120+
Run-Command -Quiet { & rm $x86Directory\* -ErrorAction Ignore }
121+
Run-Command -Quiet { & mkdir -fo $x86Directory }
122+
Run-Command -Quiet -Fatal { & copy -fo * $x86Directory -Exclude *.lib }
123+
cd ..
124+
}
125+
126+
if ($x64.IsPresent) {
127+
Write-Output "Building 64-bit..."
128+
Run-Command -Quiet { & mkdir build64 }
129+
cd build64
130+
Run-Command -Fatal { & $cmake -G "Visual Studio 16 2019" -A x64 -D THREADSAFE=ON -D USE_SSH=OFF -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" ../.. }
131+
Run-Command -Fatal { & $cmake --build . --config $configuration }
132+
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
133+
cd $configuration
134+
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
135+
Run-Command -Quiet { & rm *.exp }
136+
Run-Command -Quiet { & rm $x64Directory\* -ErrorAction Ignore }
137+
Run-Command -Quiet { & mkdir -fo $x64Directory }
138+
Run-Command -Quiet -Fatal { & copy -fo * $x64Directory -Exclude *.lib }
139+
}
136140

137141
Write-Output "Done!"
138142
}

‎build.libgit2.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cmake -DCMAKE_BUILD_TYPE:STRING=Release \
3333
-DUSE_SSH=OFF \
3434
-DENABLE_TRACE=ON \
3535
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
36-
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
36+
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
3737
-DUSE_HTTPS=$USEHTTPS \
3838
-DUSE_BUNDLED_ZLIB=ON \
3939
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \

‎buildpackage.ps1

-11
This file was deleted.

‎dockerbuild.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
docker build -t $RID -f Dockerfile.$RID .
66

7-
docker run -it -e RID=$RID --name=$RID $RID
7+
docker run -t -e RID=$RID --name=$RID $RID
88

99
docker cp $RID:/nativebinaries/nuget.package/runtimes nuget.package
1010

‎download.build.artifacts.and.package.ps1

-162
This file was deleted.

‎nuget.exe

2.09 MB
Binary file not shown.

‎uploadbinaries.sh

-17
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.