# .build.yml # # SourceHut build manifest for YAMS (single Linux target). # Key points: # - Compute version from Git ref (GIT_REF) at runtime; no manifest expressions. # - Persist computed version into ~/.buildenv for subsequent tasks. # - Add static build tags for search/badges. # - Gate packaging steps so they only run on tag builds. # - Fix CMake configure line continuation. image: archlinux # Other possible images: # image: ubuntu/22.04 # image: debian/stable # Static metadata for search and badges (unrelated to Git tags) tags: - linux - release - cmake - conan - yams environment: # Define consistent directories. BUILD_DIR: build/yams-release STAGE_DIR: stage packages: # Build dependencies. Arch Linux provides up-to-date toolchains. - base-devel # gcc, make, etc. - cmake - conan # Conan v2 from distro package to avoid PEP 668 issues - ninja - zip - lld - clang - llvm tasks: # Determine version from the Git ref and persist to ~/.buildenv for later tasks. - compute_version: | set -e # Move into repository directory (SourceHut clones into ./yams) cd yams # Prefer tag-triggered builds; fall back to latest tag or a default. if [[ "${GIT_REF:-}" =~ ^refs/tags/ ]]; then RAW_TAG="${GIT_REF#refs/tags/}" else RAW_TAG="$(git describe --tags --abbrev=0 2>/dev/null || echo 0.0.0-dev)" fi # Strip optional leading 'v' (e.g., v1.2.3 -> 1.2.3) CLEAN_VERSION="${RAW_TAG#v}" # Persist for subsequent tasks echo "YAMS_VERSION=${CLEAN_VERSION}" >> ~/.buildenv echo "Computed YAMS_VERSION=${CLEAN_VERSION} (GIT_REF=${GIT_REF:-n/a})" - setup: | # Move into repository directory (SourceHut clones into ./yams) cd yams # Configure the Conan profile. conan profile detect --force sed -i 's/^settings\.compiler\.cppstd=.*/settings.compiler.cppstd=20/' ~/.conan2/profiles/default || true echo "Conan profile configured:" # Conan v2 syntax: show takes --profile/-pr flag conan profile show -pr default || conan profile show - build: | cd yams export YAMS_DISABLE_MODEL_PRELOAD=1 CLEAN_VERSION="${YAMS_VERSION}" echo "Starting build for version ${CLEAN_VERSION}" # Fetch dependencies and generate CMake toolchain/deps. # GCC 15 on Arch triggers upstream onnxruntime 1.18 build errors; disable ONNX here. conan install . \ -of "${BUILD_DIR}" \ -pr:h=./conan/profiles/host.jinja \ -pr:b=default \ -s build_type=Release \ -o enable_onnx=False \ --build=missing # Configure with CMake (uses preset toolchain path under ${BUILD_DIR}). cmake --preset yams-release \ -DYAMS_BUILD_PROFILE=release \ -DYAMS_VERSION="${CLEAN_VERSION}" # Build the project. cmake --build --preset yams-release # Install the built artifacts into the staging directory. cmake --install "${BUILD_DIR}" --config Release - package: | # Only package on tag builds if [[ "${GIT_REF:-}" != refs/tags/* ]]; then echo "Skipping packaging (not a tag build): GIT_REF=${GIT_REF:-n/a}" exit 0 fi cd yams CLEAN_VERSION="${YAMS_VERSION}" echo "Packaging the release..." cd "${STAGE_DIR}" tar -czf "../yams-${CLEAN_VERSION}-linux-x86_64.tar.gz" . echo "Created asset: yams-${CLEAN_VERSION}-linux-x86_64.tar.gz" - package_cpack: | # Only package on tag builds if [[ "${GIT_REF:-}" != refs/tags/* ]]; then echo "Skipping CPack packaging (not a tag build): GIT_REF=${GIT_REF:-n/a}" exit 0 fi cd yams CLEAN_VERSION="${YAMS_VERSION}" echo "Packaging with CPack..." cd "${BUILD_DIR}" # Generate DEB package cpack -G DEB -D CPACK_PACKAGE_VERSION="${CLEAN_VERSION}" # Generate RPM package cpack -G RPM -D CPACK_PACKAGE_VERSION="${CLEAN_VERSION}" artifacts: # Files available for download after a successful build. - "yams/yams-*.tar.gz" - "yams/build/yams-release/*.deb" - "yams/build/yams-release/*.rpm"