Skip to content

Commit eb28eef

Browse files
committed
test using containers
1 parent 7a8394f commit eb28eef

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

.dockeignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.github/
2+
.idea/
3+
run/
4+
5+
[Bb]in/
6+
[Oo]bj/

.github/workflows/native-test.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: native-test
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'LibGit2Sharp.Native version to test'
7+
required: true
8+
default: '2.0.315-alpha.0.7'
9+
jobs:
10+
native_test:
11+
name: Test on [${{ matrix.arch }}] net${{ matrix.sdk }} SDK - ${{ matrix.os }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
arch: [ amd64, arm64 ]
16+
sdk: [ '6.0', '5.0', '3.1' ]
17+
os: [ 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 ]
18+
exclude:
19+
- arch: arm64
20+
os: alpine.3.12
21+
- arch: arm64
22+
os: alpine.3.13
23+
sdk: '3.1'
24+
- arch: arm64
25+
os: alpine.3.14
26+
sdk: '3.1'
27+
- arch: arm64
28+
os: centos.7
29+
fail-fast: false
30+
steps:
31+
- name: Checkout
32+
uses: actions/[email protected]
33+
with:
34+
fetch-depth: 0
35+
- name: Setup QEMU
36+
uses: docker/setup-qemu-action@v1
37+
if: matrix.arch == 'arm64'
38+
- name: Setup Docker Buildx
39+
uses: docker/setup-buildx-action@v1
40+
with:
41+
install: true
42+
- name: Build Docker Image
43+
run: |
44+
[[ ${{ matrix.sdk }} = '3.1' ]] && target="netcoreapp${{ matrix.sdk }}" || target="net${{ matrix.sdk }}"
45+
46+
docker buildx build -t native-test --output type=docker -f Dockerfile \
47+
--platform linux/${{ matrix.arch }} \
48+
--build-arg DISTRO=${{ matrix.os }} \
49+
--build-arg SDK=${{ matrix.sdk }} \
50+
--build-arg TARGET=$target \
51+
--build-arg VERSION=${{ github.event.inputs.version }} .
52+
53+
- name: Verify native binaries
54+
run: docker run --rm --platform linux/${{ matrix.arch }} --name native-test native-test

Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG DISTRO
2+
ARG SDK
3+
FROM gittools/build-images:$DISTRO-sdk-$SDK
4+
COPY . ./
5+
6+
ARG TARGET
7+
ARG VERSION
8+
9+
RUN dotnet build ./LibGit2Sharp.LoadTest -p:TargetFrameworks=${TARGET} --output run -p:NativeBinaries=${VERSION}
10+
11+
CMD [ "dotnet", "run/native-test.dll" ]

0 commit comments

Comments
 (0)