Skip to content

Commit 9f2ba21

Browse files
authored
Update cross-platform-build-verification.yml
Signed-off-by: 1minds3t <1minds3t@proton.me>
1 parent 40c0125 commit 9f2ba21

1 file changed

Lines changed: 66 additions & 111 deletions

File tree

.github/workflows/cross-platform-build-verification.yml

Lines changed: 66 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
1-
steps:
2-
- name: Checkout
3-
uses: actions/checkout@v4
4-
5-
- name: Test in ${{ matrix.distro }} (Podman) [OPTIONAL - Non-blocking]
6-
run: |
7-
if [[ "${{ matrix.distro }}" == *"alpine"* ]]; then
8-
SHELL="/bin/sh"
9-
else
10-
SHELL="/bin/bash"
11-
fi
12-
13-
podman run --rm -v $(pwd):/workspace:Z --platform ${{ matrix.platform }} ${{ matrix.distro }} $SHELL -c "
14-
cd /workspace
15-
16-
if command -v apt-get > /dev/null 2>&1; then
17-
apt-get update && apt-get install -y python3 python3-pip python3-venv
18-
elif command -v dnf > /dev/null 2>&1; then
19-
dnf install -y python3 python3-pip
20-
elif command -v apk > /dev/null 2>&1; then
21-
apk add --no-cache python3 py3-pip py3-build gcc python3-dev musl-dev linux-headers
22-
fi
23-
24-
python3 -m pip install --upgrade pip build || python3 -m pip install --break-system-packages build
25-
python3 -m build
26-
python3 -m pip install dist/*.whl || python3 -m pip install --break-system-packages dist/*.whl
27-
omnipkg --version
28-
"
291
# .github/workflows/cross-platform-build-verification.yml
302
name: Cross-Platform Build Verification
313

324
on:
335
push:
346
tags:
35-
- 'v*'
7+
- 'v*' # Runs on version tags (blocks PyPI publish)
368
release:
379
types: [published]
3810
workflow_dispatch:
@@ -59,14 +31,16 @@ jobs:
5931
- runner: windows-latest
6032
label: "Windows x86_64"
6133

62-
# ADD THIS for Apple Silicon native testing
34+
# ADD THIS BLOCK FOR APPLE SILICON
6335
- runner: macos-14
6436
label: "macOS ARM64 (Apple Silicon)"
6537

6638
steps:
6739
- name: Checkout
6840
uses: actions/checkout@v4
6941

42+
# Only run setup-python on GitHub-hosted runners (Ubuntu/Windows)
43+
# We skip this on self-hosted to use the system/Homebrew python
7044
- name: Set up Python 3.11
7145
if: ${{ !contains(matrix.runner, 'self-hosted') }}
7246
uses: actions/setup-python@v5
@@ -86,24 +60,29 @@ jobs:
8660
- name: Build and Test
8761
shell: bash
8862
env:
89-
PYTHONUNBUFFERED: "1"
63+
PYTHONUNBUFFERED: "1" # Force Python to show logs immediately
9064
run: |
91-
set -x
65+
set -x # Debug mode: Print every command as it runs
9266
67+
# Use 'python' if 'python3' isn't available
9368
if command -v python3 &>/dev/null; then PY=python3; else PY=python; fi
9469
70+
# Create venv
9571
$PY -m venv .venv
9672
73+
# Activate venv (Handle Windows 'Scripts' vs Linux/Mac 'bin')
9774
if [ -f ".venv/bin/activate" ]; then
9875
source .venv/bin/activate
9976
else
10077
source .venv/Scripts/activate
10178
fi
10279
80+
# Install and build
10381
python -m pip install --upgrade pip build
10482
python -m build
10583
pip install dist/*.whl
10684
85+
# verify
10786
omnipkg --version
10887
8pkg --version
10988
omnipkg list
@@ -113,93 +92,43 @@ jobs:
11392
run: |
11493
echo "✅ VERIFIED: ${{ steps.arch.outputs.os }} ${{ steps.arch.outputs.arch }}"
11594
116-
# ═══════════════════════════════════════════════════════════════════
117-
# CRITICAL TESTS: Fast tests that MUST pass before PyPI publish
118-
# ═══════════════════════════════════════════════════════════════════
119-
linux-distros-podman-critical:
120-
name: Podman - ${{ matrix.distro }} (${{ matrix.platform }})
95+
# Rootless Podman on self-hosted (safe for iptables/Tailscale)
96+
linux-distros-podman:
97+
name: Podman - ${{ matrix.distro }}
12198
runs-on: [self-hosted, linux, x64]
12299
strategy:
123100
fail-fast: false
124101
matrix:
125102
include:
126-
# ✅ FAST: Native x86_64 tests (proves Podman works)
103+
# x86_64 tests
127104
- distro: debian:12
128105
platform: linux/amd64
129106
- distro: ubuntu:24.04
130107
platform: linux/amd64
131108
- distro: fedora:39
132109
platform: linux/amd64
133110

134-
# ✅ FAST ARM64: Just the quick ones (proves architecture-agnostic)
135-
- distro: debian:12 # 6m 43s - Acceptable
111+
# ARM64 tests (via QEMU)
112+
- distro: debian:12
136113
platform: linux/arm64
137-
- distro: rockylinux:9 # 3m 45s - Fast enough
114+
#- distro: ubuntu:24.04
115+
#platform: linux/arm64
116+
- distro: ubuntu:22.04
138117
platform: linux/arm64
139-
140-
steps:
141-
- name: Checkout
142-
uses: actions/checkout@v4
143-
144-
- name: Test in ${{ matrix.distro }} (Podman)
145-
run: |
146-
if [[ "${{ matrix.distro }}" == *"alpine"* ]]; then
147-
SHELL="/bin/sh"
148-
else
149-
SHELL="/bin/bash"
150-
fi
151-
152-
podman run --rm -v $(pwd):/workspace:Z --platform ${{ matrix.platform }} ${{ matrix.distro }} $SHELL -c "
153-
cd /workspace
154-
155-
# Install system deps
156-
if command -v apt-get > /dev/null 2>&1; then
157-
apt-get update && apt-get install -y python3 python3-pip python3-venv
158-
elif command -v dnf > /dev/null 2>&1; then
159-
dnf install -y python3 python3-pip
160-
elif command -v apk > /dev/null 2>&1; then
161-
apk add --no-cache python3 py3-pip py3-build gcc python3-dev musl-dev linux-headers
162-
fi
163-
164-
# Build and install
165-
python3 -m pip install --upgrade pip build || python3 -m pip install --break-system-packages build
166-
python3 -m build
167-
python3 -m pip install dist/*.whl || python3 -m pip install --break-system-packages dist/*.whl
168-
169-
# Verify
170-
omnipkg --version
171-
"
172-
173-
# ═══════════════════════════════════════════════════════════════════
174-
# OPTIONAL TESTS: Slow ARM64 tests that DON'T block PyPI publish
175-
# These run in parallel but PyPI doesn't wait for them
176-
# ═══════════════════════════════════════════════════════════════════
177-
linux-distros-podman-optional:
178-
name: Podman - ${{ matrix.distro }} (${{ matrix.platform }}) [OPTIONAL]
179-
runs-on: [self-hosted, linux, x64]
180-
continue-on-error: true # Don't fail the workflow if these fail
181-
strategy:
182-
fail-fast: false
183-
matrix:
184-
include:
185-
# ⏰ SLOW ARM64: Nice to have, but not blockers
186-
- distro: ubuntu:22.04 # 7m 28s
118+
#- distro: fedora:39
119+
#platform: linux/arm64
120+
- distro: rockylinux:9
187121
platform: linux/arm64
188-
- distro: alpine:latest # 8m 28s
122+
- distro: alpine:latest
189123
platform: linux/arm64
190-
191-
# These can be re-enabled if you optimize wheel building:
192-
# - distro: ubuntu:24.04
193-
# platform: linux/arm64
194-
# - distro: fedora:39
195-
# platform: linux/arm64
196124

197125
steps:
198126
- name: Checkout
199127
uses: actions/checkout@v4
200128

201129
- name: Test in ${{ matrix.distro }} (Podman)
202130
run: |
131+
# Detect if Alpine and use /bin/sh, otherwise /bin/bash
203132
if [[ "${{ matrix.distro }}" == *"alpine"* ]]; then
204133
SHELL="/bin/sh"
205134
else
@@ -209,7 +138,7 @@ jobs:
209138
podman run --rm -v $(pwd):/workspace:Z --platform ${{ matrix.platform }} ${{ matrix.distro }} $SHELL -c "
210139
cd /workspace
211140
212-
# Install system deps
141+
# --- 1. Install System Dependencies ---
213142
if command -v apt-get > /dev/null 2>&1; then
214143
apt-get update && apt-get install -y python3 python3-pip python3-venv
215144
elif command -v dnf > /dev/null 2>&1; then
@@ -218,18 +147,20 @@ jobs:
218147
apk add --no-cache python3 py3-pip py3-build gcc python3-dev musl-dev linux-headers
219148
fi
220149
221-
# Build and install
150+
# --- 2. Install Build Tools ---
222151
python3 -m pip install --upgrade pip build || python3 -m pip install --break-system-packages build
152+
153+
# --- 3. Build Project ---
223154
python3 -m build
155+
156+
# --- 4. Install Wheel ---
224157
python3 -m pip install dist/*.whl || python3 -m pip install --break-system-packages dist/*.whl
225158

226-
# Verify
159+
# --- 5. Verify ---
227160
omnipkg --version
228161
"
229162
230-
# ═══════════════════════════════════════════════════════════════════
231-
# UNCHANGED: Docker jobs run on FREE GitHub runners (fast x86_64)
232-
# ═══════════════════════════════════════════════════════════════════
163+
# Docker on GitHub-hosted (plenty of space/memory, split for safety)
233164
linux-distros-docker-debian:
234165
name: Docker - Debian/Ubuntu
235166
runs-on: ubuntu-latest
@@ -252,9 +183,20 @@ jobs:
252183
docker run --rm -v $(pwd):/workspace ${{ matrix.distro }} /bin/bash -c "
253184
cd /workspace
254185
apt-get update && apt-get install -y python3 python3-pip python3-venv
186+
187+
# Try upgrading pip normally first (for older distros like Ubuntu 20.04),
188+
# then fall back to --break-system-packages (for newer distros like Ubuntu 24.04)
189+
# 1. Try standard upgrade (works on Ubuntu 20.04, upgrades pip to latest)
190+
# 2. If fails (Ubuntu 24.04+), install 'build' using the flag, but DO NOT upgrade pip
191+
# (Upgrading system pip on 24.04 causes "RECORD file not found" errors)
255192
python3 -m pip install --upgrade pip build || python3 -m pip install --break-system-packages build
193+
194+
# Run build (now that pip/build are installed/upgraded)
256195
python3 -m build
196+
197+
# Install wheels using the flag (latest pip supports it now)
257198
python3 -m pip install --break-system-packages dist/*.whl
199+
258200
omnipkg --version
259201
"
260202
@@ -280,18 +222,28 @@ jobs:
280222
docker run --rm -v $(pwd):/workspace ${{ matrix.distro }} /bin/bash -c "
281223
cd /workspace
282224

225+
# --- RHEL/Rocky 8 Fix ---
226+
# Default 'python3' on EL8 is 3.6 (Too old for pyproject.toml).
227+
# We must detect EL8 and explicitly install python3.11 or python3.9.
228+
283229
if grep -q 'release 8' /etc/redhat-release; then
284-
echo 'Detected EL8 - Installing Python 3.9...'
230+
echo 'Detected EL8 (Rocky/Alma/RHEL 8) - Installing Python 3.9...'
285231
dnf install -y python39 python39-pip
232+
233+
# Force 'python3' command to point to 3.9
286234
ln -sf /usr/bin/python3.9 /usr/bin/python3
287235
ln -sf /usr/bin/pip3.9 /usr/bin/pip3
288236
else
237+
# Fedora and RHEL 9+ have modern Python by default
289238
dnf install -y python3 python3-pip
290239
fi
291240

241+
# --- Build & Install ---
292242
python3 -m pip install --upgrade pip build
293243
python3 -m build
294244
python3 -m pip install dist/*.whl
245+
246+
# --- Verify ---
295247
omnipkg --version
296248
"
297249
@@ -319,36 +271,39 @@ jobs:
319271
python -m build
320272
python -m pip install --break-system-packages dist/*.whl
321273
elif command -v apk &> /dev/null; then
274+
# Install build dependencies required for compiling psutil
322275
apk add --no-cache python3 py3-pip py3-build gcc python3-dev musl-dev linux-headers
276+
323277
python3 -m build
324278
python3 -m pip install --break-system-packages dist/*.whl
325279
fi
326280
omnipkg --version
327281
"
328-
329282
update-readme-stats:
330283
name: "📝 Update README Platform Stats"
331-
needs: [build-matrix, linux-distros-podman-critical, linux-distros-docker-debian, linux-distros-docker-rhel, linux-distros-docker-other]
284+
needs: [build-matrix, linux-distros-podman, linux-distros-docker-debian, linux-distros-docker-rhel, linux-distros-docker-other]
332285
runs-on: ubuntu-latest
333-
if: success()
286+
if: success() # Only run if all tests passed
334287

335288
steps:
336289
- name: Checkout
337290
uses: actions/checkout@v4
338291
with:
339-
fetch-depth: 0
292+
fetch-depth: 0 # Need full history for commit
340293

341294
- name: Update Platform Stats in README
342295
run: |
343-
# Now counting: 5 native + 14 Docker/Podman = 19 total
344-
# (We removed 5 slow ARM64 tests, but they were redundant anyway)
345-
NATIVE_PLATFORMS=5 # x64 Linux, x64 macOS, ARM64 macOS, x64 Windows, ARM64 Python native
346-
DOCKER_PLATFORMS=14 # All Docker/Podman distros (including 2 ARM64 Podman tests)
296+
# Count platforms (update these numbers based on your matrix)
297+
NATIVE_PLATFORMS=4 # Linux x64, macOS x64, macOS ARM64, Windows x64
298+
DOCKER_PLATFORMS=14 # All your Docker/Podman distros
347299
TOTAL=$((NATIVE_PLATFORMS + DOCKER_PLATFORMS))
348300
301+
# Update the "Platforms Verified" badge
349302
sed -i "s/platforms-[0-9]*%20verified/platforms-${TOTAL}%20verified/" README.md
350303
304+
# Add macOS ARM64 to the platform table if not already there
351305
if ! grep -q "macOS ARM64" README.md; then
306+
# Find the macOS Intel line and add ARM64 after it
352307
sed -i '/macOS Intel.*x86_64.*Intel/a | macOS ARM64 | ARM64 (Apple Silicon) | ✅ | Native installation |' README.md
353308
fi
354309

0 commit comments

Comments
 (0)