Skip to content

Commit bf30dc4

Browse files
hackwaanurag
andauthored
add release workflow (#2)
Signed-off-by: anurag <anurag@amd.com> Co-authored-by: anurag <anurag@amd.com>
1 parent d81cdce commit bf30dc4

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: MLDebugger Release
5+
6+
on:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
# Differentiate manual testing from automated testing
13+
env:
14+
GIT_MODE: 1
15+
16+
jobs:
17+
build:
18+
runs-on: [ build ]
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
clean: true
23+
24+
- name: Install uv
25+
run: |
26+
pip install uv
27+
echo "Checking pip show:"
28+
pip show uv
29+
echo "Checking user base:"
30+
python -m site --user-base
31+
echo "Checking user bin directory:"
32+
ls -la $(python -m site --user-base)/bin/ 2>/dev/null || echo "No user bin directory"
33+
echo "Current PATH:"
34+
echo $PATH
35+
echo "Looking for uv executable:"
36+
find /scratch -name "uv" 2>/dev/null || echo "uv not found in /scratch"
37+
find $HOME -name "uv" 2>/dev/null || echo "uv not found in HOME"
38+
39+
- name: Add uv to PATH
40+
run: echo "$(python -m site --user-base)/bin" >> $GITHUB_PATH
41+
42+
- name: "Set up Python"
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version-file: "pyproject.toml"
46+
47+
- name: Create and activate virtual environment
48+
run: |
49+
uv venv
50+
source .venv/bin/activate
51+
52+
- name: Install dependencies
53+
run: |
54+
uv pip install flake8 pytest pylint
55+
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
56+
57+
- name: Lint with flake8, pylint
58+
run: |
59+
# stop the build if there are Python syntax errors or undefined names
60+
flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics --indent-size 2
61+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
62+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --indent-size 2
63+
find src/ -type f -name "*.py" | xargs pylint --ignore=.venv --indent-string=' ' --exit-zero --max-line-length=120
64+
65+
- name: Update submodules
66+
run: |
67+
git submodule update --init --recursive
68+
69+
- name: Build wheel with UV
70+
run: |
71+
uv build --wheel .
72+
73+
- name: Store wheel path
74+
id: wheel-path
75+
run: |
76+
WHEEL_PATH=$(find dist -name "*.whl" | head -1)
77+
echo "wheel_path=$WHEEL_PATH" >> $GITHUB_OUTPUT
78+
echo "wheel_name=$(basename $WHEEL_PATH)" >> $GITHUB_OUTPUT
79+
80+
- name: Install built wheel
81+
run: |
82+
# Find the wheel file and install it
83+
WHEEL_PATH=$(find dist -name "*.whl" | head -1)
84+
uv pip install --system "$WHEEL_PATH"
85+
86+
- name: Create Release
87+
id: create_release
88+
uses: actions/create-release@v1
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
tag_name: v${{ github.run_number }}
93+
release_name: Release v${{ github.run_number }}
94+
draft: false
95+
prerelease: false
96+
97+
- name: Upload Assets to Release
98+
run: |
99+
# Upload only the Wheel (DLL is already inside it)
100+
gh release upload v${{ github.run_number }} \
101+
"${{ steps.wheel-path.outputs.wheel_path }}" \
102+
--clobber
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
106+
- name: Delete old releases
107+
shell: bash
108+
run: |
109+
# Get all releases, skip the first 10 (keep_latest), delete the rest
110+
gh release list --limit 100 --json tagName --jq '.[10:][].tagName' | \
111+
xargs -I {} gh release delete {} --yes
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)