|
3 | 3 | CI environment bootstrapping for hugrverse projects. |
4 | 4 |
|
5 | 5 | This repository builds and releases pre-compiled tooling environments used by |
6 | | -other repositories in the Quantinuum hugrverse. Each release contains a |
7 | | -compressed archive (`.tar.gz` or `.zip`) of pre-built tools for a specific |
8 | | -target platform. Downstream projects download these archives during their CI |
9 | | -bootstrap phase so that they never need to compile heavyweight dependencies |
10 | | -from scratch. |
| 6 | +other repositories in the Quantinuum hugrverse. The goal is to provide |
| 7 | +libraries that are as compatible as possible across the platforms that matter |
| 8 | +most to Rust/Python build pipelines. On Linux, libraries are built inside |
| 9 | +[manylinux 2.28](https://github.com/pypa/manylinux) containers, giving broad |
| 10 | +binary compatibility across a wide range of distributions. On macOS the |
| 11 | +deployment target is set to 11.0. |
| 12 | + |
| 13 | +Each release attaches a compressed archive (`hugrenv-<dep>-<platform>.tar.gz`) |
| 14 | +for every supported dependency/platform combination, plus a `hugrenv.lock` file |
| 15 | +that records the release version and the Nix-style SHA-256 hash of every |
| 16 | +archive. |
11 | 17 |
|
12 | 18 | ## What is built |
13 | 19 |
|
14 | 20 | | Component | Version | Description | |
15 | 21 | |-----------|---------|-------------| |
16 | 22 | | LLVM | 21.1.8 | Clang + LLD + LLVM core libraries | |
| 23 | +| tket | 2.16.0 | Quantinuum tket quantum compiler + C API | |
17 | 24 |
|
18 | 25 | ## Supported platforms |
19 | 26 |
|
20 | | -| Platform tag | Runner | Archive format | |
21 | | -|---------------------------|-------------------------------|----------------| |
22 | | -| `manylinux_2_28_x86_64` | Docker `quay.io/pypa/manylinux_2_28_x86_64` on `ubuntu-latest` | `.tar.gz` | |
23 | | -| `manylinux_2_28_aarch64` | Docker `quay.io/pypa/manylinux_2_28_aarch64` on `ubuntu-24.04-arm` | `.tar.gz` | |
24 | | -| `macosx_11_0_aarch64` | `macos-14` | `.tar.gz` | |
25 | | -| `macosx_11_0_x86_64` | `macos-15-intel` | `.tar.gz` | |
26 | | -| `win_amd64` | `windows-latest` + MSVC | `.zip` | |
| 27 | +| Platform tag | Runner | Notes | |
| 28 | +|---------------------------|-----------------------------------------------------------------|-------| |
| 29 | +| `manylinux_2_28_x86_64` | Docker `quay.io/pypa/manylinux_2_28_x86_64` on `ubuntu-latest` | manylinux 2.28 — broad Linux compatibility | |
| 30 | +| `manylinux_2_28_aarch64` | Docker `quay.io/pypa/manylinux_2_28_aarch64` on `ubuntu-24.04-arm` | manylinux 2.28 — broad Linux compatibility | |
| 31 | +| `macosx_11_0_aarch64` | `macos-14` | `MACOSX_DEPLOYMENT_TARGET=11.0` | |
| 32 | +| `macosx_11_0_x86_64` | `macos-15-intel` | `MACOSX_DEPLOYMENT_TARGET=11.0` | |
| 33 | +| `win_amd64` | `windows-latest` + MSVC | | |
| 34 | + |
| 35 | +## Using hugrverse-env in your repository |
| 36 | + |
| 37 | +### 1. Obtain a `hugrenv.lock` file |
| 38 | + |
| 39 | +Every [GitHub release](https://github.com/Quantinuum/hugrverse-env/releases) |
| 40 | +attaches a `hugrenv.lock` file alongside the compiled archives. Download the |
| 41 | +lock file for the version you want to pin and **commit it to your repository** |
| 42 | +(e.g. at the repository root as `hugrenv.lock`). The lock file records the |
| 43 | +release version and a content hash for every archive so downstream workflows |
| 44 | +can verify what they download. |
| 45 | + |
| 46 | +### 2. Install hugrenv packages in GitHub Actions |
| 47 | + |
| 48 | +Use the `.github/actions/install-hugrenv` composite action from this |
| 49 | +repository. It reads your committed `hugrenv.lock`, detects the current runner |
| 50 | +platform, downloads the requested packages from the matching release, extracts |
| 51 | +them, and sets the relevant environment variables (`LLVM_SYS_211_PREFIX`, |
| 52 | +`LIBCLANG_PATH`, `TKET_C_API_PATH`, `LD_LIBRARY_PATH` / `DYLD_LIBRARY_PATH`, |
| 53 | +`PATH`, etc.) for subsequent steps. |
| 54 | + |
| 55 | +```yaml |
| 56 | +- name: Install hugrenv |
| 57 | + uses: Quantinuum/hugrverse-env/.github/actions/install-hugrenv@main |
| 58 | + with: |
| 59 | + packages: llvm,tket # comma-separated; defaults to "llvm,tket" |
| 60 | + lockfile: hugrenv.lock # relative path to your lock file; default is "hugrenv.lock" |
| 61 | +``` |
| 62 | +
|
| 63 | +The action supports all five platforms listed above and works on Linux, macOS, |
| 64 | +and Windows runners without any additional setup. |
27 | 65 |
|
28 | 66 | ## Repository layout |
29 | 67 |
|
30 | 68 | ``` |
31 | | -builds/ |
32 | | - <platform>/ # One directory per target platform |
33 | | - build.sh # Parent script: builds all components, then bundles output |
34 | | - version.txt # Managed by release-please; records the current version |
35 | | - llvm/ |
36 | | - build.sh # Builds LLVM from source into /opt/llvm (or C:\hugrverse\llvm) |
| 69 | +deps/ |
| 70 | + llvm/ |
| 71 | + manylinux_2_28_x86_64.sh # Builds LLVM for each platform |
| 72 | + manylinux_2_28_aarch64.sh |
| 73 | + macosx_11_0_aarch64.sh |
| 74 | + macosx_11_0_x86_64.sh |
| 75 | + win_amd64.sh |
| 76 | + tket/ |
| 77 | + manylinux_2_28_x86_64.sh # Builds tket + C API for each platform |
| 78 | + manylinux_2_28_aarch64.sh |
| 79 | + macosx_11_0_aarch64.sh |
| 80 | + macosx_11_0_x86_64.sh |
| 81 | + win_amd64.sh |
37 | 82 | docker/ |
38 | 83 | manylinux_2_28_x86_64.Dockerfile # Local-testing image for x86_64 Linux |
39 | 84 | manylinux_2_28_aarch64.Dockerfile # Local-testing image for AArch64 Linux |
40 | 85 | .github/ |
| 86 | + actions/ |
| 87 | + install-hugrenv/ |
| 88 | + action.yml # Composite action: reads lock file, downloads & installs packages |
41 | 89 | workflows/ |
42 | | - build.yml # Builds each platform; uploads artifact on release |
43 | | - release-please.yml # Creates release PRs and tags via release-please |
44 | | -release-please-config.json # Monorepo release-please configuration |
45 | | -.release-please-manifest.json # Current version for each package |
| 90 | + build.yml # Builds changed targets on PRs; uploads artifacts |
| 91 | + merge.yml # Promotes merged-PR artifacts to main-* on merge to main |
| 92 | + release.yml # Bundles main-* artifacts, generates hugrenv.lock, publishes release |
46 | 93 | ``` |
47 | 94 |
|
48 | 95 | ## How CI works |
49 | 96 |
|
50 | | -1. **Build workflow** (`build.yml`) — triggered on every pull request, push to |
51 | | - `main`, published GitHub release, and manually via `workflow_dispatch`. |
| 97 | +1. **Build** (`build.yml`) — triggered on pull requests and manually via |
| 98 | + `workflow_dispatch`. |
| 99 | + * On a PR, only scripts that changed since the base commit are built. |
52 | 100 | * Linux targets are built inside the official `quay.io/pypa/manylinux_2_28_*` |
53 | | - Docker images to ensure binary compatibility with the manylinux ABI. |
54 | | - * macOS targets run natively on the appropriate GitHub-hosted runners. |
55 | | - * The Windows target runs with the MSVC toolchain on `windows-latest`. |
56 | | - * On a release event the resulting archives are also uploaded directly to |
57 | | - the GitHub release. |
58 | | - |
59 | | -2. **Release workflow** (`release-please.yml`) — triggered on every push to |
60 | | - `main`. |
61 | | - * Uses [release-please](https://github.com/googleapis/release-please) in |
62 | | - monorepo mode with five independent packages, one per platform. |
63 | | - * When commits affecting a platform directory are merged to `main`, |
64 | | - release-please opens a release PR for that platform. |
65 | | - * Merging the release PR creates a tag (e.g. |
66 | | - `hugrverse-env-manylinux_2_28_x86_64-v1.2.3`) and a GitHub release. |
67 | | - * The build workflow then triggers on the published release and attaches the |
68 | | - compiled archive. |
69 | | - |
70 | | -## Adding a new component |
71 | | - |
72 | | -1. Create a `builds/<platform>/<component>/build.sh` (or `.ps1` for Windows) |
73 | | - that downloads, compiles, and installs the component to `/opt/<component>` |
74 | | - (or `C:\hugrverse\<component>` on Windows). |
75 | | -2. Call the new script from `builds/<platform>/build.sh` and, if needed, add |
76 | | - the install directory to the `tar` / `Compress-Archive` invocation that |
77 | | - creates the bundle. |
78 | | -3. Repeat for every platform that should include the component. |
| 101 | + Docker images to ensure manylinux binary compatibility. |
| 102 | + * macOS targets run natively; `MACOSX_DEPLOYMENT_TARGET` is set to `11.0`. |
| 103 | + * The Windows target uses the MSVC toolchain via `ilammy/msvc-dev-cmd`. |
| 104 | + * Each built archive is uploaded as a PR artifact named |
| 105 | + `pr-<head-sha>-<dep>-<platform>`. |
| 106 | + |
| 107 | +2. **Merge** (`merge.yml`) — triggered when a PR is merged to `main`. |
| 108 | + * Finds the PR build artifacts by head SHA and re-uploads them as |
| 109 | + `main-<dep>-<platform>` artifacts (retained 90 days). |
| 110 | + |
| 111 | +3. **Release** (`release.yml`) — triggered manually via `workflow_dispatch`. |
| 112 | + * Downloads all `main-*` promoted artifacts. |
| 113 | + * Generates a `hugrenv.lock` containing the version and Nix-style SHA-256 |
| 114 | + hashes for every archive. |
| 115 | + * Creates a GitHub release tagged `v<version>` and attaches all archives |
| 116 | + plus the lock file. |
| 117 | + |
| 118 | +## Adding a new dependency |
| 119 | + |
| 120 | +1. Create `deps/<dependency>/` and add a `<platform>.sh` script for each |
| 121 | + supported platform. Each script accepts an output tarball path as its first |
| 122 | + argument and produces a `hugrenv-<dependency>-<platform>.tar.gz`. |
| 123 | +2. Repeat for every platform that should include the dependency. |
| 124 | +3. Update this README to document the new component. |
79 | 125 |
|
80 | 126 | ## Local development |
81 | 127 |
|
82 | | -See [DEVELOPMENT.md](DEVELOPMENT.md) for instructions on testing changes |
83 | | -locally using Docker. |
| 128 | +See [DEVELOPMENT.md](DEVELOPMENT.md) for instructions on testing build-script |
| 129 | +changes locally using Docker (Linux) or running scripts natively (macOS/Windows). |
0 commit comments