Skip to content

Test native libraries using docker for multiple distros #1921

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

Merged
merged 2 commits into from
Nov 14, 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
93 changes: 69 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,36 @@ env:
DOTNET_NOLOGO: true
jobs:
build:
name: ${{ matrix.name }}
name: Build
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release
- name: Upload packages
uses: actions/[email protected]
with:
name: NuGet packages
path: bin/Packages/
retention-days: 7
test:
name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2019
name: Windows
- os: ubuntu-20.04
name: Linux
arch: [ amd64 ]
os: [windows-2019, macos-10.15]
tfm: [ net472, netcoreapp3.1, net5.0, net6.0 ]
exclude:
- os: macos-10.15
name: macOS
tfm: net472
fail-fast: false
steps:
- name: Checkout
Expand All @@ -33,28 +52,54 @@ jobs:
with:
dotnet-version: 6.0.x
- name: Install .NET 5 runtime
if: matrix.tfm == 'net5.0'
uses: actions/[email protected]
with:
dotnet-version: 5.0.x
- name: Install .NET Core 3.1 runtime
if: matrix.tfm == 'netcoreapp3.1'
uses: actions/[email protected]
with:
dotnet-version: 3.1.x
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release
- name: Upload packages
if: matrix.name == 'Windows'
uses: actions/[email protected]
- name: Run ${{ matrix.tfm }} tests
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
test-linux:
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ubuntu-20.04
strategy:
matrix:
arch: [ amd64 ]
# arch: [ amd64, arm64 ]
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ]
sdk: [ '6.0', '5.0', '3.1' ]
exclude:
- arch: arm64
distro: alpine.3.12
- arch: arm64
distro: alpine.3.13
sdk: '3.1'
- arch: arm64
distro: alpine.3.14
sdk: '3.1'
- arch: arm64
distro: centos.7
include:
- sdk: '6.0'
tfm: net6.0
- sdk: '5.0'
tfm: net5.0
- sdk: '3.1'
tfm: netcoreapp3.1
fail-fast: false
steps:
- name: Checkout
uses: actions/[email protected]
with:
name: NuGet packages
path: bin/Packages/
retention-days: 7
- name: Run net472 tests
if: matrix.name == 'Windows'
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net472 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
- name: Run netcoreapp3.1 tests
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework netcoreapp3.1 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
- name: Run net5.0 tests
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net5.0 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
- name: Run net6.0 tests
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net6.0 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
fetch-depth: 0
- name: Setup QEMU
if: matrix.arch == 'arm64'
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
- name: Run ${{ matrix.tfm }} tests
run: |
test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$test_command"
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down