Skip to content

3rdparty: publish macOS + Windows prebuilt tarballs from CI #3

3rdparty: publish macOS + Windows prebuilt tarballs from CI

3rdparty: publish macOS + Windows prebuilt tarballs from CI #3

name: Build 3rdparty — libcurl
# Per-platform prebuilt STATIC libcurl (libcurl.a, OpenSSL TLS, HTTP/HTTPS
# only), published as release assets attached to the `lib-libcurl-<version>`
# tag and consumed at configure time by build-tools/picomesh/3rdparty-fetch.cmake
# (download the prebuilt tarball, fall back to a from-source build only when
# missing). Version source of truth: build-tools/3rdparty/libcurl/version.
#
# libcurl links the sibling OpenSSL recipe: _build.sh prefers the published
# `lib-openssl-<ver>` prebuilt and builds it from source on a miss, so this
# job is self-contained even before an openssl release is cut.
on:
push:
tags:
- 'lib-libcurl-*'
workflow_dispatch: {}
permissions:
contents: write
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.read.outputs.version }}
tag: ${{ steps.read.outputs.tag }}
steps:
- uses: actions/checkout@v4
- id: read
run: |
set -euo pipefail
V="$(tr -d '[:space:]' < build-tools/3rdparty/libcurl/version)"
[ -n "$V" ] || { echo "version file is empty" >&2; exit 1; }
if [[ "${{ github.event_name }}" == "push" ]]; then
REF="${GITHUB_REF#refs/tags/}"
EXPECT="lib-libcurl-$V"
if [ "$REF" != "$EXPECT" ]; then
echo "tag $REF does not match version file ($EXPECT)" >&2
exit 1
fi
fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "tag=lib-libcurl-$V" >> "$GITHUB_OUTPUT"
build:
needs: resolve
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Each target builds on its native runner so the published tarball is a
# real per-OS/per-arch artifact — the mesh fetches these instead of
# building any 3rdparty lib from source on the deploy host.
include:
- { target: linux-x86_64, os: ubuntu-latest }
- { target: linux-aarch64, os: ubuntu-latest }
- { target: linux-riscv64, os: ubuntu-latest }
- { target: macos-arm64, os: macos-14 }
- { target: macos-x86_64, os: macos-13 }
- { target: windows-x86_64, os: windows-latest }
steps:
- uses: actions/checkout@v4
- name: install linux deps
if: runner.os == 'Linux'
run: |
set -euo pipefail
sudo apt-get update -y
pkgs="build-essential perl cmake ninja-build pkg-config curl tar xz-utils ca-certificates git"
case "${{ matrix.target }}" in
linux-aarch64) pkgs="$pkgs gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu" ;;
linux-riscv64) pkgs="$pkgs gcc-riscv64-linux-gnu g++-riscv64-linux-gnu binutils-riscv64-linux-gnu" ;;
esac
sudo apt-get install -y --no-install-recommends $pkgs
- name: install macos deps
if: runner.os == 'macOS'
run: brew install ninja # cmake, clang, perl, make ship with the runner
- name: set up MSVC (windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: install windows deps
if: runner.os == 'Windows'
run: choco install ninja -y --no-progress
- name: build libcurl for ${{ matrix.target }}
shell: bash
run: |
mkdir -p out
TARGET_PLATFORM="${{ matrix.target }}" \
OUTPUT_DIR="$PWD/out" \
CACHE_DIR="$PWD/.cache" \
WORK_DIR="$PWD/.work" \
bash build-tools/3rdparty/libcurl/_build.sh
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.resolve.outputs.tag }}
files: out/libcurl-${{ matrix.target }}-*.tar.gz
fail_on_unmatched_files: true