Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to GitHub Actions #121

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI
on:
push:
branches: [master, release-*]
tags: ["*.*.*"]
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
RID: ${{ matrix.name }}
strategy:
matrix:
include:
- os: windows-2019
name: win-x86
param: -x86
- os: windows-2019
name: win-x64
param: -x64
- os: ubuntu-20.04
name: linux-x64
- os: ubuntu-20.04
name: linux-musl-x64
- os: ubuntu-20.04
name: linux-arm64
- os: ubuntu-20.04
name: linux-arm
- os: macos-10.15
name: osx-x64
fail-fast: false
steps:
- name: Checkout
uses: actions/[email protected]
with:
submodules: true
- name: Build Windows
if: runner.os == 'Windows'
run: ./build.libgit2.ps1 ${{ matrix.param }}
- name: Build macOS
if: runner.os == 'macOS'
run: ./build.libgit2.sh
- name: Build Linux
if: runner.os == 'Linux'
run: ./dockerbuild.sh
- name: Upload artifacts
uses: actions/[email protected]
with:
name: ${{ matrix.name }}
path: nuget.package/runtimes/${{ matrix.name }}
package:
name: Create package
needs: build
runs-on: windows-2019
env:
DOTNET_NOLOGO: true
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 5.0.x
- name: Install MinVer
run: dotnet tool install --global minver-cli
- name: Run MinVer
id: minver
run: echo "::set-output name=version::$(minver)"
- name: Download artifacts
uses: actions/[email protected]
with:
path: nuget.package/runtimes/
- name: Create package
run: ./nuget.exe Pack nuget.package/NativeBinaries.nuspec -Version ${{ steps.minver.outputs.version }} -NoPackageAnalysis
- name: Upload NuGet package
uses: actions/[email protected]
with:
name: NuGet package
path: ./*.nupkg
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

66 changes: 35 additions & 31 deletions build.libgit2.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<#
.SYNOPSIS
Builds a version of libgit2 and copies it to the nuget packaging directory.
.PARAMETER vs
Version of Visual Studio project files to generate. Cmake supports "10" (default), "11" and "12".
.PARAMETER test
If set, run the libgit2 tests on the desired version.
.PARAMETER debug
If set, build the "Debug" configuration of libgit2, rather than "RelWithDebInfo" (default).
If set, build the "Debug" configuration of libgit2, rather than "Release" (default).
#>

Param(
[string]$vs = '10',
[string]$libgit2Name = '',
[switch]$test,
[switch]$debug
[switch]$debug,
[switch]$x86,
[switch]$x64
)

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

$configuration = "RelWithDebInfo"
$configuration = "Release"
if ($debug.IsPresent) { $configuration = "Debug" }

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

Write-Output "Building 32-bit..."
Run-Command -Quiet { & remove-item build -recurse -force }
Run-Command -Quiet { & remove-item build -recurse -force -ErrorAction Ignore }
Run-Command -Quiet { & mkdir build }
cd build
Run-Command -Quiet -Fatal { & $cmake -G "Visual Studio $vs" -D ENABLE_TRACE=ON -D "BUILD_CLAR=$build_clar" -D "LIBGIT2_FILENAME=$binaryFilename" .. }
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
cd $configuration
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
Run-Command -Quiet { & rm *.exp }
Run-Command -Quiet { & rm $x86Directory\* }
Run-Command -Quiet { & mkdir -fo $x86Directory }
Run-Command -Quiet -Fatal { & copy -fo * $x86Directory -Exclude *.lib }

Write-Output "Building 64-bit..."
cd ..
Run-Command -Quiet { & mkdir build64 }
cd build64
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" ../.. }
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
cd $configuration
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
Run-Command -Quiet { & rm *.exp }
Run-Command -Quiet { & rm $x64Directory\* }
Run-Command -Quiet { & mkdir -fo $x64Directory }
Run-Command -Quiet -Fatal { & copy -fo * $x64Directory -Exclude *.lib }

if ($x86.IsPresent) {
Write-Output "Building 32-bit..."
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" .. }
Run-Command -Fatal { & $cmake --build . --config $configuration }
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
cd $configuration
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
Run-Command -Quiet { & rm *.exp }
Run-Command -Quiet { & rm $x86Directory\* -ErrorAction Ignore }
Run-Command -Quiet { & mkdir -fo $x86Directory }
Run-Command -Quiet -Fatal { & copy -fo * $x86Directory -Exclude *.lib }
cd ..
}

if ($x64.IsPresent) {
Write-Output "Building 64-bit..."
Run-Command -Quiet { & mkdir build64 }
cd build64
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" ../.. }
Run-Command -Fatal { & $cmake --build . --config $configuration }
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
cd $configuration
Assert-Consistent-Naming "$binaryFilename.dll" "*.dll"
Run-Command -Quiet { & rm *.exp }
Run-Command -Quiet { & rm $x64Directory\* -ErrorAction Ignore }
Run-Command -Quiet { & mkdir -fo $x64Directory }
Run-Command -Quiet -Fatal { & copy -fo * $x64Directory -Exclude *.lib }
}

Write-Output "Done!"
}
Expand Down
2 changes: 1 addition & 1 deletion build.libgit2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cmake -DCMAKE_BUILD_TYPE:STRING=Release \
-DUSE_SSH=OFF \
-DENABLE_TRACE=ON \
-DLIBGIT2_FILENAME=git2-$SHORTSHA \
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DUSE_HTTPS=$USEHTTPS \
-DUSE_BUNDLED_ZLIB=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
Expand Down
11 changes: 0 additions & 11 deletions buildpackage.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion dockerbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

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

docker run -it -e RID=$RID --name=$RID $RID
docker run -t -e RID=$RID --name=$RID $RID

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

Expand Down
Loading