Skip to content

Added some badges to README.rst. #24

Added some badges to README.rst.

Added some badges to README.rst. #24

name: Python Wheels (vcpkg build)
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
build_wheels:
name: ${{ github.workflow }} Python build wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Free disk space
shell: bash
run: |
if [ "${RUNNER_OS}" == "Linux" ]; then
df -h
echo "Cleaning..."
[ -e "/usr/share/dotnet" ] && sudo rm -rf "/usr/share/dotnet"
[ -e "/opt/ghc" ] && sudo rm -rf "/opt/ghc"
[ -e "/usr/local/share/boost" ] && sudo rm -rf "/usr/local/share/boost"
[ -e "${AGENT_TOOLSDIRECTORY}" ] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}"
echo "Cleaning...done."
df -h
fi
- name: Install OS tools
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install autoconf automake libtool
fi
- uses: lukka/get-cmake@latest
name: Install cmake and ninja (via get-cmake)
- uses: lukka/run-vcpkg@v11
name: Restore artifacts, or setup vcpkg for building artifacts
with:
# This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch.
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
# The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule.
vcpkgGitCommitId: "f7423ee180c4b7f40d43402c2feb3859161ef625"
# The vcpkg.json file, which will be part of cache key computation.
vcpkgJsonGlob: '**/vcpkg.json'
id: runvcpkg
- name: Prints output of run-vcpkg's action.
shell: bash
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cibuildwheel
shell: bash
run: |
python -m pip install cibuildwheel==2.19.2
if [ "${RUNNER_OS}" == "Linux" ]; then
df -h
fi
- name: Build wheels
shell: bash
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ENVIRONMENT_LINUX: "CMAKE_FETCH_VCPKG=ON"
# vcpkg does not support i686 nor aarch64
CIBW_ARCHS: "auto64"
# Skip musllinux builds
CIBW_SKIP: "*-musllinux_*"
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
# Don't repair macOS wheels
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install cmake"
CIBW_BEFORE_BUILD_LINUX: "if [[ -e /project/_skbuild ]]; then rm -rf /project/_skbuild; fi; df -h"
CIBW_BEFORE_ALL_LINUX: "/usr/bin/yum install --assumeyes --verbose zip unzip tar cmake"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
# Run the package tests using `pytest`
CIBW_TEST_COMMAND: "python -m pyemblite.test -fv"
- uses: actions/upload-artifact@v4
with:
# name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
retention-days: 10
build_sdist:
name: Build python sdist
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
name: Install cmake and ninja (via get-cmake)
- name: Restore artifacts, or setup vcpkg for building artifacts
uses: lukka/run-vcpkg@v11
with:
# This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch.
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
# The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule.
vcpkgGitCommitId: "f7423ee180c4b7f40d43402c2feb3859161ef625"
# The vcpkg.json file, which will be part of cache key computation.
vcpkgJsonGlob: '**/vcpkg.json'
id: runvcpkg
- name: Prints output of run-vcpkg's action.
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install sdist build dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install "Cython" "numpy" "wheel" "setuptools>=42" "versioneer[toml]" "scikit-build" "cmake" "ninja"
- name: Create python sdist
run: python setup.py sdist --formats=zip
- name: Upload python sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: ./dist/*
release:
name: Make a Release
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download python sdist and wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: ./release_artifacts/
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ./release_artifacts/*
publish:
name: Upload release to PyPI
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyemblite
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download python sdist and wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: ./release_artifacts/
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./release_artifacts/