Skip to content

Build in statically linked libssh2 for openssl1.1 #50

Build in statically linked libssh2 for openssl1.1

Build in statically linked libssh2 for openssl1.1 #50

Workflow file for this run

name: CI
on:
push:
branches: [master, release-*]
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-*"
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
RID: ${{ matrix.rid }}
VARIANT: ${{ matrix.variant }}
strategy:
matrix:
include:
- os: windows-2022
name: win-x86
rid: win-x86
param: -x86
- os: windows-2022
name: win-x64
rid: win-x64
param: -x64
- os: windows-2022
name: win-arm64
rid: win-arm64
param: -arm64
- os: ubuntu-24.04
name: linux-x64
rid: linux-x64
- os: ubuntu-24.04
name: linux-x64-openssl1.1
rid: linux-x64
variant: openssl1.1
- os: ubuntu-24.04
name: linux-arm
rid: linux-arm
- os: ubuntu-24.04
name: linux-arm-openssl1.1
rid: linux-arm
variant: openssl1.1
- os: ubuntu-24.04
name: linux-arm64
rid: linux-arm64
- os: ubuntu-24.04
name: linux-arm64-openssl1.1
rid: linux-arm64
variant: openssl1.1
# debian:bullseye-slim has no ppc64le manifest, so the openssl1.1
# variant is omitted for this RID.
- os: ubuntu-24.04
name: linux-ppc64le
rid: linux-ppc64le
- os: ubuntu-24.04
name: linux-musl-x64
rid: linux-musl-x64
- os: ubuntu-24.04
name: linux-musl-arm
rid: linux-musl-arm
- os: ubuntu-24.04
name: linux-musl-arm64
rid: linux-musl-arm64
- os: macos-26-intel
name: osx-x64
rid: osx-x64
- os: macos-26
name: osx-arm64
rid: osx-arm64
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
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: Setup QEMU
if: runner.os == 'Linux' && (matrix.rid == 'linux-arm' || matrix.rid == 'linux-arm64' || matrix.rid == 'linux-ppc64le' || matrix.rid == 'linux-musl-arm' || matrix.rid == 'linux-musl-arm64')
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v4
- name: Build Linux
if: runner.os == 'Linux'
run: ./dockerbuild.sh
- name: Upload artifacts
uses: actions/upload-artifact@v7.0.0
with:
name: ${{ matrix.name }}
path: nuget.package/runtimes/${{ matrix.rid }}
package:
name: Create package
needs: build
runs-on: ubuntu-24.04
env:
DOTNET_NOLOGO: true
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: 9.0.x
- name: Compute version override for branch builds
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
id: version
run: |
# Latest release tag matching the convention <upstream-version>-octopus.<n> (see README "Releasing")
LATEST=$(git tag --list --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-octopus\.[0-9]+$' | head -n 1)
if [ -z "$LATEST" ]; then
echo "::error::No release tag matching <upstream-version>-octopus.<n> found"
exit 1
fi
# Sanitize branch name: lowercase, replace non-alphanumeric with hyphen, trim to 20 chars
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
SAFE_BRANCH=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//' | cut -c1-20)
# Join with '.' (not '-') so branch/run land as separate prerelease IDs, keeping ordering correct vs the next octopus.<n+1>
echo "override=${LATEST}.${SAFE_BRANCH}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
- name: Download artifacts
uses: actions/download-artifact@v8.0.1
with:
path: nuget.package/runtimes/
- name: Merge variant artifacts into RID directories
shell: bash
run: |
cd nuget.package/runtimes
for d in *-openssl1.1; do
[[ -d "$d" ]] || continue
rid="${d%-openssl1.1}"
mkdir -p "$rid/native"
mv "$d/native/"* "$rid/native/"
rm -rf "$d"
done
- name: Create package
run: dotnet pack nuget.package ${{ steps.version.outputs.override && format('/p:MinVerVersionOverride={0}', steps.version.outputs.override) || '' }}
- name: Upload NuGet package
uses: actions/upload-artifact@v7.0.0
with:
name: NuGet package
path: ./nuget.package/*.nupkg
- name: Push package to feed
shell: bash
env:
FEED_API_KEY: ${{ secrets.FEED_API_KEY }}
FEED_SOURCE: ${{ secrets.FEED_SOURCE }}
run: dotnet nuget push ./nuget.package/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE"
ci:
name: ci
needs: [build, package]
runs-on: ubuntu-24.04
steps:
- name: Check results
run: |
if [ "${{ needs.build.result }}" != "success" ] || [ "${{ needs.package.result }}" != "success" ]; then
echo "One or more jobs failed"
exit 1
fi