Skip to content

ci: check dist uploads with twine #192

ci: check dist uploads with twine

ci: check dist uploads with twine #192

name: build flux-python
on:
pull_request: {}
workflow_dispatch:
inputs:
version:
description: 'Pypi version'
release_version:
description: 'Version of flux to build'
default: "0.88.0"
rc:
description: 'Release candidate to build (for wheel)'
default: "0"
branch:
description: 'Branch to build from'
default: "master"
repo:
description: 'Repository to build from'
default: "https://github.com/flux-framework/flux-core"
glibc:
description: 'Oldest glibc to support, as a manylinux tag version'
default: "2_17"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Maybe time to stop supporting...
- python: "3.8"
base: jammy
- python: "3.9"
base: jammy
- python: "3.10"
base: jammy
- python: "3.11"
base: jammy
- python: "3.12"
base: jammy
- python: "3.13"
base: jammy
# Update to noble for 3.14
- python: "3.14"
base: noble
container:
image: fluxrm/testenv:${{ matrix.base }}
steps:
- uses: actions/checkout@v7
- name: Setup Python
env:
python_version: ${{ matrix.python }}
# Installs to /opt/conda/envs/build/bin/python3
run: /bin/bash ./docker/install-mamba.sh ${python_version}
- name: Build Flux Core Branch
env:
FLUX_RELEASE_VERSION: ${{ inputs.release_version || '0.88.0' }}
FLUX_VERSION: ${{ inputs.version || inputs.release_version || '0.88.0' }}
run: /bin/bash .github/scripts/setup.sh
- name: Build Python Bindings
env:
FLUX_BRANCH: ${{ inputs.branch }}
FLUX_REPO: ${{ inputs.repo }}
shell: bash
run: |
echo "Flux Repo: ${FLUX_REPO}"
echo "Flux Branch: ${FLUX_BRANCH}"
if [[ "${FLUX_REPO}" == "" ]]; then
FLUX_REPO="https://github.com/flux-framework/flux-core"
fi
if [[ "${FLUX_BRANCH}" == "" ]]; then
FLUX_BRANCH="master"
fi
git clone -b ${FLUX_BRANCH} ${FLUX_REPO} /tmp/flux-core
mv /tmp/flux-core/src/bindings/python/flux ./flux
/opt/conda/envs/build/bin/python3 setup.py sdist
sudo ldconfig
- name: Build Python Wheels
env:
build_number: ${{ inputs.rc || '0' }}
python_version: ${{ matrix.python }}
MANYLINUX_GLIBC: ${{ inputs.glibc || '2_17' }}
run: |
/bin/bash ./docker/build-wheels.sh "${build_number}" "${python_version}"
ls ./dist
- name: Test Install
shell: bash
run: |
PIP_INSTALL="/opt/conda/envs/build/bin/python3 -m pip install"
${PIP_INSTALL} ./dist/*.whl || ${PIP_INSTALL} ./dist/*.whl --break-system-packages
cd /tmp
/opt/conda/envs/build/bin/python3 -c "import flux, _flux._core, _flux._hostlist, _flux._idset; print(flux.__file__)"
- name: Upload Artifacts
if: success()
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.python }}
path: ./dist
upload:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v8
# If name unspecified, all artifacts download for run
- name: Show Files
run: |
ls */
# We just need one of these
first_dir=$(ls . | head -n 1)
mkdir -p ./dist
mv */*.whl ./dist/
cp ${first_dir}/*.tar.gz ./dist/
echo
echo "Files to distribute:"
ls ./dist
- name: Check distributions
run: |
python3 -m pip install setuptools wheel twine
twine check --strict dist/*
- name: Test upload
if: (github.event_name != 'workflow_dispatch')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: twine upload --verbose --repository testpypi --skip-existing dist/flux_python*
- name: Build and publish
if: (github.event_name == 'workflow_dispatch')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: twine upload --verbose --skip-existing dist/flux_python*