馃帀 chore(release): bump version to v4.0.5 #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| cuda: "12" | |
| artifact: linux-cuda12 | |
| files: dist/X-AnyLabeling-v*-Linux-CUDA12 | |
| - name: Linux CUDA 11 | |
| os: ubuntu-22.04 | |
| target: linux-gpu | |
| extra: gpu-cu11 | |
| cuda: "11" | |
| artifact: linux-cuda11 | |
| files: dist/X-AnyLabeling-v*-Linux-CUDA11 | |
| - name: Linux CUDA 13 | |
| os: ubuntu-22.04 | |
| target: linux-gpu | |
| extra: gpu-cu13 | |
| cuda: "13" | |
| artifact: linux-cuda13 | |
| files: dist/X-AnyLabeling-v*-Linux-CUDA13 | |
| - 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 | |
| cuda: "12" | |
| artifact: windows-cuda12 | |
| files: dist/X-AnyLabeling-v*-Windows-CUDA12.exe | |
| - name: Windows CUDA 11 | |
| os: windows-2022 | |
| target: win-gpu | |
| extra: gpu-cu11 | |
| cuda: "11" | |
| artifact: windows-cuda11 | |
| files: dist/X-AnyLabeling-v*-Windows-CUDA11.exe | |
| - name: Windows CUDA 13 | |
| os: windows-2022 | |
| target: win-gpu | |
| extra: gpu-cu13 | |
| cuda: "13" | |
| artifact: windows-cuda13 | |
| files: dist/X-AnyLabeling-v*-Windows-CUDA13.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 CUDA dependencies | |
| if: matrix.cuda != '' | |
| shell: bash | |
| env: | |
| CUDA_MAJOR: ${{ matrix.cuda }} | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import sys | |
| from importlib.metadata import version | |
| from importlib.util import find_spec | |
| from pathlib import Path | |
| ort_version = version("onnxruntime-gpu") | |
| cuda_major = os.environ["CUDA_MAJOR"] | |
| ort_spec = find_spec("onnxruntime") | |
| if ort_spec is None or not ort_spec.submodule_search_locations: | |
| raise RuntimeError("Unable to locate ONNX Runtime GPU") | |
| provider_name = ( | |
| "onnxruntime_providers_cuda.dll" | |
| if sys.platform == "win32" | |
| else "libonnxruntime_providers_cuda.so" | |
| ) | |
| provider = ( | |
| Path(next(iter(ort_spec.submodule_search_locations))) | |
| / "capi" | |
| / provider_name | |
| ) | |
| dependencies = provider.read_bytes() | |
| library = ( | |
| f"cublas64_{cuda_major}.dll".encode() | |
| if sys.platform == "win32" | |
| else f"libcublas.so.{cuda_major}".encode() | |
| ) | |
| if library not in dependencies: | |
| raise RuntimeError( | |
| f"{provider.name} does not depend on CUDA {cuda_major} cuBLAS" | |
| ) | |
| print( | |
| f"Verified ONNX Runtime GPU {ort_version} for CUDA {cuda_major}" | |
| ) | |
| PY | |
| - name: Build executable | |
| shell: bash | |
| run: bash scripts/build_executable.sh "${{ matrix.target }}" | |
| - name: Name CUDA artifact | |
| if: matrix.cuda != '' | |
| 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-CUDA${{ matrix.cuda }}" | |
| else | |
| mv \ | |
| "dist/X-AnyLabeling-v${version}-GPU.exe" \ | |
| "dist/X-AnyLabeling-v${version}-Windows-CUDA${{ matrix.cuda }}.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 |