yams/.build.yml
2025-09-04 15:51:26 -04:00

90 lines
3.3 KiB
YAML

# .build.yml
#
# This is a SourceHut build manifest generated from your .github/workflows/release.yml.
# It focuses on the core build and packaging steps for a single Linux target.
#
# Differences from the GitHub Actions workflow:
# - No matrix builds: This manifest builds for a single Linux environment.
# - No cross-platform support: macOS and Windows builds are not included.
# - Self-contained: Does not download artifacts from other CI/workflow runs.
# - Simplified release process: Creates a distributable tarball, but does not
# create a GitHub Release or generate detailed release notes with benchmark data.
image: archlinux
# You can also use other images like:
# image: ubuntu/22.04
# image: debian/stable
environment:
# Define a consistent build directory, similar to the GHA workflow.
BUILD_DIR: build/yams-release
STAGE_DIR: stage
# Use git.tag() to dynamically set the version from the Git tag.
# If the build is not triggered by a tag, it defaults to "0.0.0-dev".
YAMS_VERSION: git.tag(default="0.6.0")
packages:
# Install build dependencies. Arch Linux has up-to-date packages.
- base-devel # Includes gcc, make, etc.
- cmake
- conan # Use distro-packaged Conan (v2) instead of pip to avoid PEP 668 issues
- ninja # Optional but recommended for CMake presets using Ninja
- zip
- lld
- clang
- llvm
tasks:
- 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
# The YAMS_VERSION from git.tag() might include a 'v' prefix (e.g., "v1.2.3").
CLEAN_VERSION="${YAMS_VERSION#v}"
echo "Starting build for version $CLEAN_VERSION"
# Run conan install to fetch dependencies and generate CMake toolchain/deps.
conan install . --output-folder=${BUILD_DIR} -s build_type=Release --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: |
cd yams
CLEAN_VERSION="${YAMS_VERSION#v}"
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: |
cd yams
CLEAN_VERSION="${YAMS_VERSION#v}"
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:
# These are the files that will be available for download after the build.
- "yams/yams-*.tar.gz"
- "yams/build/yams-release/*.deb"
- "yams/build/yams-release/*.rpm"