Skip to content

Commit 40c0125

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

1 file changed

Lines changed: 111 additions & 66 deletions

File tree

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

Lines changed: 111 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
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+
"
129
# .github/workflows/cross-platform-build-verification.yml
230
name: Cross-Platform Build Verification
331
432
on:
533
push:
634
tags:
7-
- 'v*' # Runs on version tags (blocks PyPI publish)
35+
- 'v*'
836
release:
937
types: [published]
1038
workflow_dispatch:
@@ -31,16 +59,14 @@ jobs:
3159
- runner: windows-latest
3260
label: "Windows x86_64"
3361

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

3866
steps:
3967
- name: Checkout
4068
uses: actions/checkout@v4
4169

42-
# Only run setup-python on GitHub-hosted runners (Ubuntu/Windows)
43-
# We skip this on self-hosted to use the system/Homebrew python
4470
- name: Set up Python 3.11
4571
if: ${{ !contains(matrix.runner, 'self-hosted') }}
4672
uses: actions/setup-python@v5
@@ -60,29 +86,24 @@ jobs:
6086
- name: Build and Test
6187
shell: bash
6288
env:
63-
PYTHONUNBUFFERED: "1" # Force Python to show logs immediately
89+
PYTHONUNBUFFERED: "1"
6490
run: |
65-
set -x # Debug mode: Print every command as it runs
91+
set -x
6692
67-
# Use 'python' if 'python3' isn't available
6893
if command -v python3 &>/dev/null; then PY=python3; else PY=python; fi
6994
70-
# Create venv
7195
$PY -m venv .venv
7296
73-
# Activate venv (Handle Windows 'Scripts' vs Linux/Mac 'bin')
7497
if [ -f ".venv/bin/activate" ]; then
7598
source .venv/bin/activate
7699
else
77100
source .venv/Scripts/activate
78101
fi
79102
80-
# Install and build
81103
python -m pip install --upgrade pip build
82104
python -m build
83105
pip install dist/*.whl
84106
85-
# verify
86107
omnipkg --version
87108
8pkg --version
88109
omnipkg list
@@ -92,43 +113,93 @@ jobs:
92113
run: |
93114
echo "✅ VERIFIED: ${{ steps.arch.outputs.os }} ${{ steps.arch.outputs.arch }}"
94115
95-
# Rootless Podman on self-hosted (safe for iptables/Tailscale)
96-
linux-distros-podman:
97-
name: Podman - ${{ matrix.distro }}
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 }})
98121
runs-on: [self-hosted, linux, x64]
99122
strategy:
100123
fail-fast: false
101124
matrix:
102125
include:
103-
# x86_64 tests
126+
# ✅ FAST: Native x86_64 tests (proves Podman works)
104127
- distro: debian:12
105128
platform: linux/amd64
106129
- distro: ubuntu:24.04
107130
platform: linux/amd64
108131
- distro: fedora:39
109132
platform: linux/amd64
110133

111-
# ARM64 tests (via QEMU)
112-
- distro: debian:12
134+
# ✅ FAST ARM64: Just the quick ones (proves architecture-agnostic)
135+
- distro: debian:12 # 6m 43s - Acceptable
113136
platform: linux/arm64
114-
#- distro: ubuntu:24.04
115-
#platform: linux/arm64
116-
- distro: ubuntu:22.04
137+
- distro: rockylinux:9 # 3m 45s - Fast enough
117138
platform: linux/arm64
118-
#- distro: fedora:39
119-
#platform: linux/arm64
120-
- distro: rockylinux:9
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
121187
platform: linux/arm64
122-
- distro: alpine:latest
188+
- distro: alpine:latest # 8m 28s
123189
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
124196
125197
steps:
126198
- name: Checkout
127199
uses: actions/checkout@v4
128200
129201
- name: Test in ${{ matrix.distro }} (Podman)
130202
run: |
131-
# Detect if Alpine and use /bin/sh, otherwise /bin/bash
132203
if [[ "${{ matrix.distro }}" == *"alpine"* ]]; then
133204
SHELL="/bin/sh"
134205
else
@@ -138,7 +209,7 @@ jobs:
138209
podman run --rm -v $(pwd):/workspace:Z --platform ${{ matrix.platform }} ${{ matrix.distro }} $SHELL -c "
139210
cd /workspace
140211

141-
# --- 1. Install System Dependencies ---
212+
# Install system deps
142213
if command -v apt-get > /dev/null 2>&1; then
143214
apt-get update && apt-get install -y python3 python3-pip python3-venv
144215
elif command -v dnf > /dev/null 2>&1; then
@@ -147,20 +218,18 @@ jobs:
147218
apk add --no-cache python3 py3-pip py3-build gcc python3-dev musl-dev linux-headers
148219
fi
149220

150-
# --- 2. Install Build Tools ---
221+
# Build and install
151222
python3 -m pip install --upgrade pip build || python3 -m pip install --break-system-packages build
152-
153-
# --- 3. Build Project ---
154223
python3 -m build
155-
156-
# --- 4. Install Wheel ---
157224
python3 -m pip install dist/*.whl || python3 -m pip install --break-system-packages dist/*.whl
158225

159-
# --- 5. Verify ---
226+
# Verify
160227
omnipkg --version
161228
"
162229
163-
# Docker on GitHub-hosted (plenty of space/memory, split for safety)
230+
# ═══════════════════════════════════════════════════════════════════
231+
# UNCHANGED: Docker jobs run on FREE GitHub runners (fast x86_64)
232+
# ═══════════════════════════════════════════════════════════════════
164233
linux-distros-docker-debian:
165234
name: Docker - Debian/Ubuntu
166235
runs-on: ubuntu-latest
@@ -183,20 +252,9 @@ jobs:
183252
docker run --rm -v $(pwd):/workspace ${{ matrix.distro }} /bin/bash -c "
184253
cd /workspace
185254
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)
192255
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)
195256
python3 -m build
196-
197-
# Install wheels using the flag (latest pip supports it now)
198257
python3 -m pip install --break-system-packages dist/*.whl
199-
200258
omnipkg --version
201259
"
202260
@@ -222,28 +280,18 @@ jobs:
222280
docker run --rm -v $(pwd):/workspace ${{ matrix.distro }} /bin/bash -c "
223281
cd /workspace
224282

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-
229283
if grep -q 'release 8' /etc/redhat-release; then
230-
echo 'Detected EL8 (Rocky/Alma/RHEL 8) - Installing Python 3.9...'
284+
echo 'Detected EL8 - Installing Python 3.9...'
231285
dnf install -y python39 python39-pip
232-
233-
# Force 'python3' command to point to 3.9
234286
ln -sf /usr/bin/python3.9 /usr/bin/python3
235287
ln -sf /usr/bin/pip3.9 /usr/bin/pip3
236288
else
237-
# Fedora and RHEL 9+ have modern Python by default
238289
dnf install -y python3 python3-pip
239290
fi
240291

241-
# --- Build & Install ---
242292
python3 -m pip install --upgrade pip build
243293
python3 -m build
244294
python3 -m pip install dist/*.whl
245-
246-
# --- Verify ---
247295
omnipkg --version
248296
"
249297
@@ -271,39 +319,36 @@ jobs:
271319
python -m build
272320
python -m pip install --break-system-packages dist/*.whl
273321
elif command -v apk &> /dev/null; then
274-
# Install build dependencies required for compiling psutil
275322
apk add --no-cache python3 py3-pip py3-build gcc python3-dev musl-dev linux-headers
276-
277323
python3 -m build
278324
python3 -m pip install --break-system-packages dist/*.whl
279325
fi
280326
omnipkg --version
281327
"
328+
282329
update-readme-stats:
283330
name: "📝 Update README Platform Stats"
284-
needs: [build-matrix, linux-distros-podman, linux-distros-docker-debian, linux-distros-docker-rhel, linux-distros-docker-other]
331+
needs: [build-matrix, linux-distros-podman-critical, linux-distros-docker-debian, linux-distros-docker-rhel, linux-distros-docker-other]
285332
runs-on: ubuntu-latest
286-
if: success() # Only run if all tests passed
333+
if: success()
287334

288335
steps:
289336
- name: Checkout
290337
uses: actions/checkout@v4
291338
with:
292-
fetch-depth: 0 # Need full history for commit
339+
fetch-depth: 0
293340

294341
- name: Update Platform Stats in README
295342
run: |
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
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)
299347
TOTAL=$((NATIVE_PLATFORMS + DOCKER_PLATFORMS))
300348
301-
# Update the "Platforms Verified" badge
302349
sed -i "s/platforms-[0-9]*%20verified/platforms-${TOTAL}%20verified/" README.md
303350
304-
# Add macOS ARM64 to the platform table if not already there
305351
if ! grep -q "macOS ARM64" README.md; then
306-
# Find the macOS Intel line and add ARM64 after it
307352
sed -i '/macOS Intel.*x86_64.*Intel/a | macOS ARM64 | ARM64 (Apple Silicon) | ✅ | Native installation |' README.md
308353
fi
309354

0 commit comments

Comments
 (0)