Skip to content

MLDebugger Release

MLDebugger Release #10

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: MLDebugger Release
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag (Default: v<run_number>)'
required: false
default: ''
release_name:
description: 'Release name (Default: "Release v<run_number>")'
required: false
default: ''
permissions:
contents: write
# Differentiate manual testing from automated testing
env:
GIT_MODE: 1
jobs:
build:
runs-on: [ build ]
steps:
- uses: actions/checkout@v4
with:
clean: true
lfs: true
- name: Pull LFS files
run: git lfs pull
- name: Add uv to PATH
run: echo "$(python -m site --user-base)/bin" >> $GITHUB_PATH
- name: "Set up Python"
uses: actions/setup-python@v4
with:
python-version-file: "pyproject.toml"
- name: Create and activate virtual environment
run: |
uv venv
source .venv/bin/activate
- name: Lint with flake8, pylint
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics --indent-size 2
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --indent-size 2
find src/ -type f -name "*.py" | xargs pylint --ignore=.venv --indent-string=' ' --exit-zero --max-line-length=120
- name: Update submodules
run: |
git submodule update --init --recursive
# Pull LFS files inside any submodules that use LFS
git submodule foreach --recursive 'git lfs pull || true'
- name: Build wheel with UV
run: |
uv build --wheel .
- name: Store wheel path
id: wheel-path
run: |
WHEEL_PATH=$(find dist -name "*.whl" | head -1)
echo "wheel_path=$WHEEL_PATH" >> $GITHUB_OUTPUT
echo "wheel_name=$(basename $WHEEL_PATH)" >> $GITHUB_OUTPUT
- name: Install built wheel
run: |
# Find the wheel file and install it
WHEEL_PATH=$(find dist -name "*.whl" | head -1)
uv pip install --system "$WHEEL_PATH"
- name: Resolve release tag and name
id: release_meta
shell: bash
run: |
DEFAULT_TAG="v${{ github.run_number }}"
DEFAULT_NAME="Release v${{ github.run_number }}"
TAG="${{ github.event.inputs.release_tag }}"
NAME="${{ github.event.inputs.release_name }}"
TAG="${TAG:-$DEFAULT_TAG}"
NAME="${NAME:-$DEFAULT_NAME}"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "name=$NAME" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_meta.outputs.tag }}
release_name: ${{ steps.release_meta.outputs.name }}
draft: false
prerelease: false
- name: Upload Assets to Release
run: |
# Upload only the Wheel (DLL is already inside it)
gh release upload "${{ steps.release_meta.outputs.tag }}" \
"${{ steps.wheel-path.outputs.wheel_path }}" \
--clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete old releases
shell: bash
run: |
# Get all releases, skip the first 50 (keep_latest), delete the rest
gh release list --limit 200 --json tagName --jq '.[50:][].tagName' | \
xargs -I {} gh release delete {} --yes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}