Skip to content

Release new version #134

Release new version

Release new version #134

Workflow file for this run

name: "Release new version"
on:
workflow_run:
workflows:
- "Python Bindings Unit Tests"
branches:
- main
types:
- completed
jobs:
check-tag-existance:
name: "Check if tag exists"
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check-tag.outputs.exists }}
steps:
- uses: actions/checkout@v7
- name: "Get CAPIO-CL version"
run: echo "CAPIO_CL_VERSION=$(grep -E 'VERSION [0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt | awk '{print $2}')" >> $GITHUB_ENV
- name: "Check if tag exists"
id: check-tag
uses: mukunku/tag-exists-action@v1.7.0
with:
tag: "v${{ env.CAPIO_CL_VERSION }}"
generate-documentation:
name: "Build documentation"
needs:
- check-tag-existance
if: ${{ needs.check-tag-existance.outputs.exists == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: "Install packages"
run: |
sudo apt update
sudo apt install wget make graphviz texlive texlive-latex-extra
- name: "Install Doxygen 1.14.0"
run: |
wget https://www.doxygen.nl/files/doxygen-1.14.0.linux.bin.tar.gz
tar -xzf doxygen-1.14.0.linux.bin.tar.gz
sudo mv doxygen-1.14.0/bin/doxygen /usr/local/bin/doxygen
doxygen --version
- name: "Run Doxygen"
working-directory: doxygen
run: make pdf
- name: "Upload pdf documentation"
if: success()
uses: actions/upload-artifact@v7
with:
path: "doxygen/documentation*.pdf"
name: "documentation.pdf"
- name: "Deploy documentation page"
uses: appleboy/scp-action@v1.0.0
with:
host: capio.hpc4ai.it
key: ${{ secrets.CAPIO_CL_DOC_DEPLOY_KEY }}
rm: true
source: "doxygen/generated/html/"
strip_components: 3
target: /mnt/services/capio/nginx/html/capiocl
username: capio-user
riscv-wheels:
name: "Build RISC-V Ubuntu Python wheels"
if: ${{ needs.check-tag-existance.outputs.exists == 'false' }}
needs:
- check-tag-existance
runs-on: ubuntu-24.04-riscv
strategy:
fail-fast: false
matrix:
include:
- python: '3.10'
abi: cp310
- python: '3.11'
abi: cp311
- python: '3.12'
abi: cp312
- python: '3.13'
abi: cp313
- python: '3.14'
abi: cp314
steps:
- name: "Checkout repository"
uses: actions/checkout@v7
- name: "Install cibuildwheel"
run: |
set -eux
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip git
python3 -m pip install --upgrade pip cibuildwheel --break-system-packages
- name: "Build RISC-V wheel (CPython ${{ matrix.python }})"
env:
CIBW_BUILD: "${{ matrix.abi }}-manylinux_riscv64"
CIBW_ARCHS: "riscv64"
CIBW_MANYLINUX_RISCV64_IMAGE: "manylinux_2_39"
CIBW_CONFIG_SETTINGS: >-
cmake.define.ENABLE_COVERAGE=OFF
cmake.build-type=Release
cmake.define.CAPIO_CL_BUILD_TESTS=OFF
CIBW_BEFORE_ALL_LINUX: dnf install -y protobuf-devel protobuf-compiler
CIBW_BUILD_VERBOSITY: "1"
run: |
set -eux
echo "Building on $(uname -m) / Ubuntu 24.04 for CPython ${{ matrix.python }}"
python3 -m cibuildwheel --output-dir wheelhouse
- name: "Upload built RISC-V wheel"
if: success()
uses: actions/upload-artifact@v7
with:
name: "wheels-ubuntu-24.04-riscv-py${{ matrix.python }}"
path: "wheelhouse/*.whl"
github:
name: "Create GitHub Release"
if: ${{ needs.check-tag-existance.outputs.exists == 'false' && github.event.workflow_run.conclusion == 'success' }}
needs: [ riscv-wheels, generate-documentation ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: "Download built wheel artifacts"
uses: actions/download-artifact@v8
with:
path: dist
- name: "Get CAPIO-CL version"
run: echo "CAPIO_CL_VERSION=$(grep -E 'VERSION [0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt | awk '{print $2}')" >> $GITHUB_ENV
- name: "Create GitHub Release"
uses: softprops/action-gh-release@v3
with:
name: "v${{ env.CAPIO_CL_VERSION }}"
tag_name: "v${{ env.CAPIO_CL_VERSION }}"
generate_release_notes: true
files: |
**/*.whl
**/*.pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: ${{ needs.check-tag-existance.outputs.exists == 'false'}}
needs: [ github ]
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'ubuntu-24.04-arm', 'macos-15-intel', 'macos-latest' ]
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Install cibuildwheel
run: python -m pip install --upgrade cibuildwheel
- name: Build wheels
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL_LINUX: dnf install -y protobuf-devel protobuf-compiler
CIBW_BEFORE_ALL_MACOS: brew install protobuf
MACOSX_DEPLOYMENT_TARGET: "15.0"
CIBW_BUILD_VERBOSITY: 1
run: |
cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
sdist:
name: Build sdist
runs-on: ubuntu-latest
if: ${{ needs.check-tag-existance.outputs.exists == 'false'}}
needs: [ github ]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.x"
- run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [ build, sdist, riscv-wheels ]
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
path: dist_all
name: wheels-ubuntu-latest
- uses: actions/download-artifact@v8
with:
path: dist_all
name: wheels-ubuntu-24.04-arm
- uses: actions/download-artifact@v8
with:
path: dist_all
name: wheels-macos-15-intel
- uses: actions/download-artifact@v8
with:
path: dist_all
name: wheels-macos-latest
- uses: actions/download-artifact@v8
with:
path: dist_all
name: sdist
- run: |
shopt -s nullglob
for f in dist_all/*.zip; do
unzip -o "$f" -d dist_all/
done
- run: |
python -m pip install --upgrade twine
twine check dist_all/*
twine upload dist_all/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_DEPLOY_KEY }}