Skip to content

test workflow

test workflow #117

Workflow file for this run

name: ALPS Python Packaging CI/CD
on: [push, pull_request]
jobs:
build_wheels:
name: Build wheels on ${{ matrix.plat.os }}
runs-on: ${{ matrix.plat.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
plat:
- { os: ubuntu-latest, target: "", arch: x86_64, homebrew: ''}
#- { os: macos-13, target: "13.0" , arch: x86_64, homebrew: '/usr/local'} #DEPRECATED. Too old.
- { os: macos-14, target: "14.0" , arch: arm64, homebrew: '/opt/homebrew'}
- { os: macos-15, target: "15.0" , arch: arm64, homebrew: '/opt/homebrew'}
steps:
- uses: actions/checkout@v4
# Install Fortran compiler based on OS
- name: Install dependencies
run: |
if [ "${{ matrix.plat.os }}" = "ubuntu-latest" ]; then
sudo apt-get update
sudo apt-get install -y gfortran
else
brew update
brew install gfortran
fi
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
CIBW_ARCHS: ${{ matrix.plat.arch }}
CIBW_ARCHS_MACOS: ${{ matrix.plat.arch }}
# Set Fortran compiler for all platforms
CIBW_ENVIRONMENT: "FC=gfortran"
# macOS-specific settings
CIBW_ENVIRONMENT_MACOS: >
Boost_ROOT_DIR=/Users/runner/work/ALPS/ALPS/boost_1_87_0
MACOSX_DEPLOYMENT_TARGET=${{ matrix.plat.target }}
CXXFLAGS="-stdlib=libc++"
# CIBW_ENVIRONMENT: >
# env:
# CIBW_SOME_OPTION: value
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.plat.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
#if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
#with:
# To test:
# repository-url: https://test.pypi.org/legacy/