Public-readable Tier-1 exception (alongside sporel-meta) for the practical reason that community pipelines need to call into these workflows without per-repo deploy-token setup. 5 reusable workflows moved from sporel-meta/.gitea/workflows/ to here (Plan-B.1: privacy-fix for sporel-meta which stays private with the proprietary design docs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
89 lines
3.2 KiB
YAML
89 lines
3.2 KiB
YAML
# Reusable workflow: C-Lib (Cat 2 per ADR-0025)
|
|
# Build C-Lib gegen Engine-Release-Headers + Import-Lib → on-tag zip
|
|
name: C-Lib CI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
engine_release_tag:
|
|
description: "Engine release to build against (e.g. 'v0.1.0' or 'latest')"
|
|
type: string
|
|
default: "latest"
|
|
build_type:
|
|
type: string
|
|
default: "Release"
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download engine release (headers + import lib)
|
|
shell: bash
|
|
env:
|
|
GITEA_API: "https://git.davoryn.de/api/v1"
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
OS_TAG="${{ matrix.os }}"
|
|
OS_TAG="${OS_TAG//-latest/}"
|
|
TAG="${{ inputs.engine_release_tag }}"
|
|
if [ "$TAG" = "latest" ]; then
|
|
TAG=$(curl -sH "Authorization: token ${GITEA_TOKEN}" \
|
|
"${GITEA_API}/repos/calic/sporel-engine/releases/latest" | \
|
|
grep -oP '"tag_name":"\K[^"]+')
|
|
fi
|
|
ARTEFACT="sporel-engine-${TAG}-${OS_TAG}.zip"
|
|
mkdir -p engine-release
|
|
curl -sL -H "Authorization: token ${GITEA_TOKEN}" \
|
|
-o "engine-release/${ARTEFACT}" \
|
|
"https://git.davoryn.de/calic/sporel-engine/releases/download/${TAG}/${ARTEFACT}"
|
|
cd engine-release && unzip "${ARTEFACT}" && rm "${ARTEFACT}"
|
|
echo "SPOREL_ROOT=${{ github.workspace }}/engine-release" >> "$GITHUB_ENV"
|
|
|
|
- name: Manifest validation (lib.json)
|
|
shell: bash
|
|
run: |
|
|
if [ -f lib.json ]; then
|
|
python3 -c "import json,sys; d=json.load(open('lib.json'));
|
|
assert d.get('id'), 'missing id'; assert d.get('version'), 'missing version';
|
|
assert d.get('api'), 'missing api field (per ADR-0022)';
|
|
print('lib.json OK:', d['id'], d['version'])"
|
|
else
|
|
echo "::warning::no lib.json found"
|
|
fi
|
|
|
|
- name: README presence (per ADR-0026)
|
|
shell: bash
|
|
run: |
|
|
test -s README.md || (echo "::error::README.md missing or empty" && exit 1)
|
|
|
|
- name: Configure CMake
|
|
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DSPOREL_ROOT=${{ env.SPOREL_ROOT }}
|
|
|
|
- name: Build
|
|
run: cmake --build build --config ${{ inputs.build_type }} --parallel
|
|
|
|
- name: Package lib (on tag)
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
shell: bash
|
|
run: |
|
|
OS_TAG="${{ matrix.os }}"
|
|
OS_TAG="${OS_TAG//-latest/}"
|
|
ARTEFACT_NAME="${GITHUB_REPOSITORY##*/}-${GITHUB_REF_NAME}-${OS_TAG}.zip"
|
|
cmake --install build --prefix=${{ github.workspace }}/lib-install --config ${{ inputs.build_type }}
|
|
cd lib-install && zip -r "../${ARTEFACT_NAME}" . && cd ..
|
|
echo "ARTEFACT_NAME=${ARTEFACT_NAME}" >> "$GITHUB_ENV"
|
|
|
|
- name: Upload to Gitea Release (on tag)
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
files: ${{ env.ARTEFACT_NAME }}
|