Skip to content

馃帀 chore(release): bump version to v4.0.0-beta.13 #9

馃帀 chore(release): bump version to v4.0.0-beta.13

馃帀 chore(release): bump version to v4.0.0-beta.13 #9

Workflow file for this run

name: New Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: Existing release tag to build
required: true
type: string
permissions:
contents: read
concurrency:
group: release-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
env:
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
jobs:
validate:
name: Validate release metadata
runs-on: ubuntu-22.04
steps:
- name: Check out release tag
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Generate release notes
run: |
python scripts/generate_release_notes.py \
--tag "${RELEASE_TAG}" \
--repository "${GITHUB_REPOSITORY}" \
--output release-notes.md
- name: Show release notes
run: cat release-notes.md
test:
name: Test before release
needs: validate
runs-on: ubuntu-22.04
env:
QT_QPA_PLATFORM: offscreen
steps:
- name: Check out release tag
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_TAG }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libdbus-1-3 \
libegl1 \
libgl1 \
libpulse0 \
libxkbcommon-x11-0 \
libxcb-cursor0 \
libxcb-xinerama0
- name: Install dependencies
run: uv pip install --system -e ".[cpu,dev]"
- name: Run tests
run: pytest --ignore=tests/test_widgets/test_toolbar_layout.py
build:
name: Build ${{ matrix.name }}
needs: [validate, test]
strategy:
fail-fast: false
matrix:
include:
- name: Linux CPU
os: ubuntu-22.04
target: linux-cpu
extra: cpu
artifact: linux-cpu
files: dist/X-AnyLabeling-v*-Linux-CPU
- name: Linux CUDA 12
os: ubuntu-22.04
target: linux-gpu
extra: gpu
artifact: linux-cuda12
files: dist/X-AnyLabeling-v*-Linux-CUDA12
- name: Windows CPU
os: windows-2022
target: win-cpu
extra: cpu
artifact: windows-cpu
files: dist/X-AnyLabeling-v*-CPU.exe
- name: Windows CUDA 12
os: windows-2022
target: win-gpu
extra: gpu
artifact: windows-cuda12
files: dist/X-AnyLabeling-v*-Windows-CUDA12.exe
- name: macOS Apple Silicon
os: macos-15
target: macos
extra: cpu
artifact: macos-arm64
files: |
dist/*-arm64-unsigned.zip
dist/*-arm64-unsigned.zip.sha256
runs-on: ${{ matrix.os }}
steps:
- name: Check out release tag
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_TAG }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libdbus-1-3 \
libegl1 \
libgl1 \
libpulse0 \
libxkbcommon-x11-0 \
libxcb-cursor0 \
libxcb-xinerama0
- name: Install dependencies
run: uv pip install --system -e ".[${{ matrix.extra }},dev]"
- name: Verify Windows CUDA 12 dependencies
if: matrix.target == 'win-gpu'
shell: bash
run: |
python - <<'PY'
from importlib.metadata import version
from pathlib import Path
import onnxruntime
ort_version = version("onnxruntime-gpu")
provider = (
Path(onnxruntime.__file__).parent
/ "capi"
/ "onnxruntime_providers_cuda.dll"
)
dependencies = provider.read_bytes()
if tuple(map(int, ort_version.split(".")[:2])) >= (1, 27):
raise RuntimeError(
f"ONNX Runtime GPU {ort_version} requires CUDA 13"
)
if b"cublas64_12.dll" not in dependencies:
raise RuntimeError(
f"{provider.name} does not depend on CUDA 12 cuBLAS"
)
if b"cublas64_13.dll" in dependencies:
raise RuntimeError(
f"{provider.name} unexpectedly depends on CUDA 13 cuBLAS"
)
print(f"Verified ONNX Runtime GPU {ort_version} for CUDA 12")
PY
- name: Build executable
shell: bash
run: bash scripts/build_executable.sh "${{ matrix.target }}"
- name: Name CUDA 12 artifact
if: matrix.extra == 'gpu'
shell: bash
run: |
version="${RELEASE_TAG#v}"
if [ "${{ matrix.target }}" = "linux-gpu" ]; then
mv \
"dist/X-AnyLabeling-v${version}-Linux-GPU" \
"dist/X-AnyLabeling-v${version}-Linux-CUDA12"
else
mv \
"dist/X-AnyLabeling-v${version}-GPU.exe" \
"dist/X-AnyLabeling-v${version}-Windows-CUDA12.exe"
fi
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.files }}
if-no-files-found: error
retention-days: 7
compression-level: 0
build-python-package:
name: Build Python package
needs: build
runs-on: ubuntu-22.04
steps:
- name: Check out release tag
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_TAG }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build tools
run: python -m pip install build twine
- name: Build package distributions
run: python -m build
- name: Validate package distributions
run: python -m twine check dist/*
- name: Upload package distributions
uses: actions/upload-artifact@v7
with:
name: python-package
path: dist/*
if-no-files-found: error
retention-days: 7
publish-pypi:
name: Publish Python package to PyPI
needs: build-python-package
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/p/x-anylabeling-cvhub
permissions:
id-token: write
steps:
- name: Download package distributions
uses: actions/download-artifact@v8
with:
name: python-package
path: dist
- name: Publish package distributions
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
skip-existing: true
release:
name: Publish GitHub release
needs: [build, publish-pypi]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Check out release tag
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Generate release notes
run: |
python scripts/generate_release_notes.py \
--tag "${RELEASE_TAG}" \
--repository "${GITHUB_REPOSITORY}" \
--output release-notes.md
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
path: release-assets
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.RELEASE_TAG }}
name: X-AnyLabeling ${{ env.RELEASE_TAG }}
body_path: release-notes.md
files: release-assets/*
prerelease: false
make_latest: true
fail_on_unmatched_files: true