diff --git a/.github/workflows/build-legacy-wheels.yml b/.github/workflows/build-legacy-wheels.yml new file mode 100644 index 0000000..89957c0 --- /dev/null +++ b/.github/workflows/build-legacy-wheels.yml @@ -0,0 +1,83 @@ +name: Build Legacy Wheels (macos-13) + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build_legacy_wheels: + name: macos-13 + runs-on: macos-13 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Download model weights from release v0.1.1 + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euxo pipefail + mkdir -p src/pyfacewipe/models + gh release download v0.1.1 \ + -R "${GITHUB_REPOSITORY}" \ + -p "synthstrip.1.pt" \ + -p "synthstrip.nocsf.1.pt" \ + -D src/pyfacewipe/models + ls -lah src/pyfacewipe/models + + - name: Build wheels + uses: pypa/cibuildwheel@v2.22.0 + env: + CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" + CIBW_SKIP: "pp* *-musllinux_* *-win32" + CIBW_ARCHS_MACOS: "x86_64 arm64" + CIBW_BUILD_VERBOSITY: "1" + + - name: Verify wheels contain model weights + shell: bash + run: | + set -euxo pipefail + python - <<'PY' + import glob + import sys + import zipfile + + whls = glob.glob("wheelhouse/*.whl") + if not whls: + print("No wheels found in wheelhouse/*.whl", file=sys.stderr) + sys.exit(1) + + required = { + "pyfacewipe/models/synthstrip.1.pt", + "pyfacewipe/models/synthstrip.nocsf.1.pt", + } + + missing_any = False + for whl in whls: + with zipfile.ZipFile(whl) as z: + names = set(z.namelist()) + missing = sorted(required - names) + if missing: + missing_any = True + print(f"ERROR: {whl} is missing: {missing}", file=sys.stderr) + else: + print(f"OK: {whl} contains model weights") + + sys.exit(1 if missing_any else 0) + PY + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-${{ runner.os }}-legacy-macos-13 + path: wheelhouse/*.whl diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4d77653..e115776 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -11,7 +11,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + # macos-13 is handled in build-legacy-wheels.yml because its + # GitHub-hosted runners are intermittently unavailable. + os: [ubuntu-latest, windows-latest, macos-14] steps: - name: Checkout