Skip to content

ci: Merge in latest main #1

ci: Merge in latest main

ci: Merge in latest main #1

Workflow file for this run

name: Build Wheel
on:
workflow_call:
inputs:
python-version:
required: true
type: string
architecture:
required: false
type: string
artifact-name:
required: true
type: string
runs-on:
required: true
type: string
default: 'ubuntu-latest'
c2pa-version:
required: true
type: string
secrets:
github-token:
required: true
permissions:
contents: read
packages: read
actions: read
env:
GITHUB_TOKEN: ${{ secrets.github-token }}
C2PA_VERSION: ${{ inputs.c2pa-version }}
jobs:
build:
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Build Linux wheels
if: runner.os == 'Linux'
run: |
# Create necessary directories
mkdir -p artifacts
mkdir -p src/c2pa/libs
rm -rf dist build
# Set Docker image and platform tag based on architecture
if [ "${{ inputs.architecture }}" = "aarch64" ]; then
DOCKER_IMAGE="quay.io/pypa/manylinux_2_28_aarch64"
PLATFORM_TAG="manylinux_2_28_aarch64"
else
DOCKER_IMAGE="quay.io/pypa/manylinux_2_28_x86_64"
PLATFORM_TAG="manylinux_2_28_x86_64"
fi
# Build wheel in Docker container
docker run --rm -v $PWD:/io $DOCKER_IMAGE bash -c "
yum install -y gcc gcc-c++ make &&
mkdir -p /io/artifacts /io/src/c2pa/libs &&
rm -rf /io/dist /io/build &&
cd /io &&
/opt/python/cp310-cp310/bin/pip install -r requirements.txt -r requirements-dev.txt &&
/opt/python/cp310-cp310/bin/pip install toml &&
C2PA_LIBS_PLATFORM=\"${{ format('{0}', inputs.architecture == 'aarch64' && 'aarch64-unknown-linux-gnu' || 'x86_64-unknown-linux-gnu') }}\" /opt/python/cp310-cp310/bin/python scripts/download_artifacts.py $C2PA_VERSION &&
for PYBIN in /opt/python/cp3{10,11}-*/bin; do
\${PYBIN}/pip install --upgrade pip wheel &&
\${PYBIN}/pip install toml==0.10.2 &&
\${PYBIN}/pip install setuptools==68.0.0 &&
CFLAGS=\"-I/opt/python/cp310-cp310/include/python3.10\" LDFLAGS=\"-L/opt/python/cp310-cp310/lib\" \${PYBIN}/python setup.py bdist_wheel --plat-name $PLATFORM_TAG
done &&
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/
echo "Number of wheels found:"
find dist -name "*.whl" | wc -l
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
run: |
# Create necessary directories
New-Item -ItemType Directory -Force -Path artifacts
New-Item -ItemType Directory -Force -Path src/c2pa/libs
if (Test-Path dist) { Remove-Item -Recurse -Force dist }
if (Test-Path build) { Remove-Item -Recurse -Force build }
# Install dependencies
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..."
Write-Host "C2PA_VERSION: $env:C2PA_VERSION"
python scripts/download_artifacts.py "$env:C2PA_VERSION"
Write-Host "Artifacts directory contents:"
Get-ChildItem -Recurse -Path artifacts
Write-Host "src/c2pa/libs directory contents:"
Get-ChildItem -Recurse -Path src/c2pa/libs
# Build wheel
python setup.py bdist_wheel --plat-name win_amd64
# Verify wheel structure
twine check dist/*
<<<<<<< HEAD

Check failure on line 124 in .github/workflows/build-wheel.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-wheel.yml

Invalid workflow file

You have an error in your yaml syntax on line 124
- name: Build macOS wheel
=======
- name: Build macOS wheel (Universal)
>>>>>>> main
if: runner.os == 'macOS'
run: |
# Create necessary directories
mkdir -p artifacts
mkdir -p src/c2pa/libs
rm -rf dist build
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install wheel
pip install twine
# Download native artifacts for the target architecture
if [ "${{ inputs.architecture }}" = "universal2" ]; then
python scripts/download_artifacts.py $C2PA_VERSION universal2
elif [ "${{ inputs.architecture }}" = "arm64" ]; then
python scripts/download_artifacts.py $C2PA_VERSION arm64
elif [ "${{ inputs.architecture }}" = "x86_64" ]; then
python scripts/download_artifacts.py $C2PA_VERSION x86_64
else
echo "Unknown architecture: ${{ inputs.architecture }}"
exit 1
fi
<<<<<<< HEAD
# Determine platform name based on target architecture
if [ "${{ inputs.architecture }}" = "universal2" ]; then
PLATFORM_NAME="macosx_10_9_universal2"
elif [ "${{ inputs.architecture }}" = "arm64" ]; then
PLATFORM_NAME="macosx_11_0_arm64"
elif [ "${{ inputs.architecture }}" = "x86_64" ]; then
PLATFORM_NAME="macosx_10_9_x86_64"
else
echo "Unknown architecture: ${{ inputs.architecture }}"
exit 1
fi
echo "Building wheel for architecture: ${{ inputs.architecture }}"
echo "Using platform name: $PLATFORM_NAME"
# Build wheel with appropriate platform name
python setup.py bdist_wheel --plat-name $PLATFORM_NAME
=======
# Build wheel
python setup.py bdist_wheel --plat-name macosx_10_9_universal2
>>>>>>> main
# Rename wheel to ensure unique filename
cd dist
for wheel in *.whl; do
<<<<<<< HEAD
mv "$wheel" "${wheel/$PLATFORM_NAME/$PLATFORM_NAME}"
=======
mv "$wheel" "${wheel/macosx_10_9_universal2/macosx_10_9_universal2}"
>>>>>>> main
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
run: |
echo "Built wheel:"
ls -l dist/*.whl
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: dist
if-no-files-found: error