Skip to content

Build and Publish Wheels #12

Build and Publish Wheels

Build and Publish Wheels #12

Workflow file for this run

name: Build and Publish Wheels
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
publish-to-pypi:
description: 'Publish to PyPI (true/false)'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
permissions:
contents: read
jobs:
linux:
name: Build Linux wheels
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: 2014
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13 3.14
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist
retention-days: 7
macos:
name: Build macOS wheels
runs-on: macos-latest
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13 3.14
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: dist
retention-days: 7
windows:
name: Build Windows wheels
runs-on: windows-latest
strategy:
matrix:
target: [x64]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13 3.14
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: dist
retention-days: 7
sdist:
name: Build source distribution
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-sdist
path: dist
retention-days: 7
test-wheels:
name: Test wheels (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: [linux, macos, windows]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Install wheel
shell: bash
run: |
pip install --find-links dist ofd-validator
- name: Test import and basic functionality
shell: bash
run: |
python -c "
import ofd_validator
print('Available:', [x for x in dir(ofd_validator) if not x.startswith('_')])
# Test types
r = ofd_validator.ValidationResult()
assert r.is_valid == True
assert r.error_count == 0
print('Types work correctly')
# Test functions exist
assert callable(ofd_validator.validate_all)
assert callable(ofd_validator.validate_json_files)
assert callable(ofd_validator.validate_logo_files)
assert callable(ofd_validator.validate_folder_names)
assert callable(ofd_validator.validate_store_ids)
assert callable(ofd_validator.validate_gtin_ean)
assert callable(ofd_validator.validate_required_files)
print('All functions available')
print('All tests passed')
"
publish:
name: Publish to PyPI
needs: [test-wheels, sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-to-pypi == 'true')
permissions:
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: List distributions
run: ls -lh dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
verbose: true