Skip to content

feat: support musl variants of pact ffi and upgrade to pact_ffi 0.4.16 #14

feat: support musl variants of pact ffi and upgrade to pact_ffi 0.4.16

feat: support musl variants of pact ffi and upgrade to pact_ffi 0.4.16 #14

Workflow file for this run

name: CI
on: [push, pull_request]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
NUGET_FEED: https://api.nuget.org/v3/index.json
jobs:
build-dotnet:
name: "Build and Test (dotnet)"
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-12
alpine: [false]
arch: ["x86_64"]
include:
- os: ubuntu-latest
alpine: true
arch: x86_64
- os: ubuntu-latest
alpine: true
arch: aarch64
- os: macos-14
alpine: false
arch: aarch64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.0.x" # runners already have .Net Framework installed as well
- name: Set up QEMU
if: matrix.alpine == true
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: matrix.alpine == true
uses: docker/setup-buildx-action@v3
- name: Pull interop dependencies
if: matrix.alpine != true
run: bash -c "build/download-native-libs.sh"
- name: Restore
if: matrix.alpine != true
run: dotnet restore
- name: Build
if: matrix.alpine != true
run: dotnet build --no-restore
- name: Test
if: matrix.alpine != true
run: dotnet test --no-build --verbosity normal
- name: Patch PactNet.csproj
if: matrix.alpine == true
run: sed -Ei "s|${{ matrix.arch }}\\\libpact_ffi.so|${{ matrix.arch }}-musl\\\libpact_ffi.so|" src/PactNet/PactNet.csproj
- name: test linux amd64 musl
if: matrix.alpine == true && matrix.arch == 'x86_64'
run: |
docker run --platform=linux/amd64 --rm -v $PWD:/app mcr.microsoft.com/dotnet/sdk:7.0-alpine /bin/sh -c 'apk add --no-cache curl bash gzip && cd /app && build/download-native-libs.sh && dotnet restore && dotnet build --no-restore && dotnet test --no-build --verbosity normal'
- name: test linux arm64 musl
if: matrix.alpine == true && matrix.arch == 'aarch64'
run: |
docker run --platform=linux/arm64 --rm -v $PWD:/app mcr.microsoft.com/dotnet/sdk:7.0-alpine /bin/sh -c 'apk add --no-cache curl bash gzip && cd /app && build/download-native-libs.sh && dotnet restore && dotnet build --no-restore && dotnet test --no-build --verbosity normal'
- name: Pack
if: matrix.os == 'windows-latest'
run: dotnet pack --verbosity normal -c Release --no-restore --include-source --version-suffix alpha.${{ github.run_number }} -o ./dist
- name: Upload Artifact
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: nupkgs
path: ./dist/*.*
release:
needs: build-dotnet
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.0.x" # runners already have .Net Framework installed as well
- name: Pull interop dependencies
run: bash -c "build/download-native-libs.sh"
- name: Pack
run: |
VERSION="${{ github.ref_name }}"
echo "Version: $VERSION"
dotnet pack -c Release --include-source -p:Version=$VERSION -o ./dist src/PactNet/PactNet.csproj
dotnet pack -c Release --include-source -p:Version=$VERSION -o ./dist src/PactNet.Abstractions/PactNet.Abstractions.csproj
dotnet pack -c Release --include-source -o ./dist src/PactNet.Output.Xunit/PactNet.Output.Xunit.csproj
- name: Push
run: dotnet nuget push ./dist/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: dist/*.*