Skip to content

ci: add macos testing case #51

ci: add macos testing case

ci: add macos testing case #51

name: flux-python
on:
pull_request: {}
workflow_dispatch:
inputs:
version:
description: 'Pypi version'
release_version:
description: 'Version of flux to build'
default: "0.68.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"
jobs:
build:
name: ${{ matrix.os }} Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# The matrix now includes both os and python
os: [ubuntu-latest, macos-latest]
python: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Setup Python
env:
python_version: ${{ matrix.python }}
run: /bin/bash ./docker/install-mamba.sh ${{ matrix.python }}
# The login shell ensures the mamba env is active
- name: Build Flux Core Branch
env:
FLUX_RELEASE_VERSION: ${{ inputs.release_version }}
FLUX_VERSION: ${{ inputs.version }}
run: /bin/bash .github/scripts/setup.sh
- name: Build Python Bindings
shell: bash -l {0}
env:
FLUX_BRANCH: ${{ inputs.branch }}
FLUX_REPO: ${{ inputs.repo }}
run: |
echo "Flux Repo: ${{ inputs.repo }}"
echo "Flux Branch: ${{ inputs.branch }}"
# Use default values if inputs are empty
FLUX_REPO_URL=${FLUX_REPO:-"https://github.com/flux-framework/flux-core"}
FLUX_BRANCH_NAME=${FLUX_BRANCH:-"master"}
git clone -b ${FLUX_BRANCH_NAME} ${FLUX_REPO_URL} /tmp/flux-core
mv /tmp/flux-core/src/bindings/python/flux ./flux
python setup.py sdist
# I think ldconfig is Linux-specific
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ldconfig
fi
- name: Build Python Wheels
shell: bash -l {0}
env:
build_number: ${{ inputs.rc }}
python_version: ${{ matrix.python }}
run: |
/bin/bash ./docker/build-wheels.sh ${{ env.build_number }} ${{ env.python_version }}
ls ./dist
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
# The artifact name must be unique for each job in the matrix
name: dist-${{ matrix.python }}-${{ matrix.os }}
path: ./dist
upload:
runs-on: ubuntu-latest
# This job now needs the entire build matrix to complete successfully
needs: [build]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
# Download all artifacts created by the build jobs
path: artifacts
- name: Show and Organize Files
run: |
ls -R artifacts
mkdir -p ./dist
# This command finds all wheel and tar.gz files in all subdirectories
# and moves them into a single ./dist directory for upload.
find artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec mv {} ./dist/ \;
echo
echo "Files to distribute:"
ls ./dist
- name: Build and publish
# Ensure this only runs on pushes to a main branch, not PRs
if: (github.event_name != 'pull_request')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: |
python3 -m pip install --upgrade twine
twine upload --skip-existing dist/*