diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml index 6744a4ae6..c589dcd92 100644 --- a/.github/workflows/build-deb.yml +++ b/.github/workflows/build-deb.yml @@ -1,25 +1,28 @@ name: Build Debian Packages +# PRs trigger this only for packaging-file changes; source changes do +# not (the full wheel build is too heavy for a general PR gate). +# Release tags are unprefixed since 0.3.0, e.g. 0.6.0 / 0.6.0rc1. on: push: tags: - - 'v*' + - '[0-9]*' + - 'v[0-9]*' pull_request: branches: [main] paths: - 'packaging/debian/**' - - 'python/**' - - 'include/**' - - 'lib/**' - - 'cmake/**' - - 'bin/**' - - 'CMakeLists.txt' - - 'pyproject.toml' - '.github/workflows/build-deb.yml' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build-deb: + # Skip backend-variant tags like 0.6.0+mthreads3.6. + if: ${{ github.event_name != 'push' || !contains(github.ref_name, '+') }} # WARNING: this builds the full FlagTree LLVM/MLIR wheel from source # (~36 min on a 4-core builder) and peaks well above 4 GB RAM. The # public `ubuntu-latest` runner (4 vCPU / ~16 GB RAM) is on the edge @@ -28,6 +31,18 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 90 steps: + # The wheel build peaks near the runner's free-disk limit. + # Ephemeral GitHub-hosted VMs only — never a self-hosted machine. + - name: Free runner disk space + run: | + if [ "${RUNNER_ENVIRONMENT}" != "github-hosted" ]; then + echo "Not a GitHub-hosted runner; skipping disk cleanup." + exit 0 + fi + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h / + - name: Checkout repository uses: actions/checkout@v4 with: diff --git a/.github/workflows/build-rpm.yml b/.github/workflows/build-rpm.yml index 3c75f10a6..39a672d98 100644 --- a/.github/workflows/build-rpm.yml +++ b/.github/workflows/build-rpm.yml @@ -1,25 +1,28 @@ name: Build RPM Packages +# PRs trigger this only for packaging-file changes; source changes do +# not (the full wheel build is too heavy for a general PR gate). +# Release tags are unprefixed since 0.3.0, e.g. 0.6.0 / 0.6.0rc1. on: push: tags: - - 'v*' + - '[0-9]*' + - 'v[0-9]*' pull_request: branches: [main] paths: - 'packaging/rpm/**' - - 'python/**' - - 'include/**' - - 'lib/**' - - 'cmake/**' - - 'bin/**' - - 'CMakeLists.txt' - - 'pyproject.toml' - '.github/workflows/build-rpm.yml' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build-rpm: + # Skip backend-variant tags like 0.6.0+mthreads3.6. + if: ${{ github.event_name != 'push' || !contains(github.ref_name, '+') }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -34,6 +37,18 @@ jobs: base_image: openeuler/openeuler:24.03-lts artifact: flagtree-nvidia-oe2403-rpm-packages steps: + # The wheel build peaks near the runner's free-disk limit. + # Ephemeral GitHub-hosted VMs only — never a self-hosted machine. + - name: Free runner disk space + run: | + if [ "${RUNNER_ENVIRONMENT}" != "github-hosted" ]; then + echo "Not a GitHub-hosted runner; skipping disk cleanup." + exit 0 + fi + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h / + - name: Checkout repository uses: actions/checkout@v4 with: diff --git a/packaging/debian/build-helpers/Dockerfile.deb b/packaging/debian/build-helpers/Dockerfile.deb index 20f8d470d..28f595f09 100644 --- a/packaging/debian/build-helpers/Dockerfile.deb +++ b/packaging/debian/build-helpers/Dockerfile.deb @@ -72,11 +72,15 @@ COPY CMakeLists.txt pyproject.toml setup.py MANIFEST.in LICENSE README.md /src/ # FLAGTREE_DEFAULT_BACKENDS=nvidia,amd matches the historical package # contents and keeps the tileir backend (GCC >= 13 + cuda-tile # submodule) out of the distro build. +# The trailing rm keeps only /wheels in this layer: the CMake build +# tree and the LLVM tarball cache (~/.triton) would otherwise add +# several GB and push CI runners into ENOSPC. RUN unset FLAGTREE_BACKEND && \ FLAGTREE_DEFAULT_BACKENDS=nvidia,amd \ MAX_JOBS=4 python -m pip wheel . --no-build-isolation --no-deps -w /wheels -v && \ ls -lh /wheels/ && \ - test -n "$(ls /wheels/flagtree-*.whl 2>/dev/null)" + test -n "$(ls /wheels/flagtree-*.whl 2>/dev/null)" && \ + rm -rf /src/build /root/.triton # ---------- Stage 2: assemble the .deb ---------- FROM ${DEB_BASE_IMAGE} AS deb-assembler @@ -106,6 +110,14 @@ RUN dpkg-buildpackage -us -uc -b && \ # in the build log without failing the build. RUN lintian --info --display-info /python3-flagtree-*.deb || true +# Smoke test: install the freshly built deb and import the package. +# Catches the "installs fine, fails at import" class (missing libs, +# bad rpath, glibc mismatch) that dpkg-buildpackage alone cannot see. +RUN apt-get update && \ + apt-get install -y --no-install-recommends /python3-flagtree-*.deb && \ + python3 -c "import triton; print(getattr(triton, '__version__', 'import ok'))" && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + # ---------- Stage 3: just the .deb output ---------- FROM scratch AS deb-output COPY --from=deb-assembler /python3-flagtree-*.deb /output/ diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 8694dca01..b038b02a6 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,9 @@ +flagtree (0.6.0-1) unstable; urgency=medium + + * Sync package version with the flagtree wheel (0.6.0). + + -- FlagOS Contributors Wed, 15 Jul 2026 08:00:00 +0000 + flagtree (0.5.0-1) unstable; urgency=medium * Initial Debian packaging. diff --git a/packaging/rpm/helpers/Dockerfile.rpm b/packaging/rpm/helpers/Dockerfile.rpm index dbaea8087..49d8e05b9 100644 --- a/packaging/rpm/helpers/Dockerfile.rpm +++ b/packaging/rpm/helpers/Dockerfile.rpm @@ -44,11 +44,15 @@ COPY CMakeLists.txt pyproject.toml setup.py MANIFEST.in LICENSE README.md /src/ # FLAGTREE_DEFAULT_BACKENDS=nvidia,amd matches the historical package # contents and keeps the tileir backend (GCC >= 13 + cuda-tile # submodule) out of the distro build. +# The trailing rm keeps only /wheels in this layer: the CMake build +# tree and the LLVM tarball cache (~/.triton) would otherwise add +# several GB and push CI runners into ENOSPC. RUN unset FLAGTREE_BACKEND && \ FLAGTREE_DEFAULT_BACKENDS=nvidia,amd \ MAX_JOBS=4 python3 -m pip wheel . --no-build-isolation --no-deps -w /wheels -v && \ ls -lh /wheels/ && \ - test -n "$(ls /wheels/flagtree-*.whl 2>/dev/null)" + test -n "$(ls /wheels/flagtree-*.whl 2>/dev/null)" && \ + rm -rf /src/build /root/.triton # ---------- Stage 2: assemble the .rpm ---------- FROM ${RPM_BASE_IMAGE} AS rpm-assembler @@ -82,6 +86,12 @@ RUN rpmbuild -ba /root/rpmbuild/SPECS/flagtree.spec \ --define "wheel_dir /wheels" && \ ls -lh /root/rpmbuild/RPMS/x86_64/ +# Smoke test: install the freshly built rpm and import the package. +# Catches the "installs fine, fails at import" class (missing libs, +# bad rpath, glibc mismatch) that rpmbuild alone cannot see. +RUN dnf install -y /root/rpmbuild/RPMS/x86_64/python3-flagtree-*.x86_64.rpm && \ + python3 -c "import triton; print(getattr(triton, '__version__', 'import ok'))" + # ---------- Stage 3: extract just the rpms ---------- FROM scratch AS rpm-output COPY --from=rpm-assembler /root/rpmbuild/RPMS/x86_64/python3-flagtree-*.rpm /output/ diff --git a/packaging/rpm/specs/flagtree.spec b/packaging/rpm/specs/flagtree.spec index 0c93bdf40..599b1c006 100644 --- a/packaging/rpm/specs/flagtree.spec +++ b/packaging/rpm/specs/flagtree.spec @@ -29,7 +29,7 @@ %define __requires_exclude libcuda\\.so|libnvidia.* Name: python3-flagtree-%{flagtree_backend} -Version: 0.5.0 +Version: 0.6.0 Release: 1%{?dist} Summary: FlagTree compiler with %{flagtree_backend} backend License: MIT AND Apache-2.0 WITH LLVM-exception AND BSD-3-Clause AND LicenseRef-NVIDIA-CUDA-EULA @@ -102,6 +102,14 @@ if [ -z "$WHEEL" ]; then exit 1 fi +# Guard against Version drifting from the wheel again (0.5.0 rpms used +# to ship a 0.6.0 wheel). +WHEEL_VER=$(basename "$WHEEL" | cut -d- -f2) +if [ "$WHEEL_VER" != "%{version}" ]; then + echo "ERROR: wheel version $WHEEL_VER != spec Version %{version}" >&2 + exit 1 +fi + PYDIR=%{buildroot}%{python3_sitearch} mkdir -p "$PYDIR" %{buildroot}%{_bindir} @@ -134,6 +142,10 @@ install -D -m 0644 %{SOURCE0} %{buildroot}%{_licensedir}/%{name}/LICENSE %{_bindir}/proton* %changelog +* Wed Jul 15 2026 FlagOS Contributors - 0.6.0-1 +- Sync package version with the flagtree wheel (0.6.0). +- Fail the install step when the wheel version does not match the spec. + * Mon Apr 27 2026 FlagOS Contributors - 0.5.0-1 - Initial RPM packaging. - Package the %{flagtree_backend} backend variant.