Skip to content

Commit 02f721e

Browse files
diogoncalvesIkko Eltociear Ashimineactions-userMiNeves00
authored
Version 1.0.1 (#177)
* docs: update ollama.mdx messeges -> messages Signed-off-by: Ikko Eltociear Ashimine <[email protected]> * feat: add ci for modules * chore: bump versions * feat: adapt develop actions * fix: github actions * fix: github actions dev * [fix] bump prerelease version in pyproject.toml * Create chore.yml Created a Chore YML template for Issues Signed-off-by: Miguel Neves <[email protected]> * feat: update ci for libs * feat: update dev workflow * fix: workflow * chore: bump versions * chore: fix typo * chore: name workflow --------- Signed-off-by: Ikko Eltociear Ashimine <[email protected]> Signed-off-by: Miguel Neves <[email protected]> Co-authored-by: Ikko Eltociear Ashimine <[email protected]> Co-authored-by: GitHub Actions <[email protected]> Co-authored-by: Miguel Neves <[email protected]>
1 parent 3834975 commit 02f721e

20 files changed

+451
-88
lines changed

.github/ISSUE_TEMPLATE/chore.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "🧹 Chore"
2+
description: Submit a request for a maintenance or improvement task in LLMstudio. Including but not limited to tests, refactoring, and CI/CD.
3+
title: "CHORE: "
4+
labels: ["03 Chore"]
5+
body:
6+
- type: textarea
7+
id: chore-description
8+
validations:
9+
required: true
10+
attributes:
11+
label: Chore Description
12+
description: |
13+
A clear and concise description of the chore. Examples include adding tests, refactoring, or updating CI/CD.
14+
15+
- type: textarea
16+
id: purpose
17+
validations:
18+
required: true
19+
attributes:
20+
label: Purpose
21+
description: |
22+
Outline the reason for this chore. What specific improvement does it bring to the project?
23+
Examples: resolve technical debt, increase code quality, aid future development, or simplify processes.
24+
25+
- type: textarea
26+
id: impact
27+
validations:
28+
required: true
29+
attributes:
30+
label: Impact and Scope
31+
description: |
32+
Describe the extent and scope of this chore. Will it affect multiple modules, dependencies, or documentation?
33+
Is it critical for maintainability or ease of use? Note any potential side effects, dependencies, or areas of the codebase it touches.
34+
35+
- type: textarea
36+
id: contribution
37+
validations:
38+
required: true
39+
attributes:
40+
label: Your Contribution
41+
description: |
42+
Can you assist with this chore by submitting a PR or providing insights? Make sure to read [CONTRIBUTING.MD](https://github.com/tensorops/llmstudio/blob/master/CONTRIBUTING.md).
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Upload Python package to PyPI and build/push Docker images.
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "libs/core/**"
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Checkout the code
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
# Set up Python environment
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.x"
23+
24+
# Install Poetry
25+
- name: Install Poetry
26+
run: |
27+
curl -sSL https://install.python-poetry.org | python3 -
28+
29+
# Configure Poetry with PyPI token
30+
- name: Configure Poetry
31+
run: |
32+
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
33+
34+
# Build and publish package to PyPI
35+
- name: Build and publish to PyPI
36+
working-directory: ./libs/core
37+
run: |
38+
poetry build
39+
poetry publish
40+
41+
# Extract the new version number from pyproject.toml
42+
- name: Extract version for tagging Docker image
43+
working-directory: ./libs/core
44+
run: |
45+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
46+
47+
# Wait for the package to become available on PyPI
48+
- name: Wait for PyPI to update
49+
run: |
50+
echo "Checking for llmstudio-core==${{ env.VERSION }} on PyPI..."
51+
for i in {1..10}; do
52+
if python -m pip install llmstudio-core==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
53+
echo "Package llmstudio-core==${{ env.VERSION }} is available on PyPI."
54+
break
55+
else
56+
echo "Package llmstudio-core==${{ env.VERSION }} not available yet. Waiting 15 seconds..."
57+
sleep 15
58+
fi
59+
if [ $i -eq 10 ]; then
60+
echo "Package did not become available in time."
61+
exit 1
62+
fi
63+
done

.github/workflows/upload-pypi-dev.yml

+76-23
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,113 @@
1-
name: Upload Python package to PyPI as dev release and build/push Docker image.
1+
name: Upload Python packages to PyPI as prerelease and build/push Docker image.
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
library:
7+
required: true
8+
type: choice
9+
description: "Choose the library to deploy (note: it points to develop branch only)"
10+
options:
11+
- llmstudio
12+
- llmstudio-core
13+
- llmstudio-proxy
14+
- llmstudio-tracker
15+
target_version:
16+
description: "Target version (e.g., 1.1.0)"
17+
required: true
18+
default: "1.1.0"
519

620
jobs:
721
deploy:
822
runs-on: ubuntu-latest
23+
env:
24+
MODULE_PATH: |
25+
${{
26+
inputs.library == 'llmstudio' && 'libs/llmstudio' ||
27+
inputs.library == 'llmstudio-core' && 'libs/core' ||
28+
inputs.library == 'llmstudio-proxy' && 'libs/proxy' ||
29+
inputs.library == 'llmstudio-tracker' && 'libs/tracker'
30+
}}
931
steps:
1032
- name: Checkout code
11-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
1234
with:
1335
ref: develop
1436
token: ${{ secrets.GH_TOKEN }}
1537

1638
- name: Set up Python
17-
uses: actions/setup-python@v2
39+
uses: actions/setup-python@v4
1840
with:
1941
python-version: "3.x"
2042

2143
- name: Install Poetry
22-
run: |
23-
curl -sSL https://install.python-poetry.org | python3 -
44+
run: curl -sSL https://install.python-poetry.org | python3 -
2445

2546
- name: Configure Poetry
47+
run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
48+
49+
- name: Check PyPI for Target Version
50+
working-directory: ${{ env.MODULE_PATH }}
51+
id: check-version
2652
run: |
27-
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
53+
TARGET_VERSION="${{ github.event.inputs.target_version }}"
54+
PACKAGE_NAME=${{ inputs.library }}
55+
RESPONSE=$(curl -s "https://pypi.org/pypi/$PACKAGE_NAME/json" || echo "{}")
56+
echo "$RESPONSE" | jq -r '.releases | keys[]' > all_versions.txt
57+
if grep -qx "$TARGET_VERSION" all_versions.txt; then
58+
echo "exists=true" >> $GITHUB_ENV
59+
else
60+
echo "exists=false" >> $GITHUB_ENV
61+
fi
62+
63+
# Step 4: Decide on the next alpha version
64+
- name: Determine Next Alpha Version
65+
id: determine-version
66+
run: |
67+
if [[ "${{ env.exists }}" == "true" ]]; then
68+
echo "Error: Version ${{ github.event.inputs.target_version }} already exists on PyPI."
69+
exit 1
70+
fi
71+
BASE_VERSION="${{ github.event.inputs.target_version }}"
72+
PACKAGE_NAME=${{ inputs.library }}
73+
ALPHA_VERSIONS=$(grep -E "^$BASE_VERSIONa[0-9]+$" all_versions.txt | sort -V || true)
74+
if [[ -z "$ALPHA_VERSIONS" ]]; then
75+
NEW_VERSION="${BASE_VERSION}a0"
76+
else
77+
LATEST_ALPHA=$(echo "$ALPHA_VERSIONS" | tail -n 1)
78+
NEXT_ALPHA_NUM=$(( $(echo "$LATEST_ALPHA" | grep -oE '[0-9]+$') + 1 ))
79+
NEW_VERSION="${BASE_VERSION}a${NEXT_ALPHA_NUM}"
80+
fi
81+
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
82+
echo "Determined new version: $NEW_VERSION"
2883
2984
- name: Build and publish to PyPI as development release
85+
working-directory: ${{ env.MODULE_PATH }}
3086
run: |
31-
poetry version prerelease
87+
poetry version ${{ env.new_version }}
3288
poetry build
3389
poetry publish
3490
3591
- name: Commit and push updated pyproject.toml
92+
working-directory: ${{ env.MODULE_PATH }}
3693
run: |
3794
git config user.name "GitHub Actions"
3895
git config user.email "[email protected]"
3996
git add pyproject.toml
4097
git commit -m "[fix] bump prerelease version in pyproject.toml"
4198
git push
4299
43-
# Wait for PyPI to update
44100
- name: Wait for PyPI to update
101+
working-directory: ${{ env.MODULE_PATH }}
45102
run: |
46103
VERSION=$(poetry version --short)
47-
echo "Checking for llmstudio==$VERSION on PyPI..."
104+
echo "Checking for ${{ github.event.inputs.library }}==$VERSION on PyPI..."
48105
for i in {1..10}; do
49-
if python -m pip install llmstudio==${VERSION} --dry-run >/dev/null 2>&1; then
50-
echo "Package llmstudio==${VERSION} is available on PyPI."
106+
if python -m pip install ${{ github.event.inputs.library }}==${VERSION} --dry-run >/dev/null 2>&1; then
107+
echo "Package ${{ github.event.inputs.library }}==${VERSION} is available on PyPI."
51108
break
52109
else
53-
echo "Package llmstudio==${VERSION} not available yet. Waiting 15 seconds..."
110+
echo "Package ${{ github.event.inputs.library }}==${VERSION} not available yet. Waiting 15 seconds..."
54111
sleep 15
55112
fi
56113
if [ $i -eq 10 ]; then
@@ -59,7 +116,6 @@ jobs:
59116
fi
60117
done
61118
62-
# Docker build and push section
63119
- name: Set up Docker Buildx
64120
uses: docker/setup-buildx-action@v2
65121

@@ -70,18 +126,15 @@ jobs:
70126
password: ${{ secrets.DOCKER_PASSWORD }}
71127

72128
- name: Extract version for tagging Docker image
129+
working-directory: ${{ env.MODULE_PATH }}
73130
id: get_version
74-
run: |
75-
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
131+
run: echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
76132

77-
- name: Build and tag Docker image
133+
- name: Build Docker images
134+
working-directory: ./deploy
78135
run: |
79-
docker build \
80-
--build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \
81-
-t tensoropsai/llmstudio:${{ env.VERSION }} \
82-
.
136+
make version=${{ env.VERSION }} build-${{ github.event.inputs.library }}
83137
84-
- name: Push Docker image to Docker Hub
138+
- name: Push Docker images
85139
run: |
86-
docker push tensoropsai/llmstudio:${{ env.VERSION }}
87-
140+
docker push tensoropsai/${{ github.event.inputs.library }}:${{ env.VERSION }}
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Upload Python package to PyPI and build/push Docker images.
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "libs/proxy/**"
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Checkout the code
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
# Set up Python environment
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.x"
23+
24+
# Install Poetry
25+
- name: Install Poetry
26+
run: |
27+
curl -sSL https://install.python-poetry.org | python3 -
28+
29+
# Configure Poetry with PyPI token
30+
- name: Configure Poetry
31+
run: |
32+
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
33+
34+
# Build and publish package to PyPI
35+
- name: Build and publish to PyPI
36+
working-directory: ./libs/proxy
37+
run: |
38+
poetry build
39+
poetry publish
40+
41+
# Extract the new version number from pyproject.toml
42+
- name: Extract version for tagging Docker image
43+
working-directory: ./libs/proxy
44+
run: |
45+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
46+
47+
# Wait for the package to become available on PyPI
48+
- name: Wait for PyPI to update
49+
run: |
50+
echo "Checking for llmstudio-proxy==${{ env.VERSION }} on PyPI..."
51+
for i in {1..10}; do
52+
if python -m pip install llmstudio-proxy==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
53+
echo "Package llmstudio-proxy==${{ env.VERSION }} is available on PyPI."
54+
break
55+
else
56+
echo "Package llmstudio-proxy==${{ env.VERSION }} not available yet. Waiting 15 seconds..."
57+
sleep 15
58+
fi
59+
if [ $i -eq 10 ]; then
60+
echo "Package did not become available in time."
61+
exit 1
62+
fi
63+
done
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v2
67+
68+
- name: Log in to Docker Hub
69+
uses: docker/login-action@v2
70+
with:
71+
username: ${{ secrets.DOCKER_USERNAME }}
72+
password: ${{ secrets.DOCKER_PASSWORD }}
73+
74+
- name: Extract version for tagging Docker image
75+
working-directory: ./libs/proxy
76+
id: get_version
77+
run: echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
78+
79+
- name: Build Docker images
80+
working-directory: ./deploy
81+
run: |
82+
make version=${{ env.VERSION }} build-llmstudio-proxy
83+
84+
- name: Push Docker images
85+
run: |
86+
docker push tensoropsai/llmstudio-proxy:${{ env.VERSION }}

0 commit comments

Comments
 (0)