pyppmd/ci/azure-pipelines/CodeBerg-pyppmd-CI.yml
Hiroshi Miura 28a3c97ccc Update CI configuration for new Python version and dependencies
Removed Python 3.8 from the CI matrix and added Python 3.13 support. Upgraded cibuildwheel dependency from version 2.16.2 to 2.23.1 to ensure compatibility and improvements in wheel building.
2025-03-23 12:07:16 +09:00

285 lines
7.8 KiB
YAML

# Variable 'python.version' was defined in the Variables tab
# Multi-job configuration must be converted to matrix strategy: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#multi-job-configuration
variables:
- name: BuildParameters.versionSpec
value: $(python.version)
trigger:
branches:
include:
- releases/*
- main
resources:
repositories:
- repository: self
type: git
ref: refs/heads/main
jobs:
- job: Check
displayName: Check
pool:
vmImage: ubuntu-latest
strategy:
matrix:
"python 3.9":
- python.version: 3.9
"python 3.10":
- python.version: 3.10
"python 3.11":
- python-version: 3.11
"python 3.12":
- python-version: 3.12
"python 3.13":
- python-version: 3.13
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
displayName: Use Python $(python.version)
inputs:
versionSpec: $(BuildParameters.versionSpec)
disableDownloadFromRegistry: true
- task: Bash@3
displayName: Install dependencies
inputs:
targetType: inline
script: >-
python -m pip install --upgrade pip setuptools setuptools_scm[toml] coverage[toml] tox importlib_metadata build
- task: Bash@3
displayName: run tox
inputs:
targetType: inline
script: >-
python -m tox
condition: eq(variables['python.version'], '3.9')
- job: BuildSdist
displayName: Sdist
dependsOn: Check
pool:
vmImage: ubuntu-latest
steps:
- task: Bash@3
displayName: build sdist
inputs:
targetType: inline
script: >-
python -m build --sdist
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: dist
ArtifactName: wheelhouse
condition: eq(variables['python.version'], '3.9')
- job: CheckPyPy
displayName: Test on pypy3.9
pool:
vmImage: ubuntu-latest
steps:
- bash: |
PYPY=`find /opt/hostedtoolcache/PyPy/ -name '3.9.*' -type d`/x64/bin/pypy3
echo Use $PYPY
$PYPY -m venv venv
source venv/bin/activate
python -m pip install -U pip setuptools setuptools_scm[toml]
python -m pip install .[test]
python -m pytest -vv -s
displayName: 'Run pytest on pypy3.9'
- job: Linux
displayName: linux
dependsOn:
- Check
- CheckPyPy
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
displayName: Use Python 3.x
inputs:
disableDownloadFromRegistry: true
- task: Bash@3
displayName: Install dependencies
inputs:
targetType: inline
script: >
set -o errexit
python3 -m pip install --upgrade pip
pip3 install cibuildwheel==2.16.2
- task: Bash@3
displayName: Build wheels
inputs:
targetType: inline
script: cibuildwheel --output-dir wheelhouse .
env:
CIBW_PRERELEASE_PYTHONS: True
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: wheelhouse
ArtifactName: wheelhouse
- job: MacOS
displayName: macos
dependsOn: Check
pool:
vmImage: macos-latest
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
displayName: Use Python 3.x
inputs:
disableDownloadFromRegistry: true
- task: Bash@3
displayName: Install dependencies
inputs:
targetType: inline
script: >
set -o errexit
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==2.16.2
- task: Bash@3
displayName: Build wheels
inputs:
targetType: inline
script: >
cibuildwheel --output-dir wheelhouse .
env:
CIBW_PRERELEASE_PYTHONS: True
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: wheelhouse
ArtifactName: wheelhouse
- job: Windows
displayName: windows
dependsOn: Check
pool:
vmImage: windows-latest
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
displayName: Use Python 3.x
inputs:
disableDownloadFromRegistry: true
- task: Bash@3
displayName: Install dependecies
inputs:
targetType: inline
script: >
set -o errexit
python -m pip install --upgrade pip
pip install cibuildwheel==2.23.1
- task: Bash@3
displayName: Build wheels
inputs:
targetType: inline
script: cibuildwheel --output-dir wheelhouse .
env:
CIBW_PRERELEASE_PYTHONS: True
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: wheelhouse
ArtifactName: wheelhouse
- job: LinuxAarch64
displayName: linux(aarch64)
dependsOn: Check
pool:
name: Azure Pipelines
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
displayName: Use Python 3.x
- task: DockerInstaller@0
displayName: Install Docker 20.10.17
inputs:
dockerVersion: 20.10.17
- task: Bash@3
displayName: Install dependecies and qemu
inputs:
targetType: inline
script: >
set -o errexit
python -m pip install --upgrade pip
docker pull tonistiigi/binfmt:latest
docker run --rm --privileged tonistiigi/binfmt:latest --install arm64
pip install cibuildwheel==2.23.1
- task: Bash@3
displayName: Build wheels
inputs:
targetType: inline
script: cibuildwheel --output-dir wheelhouse .
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_ARCHS: aarch64
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: wheelhouse
ArtifactName: wheelhouse
- job: Publish
displayName: Publish to PyPI
dependsOn:
- Linux
- MacOS
- Windwos
- LinuxAarch64
- BuildSdist
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
clean: true
- task: UsePythonVersion@0
displayName: Use Python 3.x
- task: DownloadBuildArtifacts@1
displayName: Download Build Artifacts
inputs:
artifactName: wheelhouse
itemPattern: >
**
downloadPath: wheelhouse
- task: Bash@3
displayName: Install Dependencies
inputs:
targetType: inline
script: >
python -m pip install twine
- task: TwineAuthenticate@1
displayName: Twine Authenticate (testpypi)
condition: and(not(startsWith(variables['build.sourceBranch'], 'refs/tags/v')), startsWith(variables['build.sourceBranch'], 'refs/heads/releases/'))
inputs:
pythonUploadServiceConnection: 38ba9668-be53-494d-b8b5-ce3dc32fd309
- task: Bash@3
displayName: Upload to Python Package Index(test)
condition: and(succeeded(), not(startsWith(variables['build.sourceBranch'], 'refs/tags/v')), startsWith(variables['build.sourceBranch'], 'refs/heads/releases/'))
inputs:
targetType: inline
script: >+
python -m twine upload --repository testpypi --config-file $(PYPIRC_PATH) wheelhouse/wheelhouse/*
- task: TwineAuthenticate@1
displayName: Twine Authenticate (pypi)
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/v')
inputs:
pythonUploadServiceConnection: 7bcc3d9c-d109-445a-b785-5890d404db02
- task: Bash@3
displayName: Upload to Python Package Index
condition: and(succeeded(), startsWith(variables['build.sourceBranch'], 'refs/tags/v'))
inputs:
targetType: inline
script: >+
python -m twine upload --repository pypi --config-file $(PYPIRC_PATH) wheelhouse/wheelhouse/*