|
| 1 | +# .github/workflows/cross-platform-build-verification.yml |
| 2 | +name: Cross-Platform Build Verification |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [main, development] |
| 7 | + pull_request: |
| 8 | + branches: [main] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-matrix: |
| 13 | + name: Build on ${{ matrix.os }} (${{ matrix.arch }}) |
| 14 | + runs-on: ${{ matrix.runner }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + # Linux x86_64 |
| 20 | + - os: ubuntu-latest |
| 21 | + runner: ubuntu-latest |
| 22 | + arch: x86_64 |
| 23 | + distro: ubuntu |
| 24 | + - os: ubuntu-20.04 |
| 25 | + runner: ubuntu-20.04 |
| 26 | + arch: x86_64 |
| 27 | + distro: ubuntu-lts |
| 28 | + |
| 29 | + # Linux ARM64 |
| 30 | + - os: ubuntu-latest-arm |
| 31 | + runner: ubuntu-24.04-arm64 |
| 32 | + arch: aarch64 |
| 33 | + distro: ubuntu |
| 34 | + |
| 35 | + # macOS Intel |
| 36 | + - os: macos-13 |
| 37 | + runner: macos-13 |
| 38 | + arch: x86_64 |
| 39 | + distro: macos |
| 40 | + |
| 41 | + # macOS Apple Silicon |
| 42 | + - os: macos-latest |
| 43 | + runner: macos-latest |
| 44 | + arch: arm64 |
| 45 | + distro: macos |
| 46 | + |
| 47 | + # Windows x86_64 |
| 48 | + - os: windows-latest |
| 49 | + runner: windows-latest |
| 50 | + arch: x86_64 |
| 51 | + distro: windows |
| 52 | + |
| 53 | + # Windows ARM64 (if GitHub adds support) |
| 54 | + # - os: windows-arm |
| 55 | + # runner: windows-arm64 |
| 56 | + # arch: arm64 |
| 57 | + # distro: windows |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: Set up Python 3.11 |
| 64 | + uses: actions/setup-python@v5 |
| 65 | + with: |
| 66 | + python-version: '3.11' |
| 67 | + |
| 68 | + - name: Install build dependencies |
| 69 | + run: | |
| 70 | + python -m pip install --upgrade pip |
| 71 | + pip install build wheel setuptools |
| 72 | + |
| 73 | + - name: Build package |
| 74 | + run: | |
| 75 | + python -m build |
| 76 | + |
| 77 | + - name: Install package |
| 78 | + shell: bash |
| 79 | + run: | |
| 80 | + pip install dist/*.whl |
| 81 | + |
| 82 | + - name: Test basic functionality |
| 83 | + shell: bash |
| 84 | + run: | |
| 85 | + omnipkg --version |
| 86 | + 8pkg --version |
| 87 | + omnipkg list |
| 88 | + |
| 89 | + - name: Test daemon (Unix-like) |
| 90 | + if: runner.os != 'Windows' |
| 91 | + run: | |
| 92 | + omnipkg daemon start |
| 93 | + sleep 2 |
| 94 | + omnipkg daemon status |
| 95 | + omnipkg daemon monitor |
| 96 | + omnipkg daemon stop |
| 97 | + |
| 98 | + - name: Test daemon (Windows) |
| 99 | + if: runner.os == 'Windows' |
| 100 | + shell: bash |
| 101 | + run: | |
| 102 | + omnipkg daemon start --no-fork |
| 103 | + sleep 2 |
| 104 | + omnipkg daemon status |
| 105 | + omnipkg daemon monitor |
| 106 | + omnipkg daemon stop |
| 107 | + |
| 108 | + - name: Upload build artifacts |
| 109 | + uses: actions/upload-artifact@v4 |
| 110 | + with: |
| 111 | + name: omnipkg-${{ matrix.os }}-${{ matrix.arch }} |
| 112 | + path: dist/ |
| 113 | + |
| 114 | + # Additional distro tests using Docker |
| 115 | + linux-distros: |
| 116 | + name: ${{ matrix.distro }} |
| 117 | + runs-on: ubuntu-latest |
| 118 | + strategy: |
| 119 | + fail-fast: false |
| 120 | + matrix: |
| 121 | + distro: |
| 122 | + - debian:12 |
| 123 | + - debian:11 |
| 124 | + - ubuntu:24.04 |
| 125 | + - ubuntu:22.04 |
| 126 | + - ubuntu:20.04 |
| 127 | + - fedora:39 |
| 128 | + - fedora:38 |
| 129 | + - rockylinux:9 |
| 130 | + - rockylinux:8 |
| 131 | + - almalinux:9 |
| 132 | + - archlinux:latest |
| 133 | + - alpine:latest |
| 134 | + |
| 135 | + steps: |
| 136 | + - name: Checkout |
| 137 | + uses: actions/checkout@v4 |
| 138 | + |
| 139 | + - name: Test in ${{ matrix.distro }} |
| 140 | + uses: addnab/docker-run-action@v3 |
| 141 | + with: |
| 142 | + image: ${{ matrix.distro }} |
| 143 | + options: -v ${{ github.workspace }}:/workspace |
| 144 | + run: | |
| 145 | + cd /workspace |
| 146 | + |
| 147 | + # Install Python based on distro |
| 148 | + if command -v apt-get &> /dev/null; then |
| 149 | + apt-get update && apt-get install -y python3 python3-pip python3-venv |
| 150 | + elif command -v dnf &> /dev/null; then |
| 151 | + dnf install -y python3 python3-pip |
| 152 | + elif command -v pacman &> /dev/null; then |
| 153 | + pacman -Sy --noconfirm python python-pip |
| 154 | + elif command -v apk &> /dev/null; then |
| 155 | + apk add --no-cache python3 py3-pip |
| 156 | + fi |
| 157 | + |
| 158 | + # Build and install |
| 159 | + python3 -m pip install --upgrade pip build |
| 160 | + python3 -m build |
| 161 | + python3 -m pip install dist/*.whl |
| 162 | + |
| 163 | + # Test |
| 164 | + omnipkg --version |
| 165 | + omnipkg list |
| 166 | +
|
| 167 | + # FreeBSD (experimental) |
| 168 | + freebsd: |
| 169 | + name: FreeBSD 14.0 |
| 170 | + runs-on: ubuntu-latest |
| 171 | + steps: |
| 172 | + - name: Checkout |
| 173 | + uses: actions/checkout@v4 |
| 174 | + |
| 175 | + - name: Test on FreeBSD |
| 176 | + uses: vmactions/freebsd-vm@v1 |
| 177 | + with: |
| 178 | + release: 14.0 |
| 179 | + usesh: true |
| 180 | + prepare: | |
| 181 | + pkg install -y python311 py39-pip |
| 182 | + run: | |
| 183 | + python3.11 -m pip install --upgrade pip build |
| 184 | + python3.11 -m build |
| 185 | + python3.11 -m pip install dist/*.whl |
| 186 | + omnipkg --version |
| 187 | + omnipkg list |
| 188 | +
|
| 189 | + # Generate badge data |
| 190 | + generate-badge: |
| 191 | + name: Generate Platform Support Badge |
| 192 | + needs: [build-matrix, linux-distros, freebsd] |
| 193 | + runs-on: ubuntu-latest |
| 194 | + if: always() |
| 195 | + steps: |
| 196 | + - name: Checkout |
| 197 | + uses: actions/checkout@v4 |
| 198 | + with: |
| 199 | + ref: ${{ github.ref }} |
| 200 | + |
| 201 | + - name: Generate badge JSON |
| 202 | + run: | |
| 203 | + cat > platform-support.json << 'EOF' |
| 204 | + { |
| 205 | + "schemaVersion": 1, |
| 206 | + "label": "platforms", |
| 207 | + "message": "Linux | macOS | Windows | FreeBSD", |
| 208 | + "color": "brightgreen" |
| 209 | + } |
| 210 | + EOF |
| 211 | + |
| 212 | + cat > arch-support.json << 'EOF' |
| 213 | + { |
| 214 | + "schemaVersion": 1, |
| 215 | + "label": "architectures", |
| 216 | + "message": "x86_64 | ARM64 | aarch64", |
| 217 | + "color": "blue" |
| 218 | + } |
| 219 | + EOF |
| 220 | + |
| 221 | + - name: Commit badge data |
| 222 | + if: github.ref == 'refs/heads/main' |
| 223 | + run: | |
| 224 | + git config user.name "github-actions[bot]" |
| 225 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 226 | + git add platform-support.json arch-support.json |
| 227 | + git diff --staged --quiet || git commit -m "Update platform support badges [skip ci]" |
| 228 | + git push |
0 commit comments