Skip to content

Release new version #96

Release new version

Release new version #96

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@v4
- 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.6.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@v4
- 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@v4
with:
path: "doxygen/documentation*.pdf"
name: "documentation.pdf"
- name: "Deploy documentation page"
uses: appleboy/scp-action@v0.1.4
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 RiscV Ubuntu python wheels"
if: ${{ needs.check-tag-existance.outputs.exists == 'false' }}
needs:
- check-tag-existance
runs-on: ubuntu-latest
strategy:
matrix:
python: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
env:
INSTALL_PREFIX: "/usr/local"
PYTHON_VERSION: "${{ matrix.python }}"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Build and test inside RISC-V emulated environment (Debian based)"
uses: uraimo/run-on-arch-action@v2
with:
arch: riscv64
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3 python3-pip python3-venv python3-wheel python3-setuptools \
g++ cmake ninja-build git
run: |
set -eux
echo "Building for RISC-V on Ubuntu 22.04"
python3 -m pip install --upgrade pip
python3 -m pip install -r build-requirements.txt
mkdir -p /tmp/capio_cl_jsons
mkdir -p /tmp/capio_cl_tomls
cp -r tests/jsons/* /tmp/capio_cl_jsons
cp -r tests/tomls/* /tmp/capio_cl_tomls
python3 -m build \
-Ccmake.define.ENABLE_COVERAGE=OFF \
-Ccmake.build-type=Release \
-Ccmake.define.CAPIO_CL_BUILD_TESTS=OFF
mv dist/*.whl dist/py_capio_cl_ubunturv64_python_${{matrix.python}}.whl
- name: "Upload built RISC-V wheel"
if: success()
uses: actions/upload-artifact@v4
with:
name: "${{ format('py_capio_cl_ubunturv64_python_{0}.whl', matrix.python) }}"
path: "dist/${{ format('py_capio_cl_ubunturv64_python_{0}.whl', matrix.python) }}"
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@v4
- name: "Download built wheel artifacts"
uses: actions/download-artifact@v4
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@v2
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@v4
- name: Set up Python
uses: actions/setup-python@v5
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
MACOSX_DEPLOYMENT_TARGET: "15.0"
CIBW_BUILD_VERBOSITY: 1
run: |
cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
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@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v4
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@v4
- uses: actions/download-artifact@v4
with:
path: dist_all
name: wheels-ubuntu-latest
- uses: actions/download-artifact@v4
with:
path: dist_all
name: wheels-ubuntu-24.04-arm
- uses: actions/download-artifact@v4
with:
path: dist_all
name: wheels-macos-15-intel
- uses: actions/download-artifact@v4
with:
path: dist_all
name: wheels-macos-latest
- uses: actions/download-artifact@v4
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 }}