Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
31 changes: 23 additions & 8 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
14 changes: 13 additions & 1 deletion packaging/debian/build-helpers/Dockerfile.deb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
6 changes: 6 additions & 0 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
flagtree (0.6.0-1) unstable; urgency=medium

* Sync package version with the flagtree wheel (0.6.0).

-- FlagOS Contributors <contact@flagos.io> Wed, 15 Jul 2026 08:00:00 +0000

flagtree (0.5.0-1) unstable; urgency=medium

* Initial Debian packaging.
Expand Down
12 changes: 11 additions & 1 deletion packaging/rpm/helpers/Dockerfile.rpm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
14 changes: 13 additions & 1 deletion packaging/rpm/specs/flagtree.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}

Expand Down Expand Up @@ -134,6 +142,10 @@ install -D -m 0644 %{SOURCE0} %{buildroot}%{_licensedir}/%{name}/LICENSE
%{_bindir}/proton*

%changelog
* Wed Jul 15 2026 FlagOS Contributors <contact@flagos.io> - 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 <contact@flagos.io> - 0.5.0-1
- Initial RPM packaging.
- Package the %{flagtree_backend} backend variant.
Loading