diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index 9b7b35c8..a456ee2d 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -73,6 +73,9 @@ jobs: rm -f /io/dist/*-linux_*.whl " + # Install twine to verify wheels + pip install twine + # Verify the wheel was built echo "Contents of dist directory:" ls -la dist/ @@ -81,6 +84,10 @@ jobs: echo "Wheel filenames:" find dist -name "*.whl" -exec basename {} \; + # Verify wheel structure + echo "Verifying wheels using twine check" + twine check dist/* + - name: Build Windows wheel (x64) if: runner.os == 'Windows' shell: pwsh @@ -95,6 +102,7 @@ jobs: pip install -r requirements.txt pip install -r requirements-dev.txt pip install wheel + pip install twine # Download native artifacts Write-Host "Starting artifact download process..." @@ -110,8 +118,11 @@ jobs: # Build wheel python setup.py bdist_wheel --plat-name win_amd64 - - name: Build macOS wheel (Apple Silicon) - if: runner.os == 'macOS' && runner.arch == 'arm64' + # Verify wheel structure + twine check dist/* + + - name: Build macOS wheel (Universal) + if: runner.os == 'macOS' run: | # Create necessary directories mkdir -p artifacts @@ -122,20 +133,25 @@ jobs: pip install -r requirements.txt pip install -r requirements-dev.txt pip install wheel + pip install twine # Download native artifacts python scripts/download_artifacts.py $C2PA_VERSION # Build wheel - python setup.py bdist_wheel --plat-name macosx_11_0_arm64 + python setup.py bdist_wheel --plat-name macosx_10_9_universal2 # Rename wheel to ensure unique filename cd dist for wheel in *.whl; do - mv "$wheel" "${wheel/macosx_11_0_arm64/macosx_11_0_arm64}" + mv "$wheel" "${wheel/macosx_10_9_universal2/macosx_10_9_universal2}" done cd .. + # Verify wheel structure + echo "Verifying wheels using twine check" + twine check dist/* + - name: Log wheel filename if: runner.os == 'Linux' || runner.os == 'macOS' shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6978367a..cbdb3a1c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -326,19 +326,23 @@ jobs: .\venv\Scripts\pytest .\tests\test_unit_tests.py -v build-macos-wheel: - name: Build macOS wheel + name: Build macOS wheel (Universal) uses: ./.github/workflows/build-wheel.yml needs: [tests-unix, read-version] with: python-version: "3.10" - artifact-name: wheels-macos-${{ matrix.target }} runs-on: macos-latest + artifact-name: wheels-macos-${{ matrix.target }} + architecture: ${{ matrix.target }} c2pa-version: ${{ needs.read-version.outputs.c2pa-native-version }} secrets: github-token: ${{ secrets.GITHUB_TOKEN }} strategy: matrix: - target: [aarch64] + include: + - target: universal2 + runs-on: macos-latest + if: | github.event_name != 'pull_request' || github.event.pull_request.author_association == 'COLLABORATOR' || @@ -347,12 +351,17 @@ jobs: contains(github.event.pull_request.labels.*.name, 'safe to test') test-built-macos-wheel: - name: Test macOS built wheel + name: Test macOS built wheel (Universal) needs: build-macos-wheel - runs-on: macos-latest + runs-on: ${{ matrix.runs-on }} strategy: matrix: - target: [aarch64] + include: + - target: universal2 + runs-on: macos-latest + - target: universal2 + runs-on: macos-13 + if: | github.event_name != 'pull_request' || github.event.pull_request.author_association == 'COLLABORATOR' || diff --git a/.github/workflows/upload-test.yml b/.github/workflows/upload-test.yml deleted file mode 100644 index 8bacc094..00000000 --- a/.github/workflows/upload-test.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Upload Test for Pypi. - -on: - workflow_dispatch: - -jobs: - linux: - runs-on: ubuntu-latest - - strategy: - matrix: - target: [aarch64] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - cache: "pip" - - run: pip install -r requirements.txt - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - if: ${{ matrix.target == 'aarch64' }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - maturin-version: "1.2.0" - args: --release --out dist --find-interpreter - sccache: "true" - manylinux: ${{ matrix.target == 'aarch64' && 'manylinux_2_28' || 'auto' }} - before-script-linux: | - pip install uniffi-bindgen==0.24.1 - - # ISSUE: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145 - # If we're running on rhel centos, install needed packages. - if command -v yum &> /dev/null; then - yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic - - # If we're running on i686 we need to symlink libatomic - # in order to build openssl with -latomic flag. - if [[ ! -d "/usr/lib64" ]]; then - ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so - fi - else - # If we're running on debian-based system. - apt update -y && apt-get install -y libssl-dev openssl pkg-config - fi - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: wheels-${{ matrix.target }} - path: dist - - sdist: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - command: sdist - args: --out dist - - name: Upload sdist - uses: actions/upload-artifact@v4 - with: - name: wheels - path: dist - - pypi-publish: - name: upload release to PyPI - runs-on: ubuntu-latest - needs: [linux, sdist] - - # Specifying a GitHub environment is optional, but strongly encouraged - environment: testpublish - permissions: - # IMPORTANT: this permission is mandatory for Trusted Publishing - id-token: write - steps: - # retrieve your distributions here - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Download aarch64 wheels artifact - uses: actions/download-artifact@v4 - with: - name: wheels-aarch64 - - - name: Download sdist artifact - uses: actions/download-artifact@v4 - with: - name: sdist - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 85e5560c..f178c63f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "c2pa-python" -version = "0.14.0" +version = "0.15.0" requires-python = ">=3.10" description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library" readme = { file = "README.md", content-type = "text/markdown" }