Skip to content

Commit 4daf618

Browse files
authored
Merge pull request #1921 from arturcic/feature/test-native
Test native libraries using docker for multiple distros
2 parents abdd8fb + b90a6a9 commit 4daf618

File tree

2 files changed

+70
-25
lines changed

2 files changed

+70
-25
lines changed

.github/workflows/ci.yml

+69-24
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,36 @@ env:
1111
DOTNET_NOLOGO: true
1212
jobs:
1313
build:
14-
name: ${{ matrix.name }}
14+
name: Build
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- name: Checkout
18+
uses: actions/[email protected]
19+
with:
20+
fetch-depth: 0
21+
- name: Install .NET SDK
22+
uses: actions/[email protected]
23+
with:
24+
dotnet-version: 6.0.x
25+
- name: Build
26+
run: dotnet build LibGit2Sharp.sln --configuration Release
27+
- name: Upload packages
28+
uses: actions/[email protected]
29+
with:
30+
name: NuGet packages
31+
path: bin/Packages/
32+
retention-days: 7
33+
test:
34+
name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
1535
runs-on: ${{ matrix.os }}
1636
strategy:
1737
matrix:
18-
include:
19-
- os: windows-2019
20-
name: Windows
21-
- os: ubuntu-20.04
22-
name: Linux
38+
arch: [ amd64 ]
39+
os: [windows-2019, macos-10.15]
40+
tfm: [ net472, netcoreapp3.1, net5.0, net6.0 ]
41+
exclude:
2342
- os: macos-10.15
24-
name: macOS
43+
tfm: net472
2544
fail-fast: false
2645
steps:
2746
- name: Checkout
@@ -33,28 +52,54 @@ jobs:
3352
with:
3453
dotnet-version: 6.0.x
3554
- name: Install .NET 5 runtime
55+
if: matrix.tfm == 'net5.0'
3656
uses: actions/[email protected]
3757
with:
3858
dotnet-version: 5.0.x
3959
- name: Install .NET Core 3.1 runtime
60+
if: matrix.tfm == 'netcoreapp3.1'
4061
uses: actions/[email protected]
4162
with:
4263
dotnet-version: 3.1.x
43-
- name: Build
44-
run: dotnet build LibGit2Sharp.sln --configuration Release
45-
- name: Upload packages
46-
if: matrix.name == 'Windows'
47-
uses: actions/[email protected]
64+
- name: Run ${{ matrix.tfm }} tests
65+
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
66+
test-linux:
67+
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
68+
runs-on: ubuntu-20.04
69+
strategy:
70+
matrix:
71+
arch: [ amd64 ]
72+
# arch: [ amd64, arm64 ]
73+
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 ]
74+
sdk: [ '6.0', '5.0', '3.1' ]
75+
exclude:
76+
- arch: arm64
77+
distro: alpine.3.12
78+
- arch: arm64
79+
distro: alpine.3.13
80+
sdk: '3.1'
81+
- arch: arm64
82+
distro: alpine.3.14
83+
sdk: '3.1'
84+
- arch: arm64
85+
distro: centos.7
86+
include:
87+
- sdk: '6.0'
88+
tfm: net6.0
89+
- sdk: '5.0'
90+
tfm: net5.0
91+
- sdk: '3.1'
92+
tfm: netcoreapp3.1
93+
fail-fast: false
94+
steps:
95+
- name: Checkout
96+
uses: actions/[email protected]
4897
with:
49-
name: NuGet packages
50-
path: bin/Packages/
51-
retention-days: 7
52-
- name: Run net472 tests
53-
if: matrix.name == 'Windows'
54-
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net472 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
55-
- name: Run netcoreapp3.1 tests
56-
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework netcoreapp3.1 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
57-
- name: Run net5.0 tests
58-
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net5.0 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
59-
- name: Run net6.0 tests
60-
run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net6.0 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
98+
fetch-depth: 0
99+
- name: Setup QEMU
100+
if: matrix.arch == 'arm64'
101+
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
102+
- name: Run ${{ matrix.tfm }} tests
103+
run: |
104+
test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
105+
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$test_command"

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

0 commit comments

Comments
 (0)