1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# ═══════════════════════════════════════════════════════════════════════════════
# MASTER: Unified Python Wheel Build + Publish (ix / sniper / llmosafe)
# ═══════════════════════════════════════════════════════════════════════════════
# This is the CANONICAL workflow. All three projects use identical copies.
# Only the PROJECT env var below differs. Do NOT diverge from this template.
#
# Canonical source: /workspace/.github/workflows/wheels.yml
# Local build: /workspace/.github/scripts/build-wheels.sh
# Reference: /workspace/PUBLISHING.md
#
# To adopt for a new project:
# 1. Copy this file to .github/workflows/wheels.yml
# 2. Change PROJECT below
# 3. Set up Trusted Publishing on pypi.org for the repo
# 4. Add a "pypi" environment in repo Settings > Environments
# ═══════════════════════════════════════════════════════════════════════════════
name: Wheels
on:
push:
tags:
workflow_dispatch:
# ── Project identity (ONLY line that differs between projects) ──────────────
env:
PROJECT: ix # ← CHANGE THIS: ix | sniper | llmosafe
PYTHON_VERSION: "3.12"
# ── Concurrency: cancel in-progress on re-push ──────────────────────────────
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# ═══════════════════════════════════════════════════════════════════════════
# Linux wheels — all projects
# ═══════════════════════════════════════════════════════════════════════════
build-linux:
name: linux (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64
manylinux: auto
pre-build: |
yum install -y openssl-devel || true
- os: ubuntu-24.04-arm
target: aarch64
manylinux: auto
pre-build: |
yum install -y gcc gcc-c++ make || true
ln -sf /usr/bin/gcc /usr/bin/aarch64-linux-gnu-gcc || true
steps:
- uses: actions/checkout@v4
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
working-directory: ${{ env.PROJECT }}-py
args: --release --out dist -i python${{ env.PYTHON_VERSION }}
manylinux: ${{ matrix.manylinux }}
before-script-linux: ${{ matrix.pre-build }}
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: ${{ env.PROJECT }}-py/dist/
# ═══════════════════════════════════════════════════════════════════════════
# Windows wheels — ix only (skipped for sniper/llmosafe)
# ═══════════════════════════════════════════════════════════════════════════
build-windows:
name: windows (${{ matrix.target }})
# NOTE: Always runs for ix. For sniper/llmosafe, either remove this
# entire job or gate with github.repository check.
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
steps:
- uses: actions/checkout@v4
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
working-directory: ${{ env.PROJECT }}-py
args: --release --out dist -i python${{ env.PYTHON_VERSION }}
manylinux: auto
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: ${{ env.PROJECT }}-py/dist/
# ═══════════════════════════════════════════════════════════════════════════
# Publish to PyPI — on tag push only (not manual dispatch by default)
# ═══════════════════════════════════════════════════════════════════════════
publish-pypi:
name: Publish → PyPI
needs:
# Gate on OUR upstream build jobs only (not a run-wide !failure()), so an
# unrelated job failing does NOT skip the real PyPI publish on a tag push.
if: |
!cancelled() &&
needs.build-linux.result == 'success' &&
needs.build-windows.result == 'success' &&
startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/${{ env.PROJECT == 'ix' && 'moeix' || env.PROJECT == 'sniper' && 'moesniper' || 'llmosafe' }}
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
skip-existing: true
attestations: false
print-hash: true