Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.0.0 - update workflows #177

Merged
merged 17 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/chore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "🧹 Chore"
description: Submit a request for a maintenance or improvement task in LLMstudio. Including but not limited to tests, refactoring, and CI/CD.
title: "CHORE: "
labels: ["03 Chore"]
body:
- type: textarea
id: chore-description
validations:
required: true
attributes:
label: Chore Description
description: |
A clear and concise description of the chore. Examples include adding tests, refactoring, or updating CI/CD.

- type: textarea
id: purpose
validations:
required: true
attributes:
label: Purpose
description: |
Outline the reason for this chore. What specific improvement does it bring to the project?
Examples: resolve technical debt, increase code quality, aid future development, or simplify processes.

- type: textarea
id: impact
validations:
required: true
attributes:
label: Impact and Scope
description: |
Describe the extent and scope of this chore. Will it affect multiple modules, dependencies, or documentation?
Is it critical for maintainability or ease of use? Note any potential side effects, dependencies, or areas of the codebase it touches.

- type: textarea
id: contribution
validations:
required: true
attributes:
label: Your Contribution
description: |
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 changes: 63 additions & 0 deletions .github/workflows/upload-pypi-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Upload Python package to PyPI and build/push Docker images.

on:
push:
branches:
- main
paths:
- "libs/core/**"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v2

# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

# Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -

# Configure Poetry with PyPI token
- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}

# Build and publish package to PyPI
- name: Build and publish to PyPI
working-directory: ./libs/core
run: |
poetry build
poetry publish

# Extract the new version number from pyproject.toml
- name: Extract version for tagging Docker image
working-directory: ./libs/core
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV

# Wait for the package to become available on PyPI
- name: Wait for PyPI to update
run: |
echo "Checking for llmstudio-core==${{ env.VERSION }} on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio-core==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio-core==${{ env.VERSION }} is available on PyPI."
break
else
echo "Package llmstudio-core==${{ env.VERSION }} not available yet. Waiting 15 seconds..."
sleep 15
fi
if [ $i -eq 10 ]; then
echo "Package did not become available in time."
exit 1
fi
done
60 changes: 36 additions & 24 deletions .github/workflows/upload-pypi-dev.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,72 @@
name: Upload Python package to PyPI as dev release and build/push Docker image.

on:
workflow_dispatch:
inputs:
library:
required: true
type: choice
description: Choose the library to deploy
options:
- llmstudio
- llmstudio-core
- llmstudio-proxy
- llmstudio-tracker

jobs:
deploy:
runs-on: ubuntu-latest
env:
MODULE_PATH: |
${{
inputs.library == 'llmstudio' && 'libs/llmstudio' ||
inputs.library == 'llmstudio-core' && 'libs/core' ||
inputs.library == 'llmstudio-proxy' && 'libs/proxy' ||
inputs.library == 'llmstudio-tracker' && 'libs/tracker'
}}
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: develop
token: ${{ secrets.GH_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
run: curl -sSL https://install.python-poetry.org | python3 -

- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}

- name: Build and publish to PyPI as development release
working-directory: ${{ env.MODULE_PATH }}
run: |
poetry version prerelease
poetry build
poetry publish

- name: Commit and push updated pyproject.toml
working-directory: ${{ env.MODULE_PATH }}
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add pyproject.toml
git commit -m "[fix] bump prerelease version in pyproject.toml"
git push

# Wait for PyPI to update
- name: Wait for PyPI to update
working-directory: ${{ env.MODULE_PATH }}
run: |
VERSION=$(poetry version --short)
echo "Checking for llmstudio==$VERSION on PyPI..."
echo "Checking for ${{ github.event.inputs.library }}==$VERSION on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio==${VERSION} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio==${VERSION} is available on PyPI."
if python -m pip install ${{ github.event.inputs.library }}==${VERSION} --dry-run >/dev/null 2>&1; then
echo "Package ${{ github.event.inputs.library }}==${VERSION} is available on PyPI."
break
else
echo "Package llmstudio==${VERSION} not available yet. Waiting 15 seconds..."
echo "Package ${{ github.event.inputs.library }}==${VERSION} not available yet. Waiting 15 seconds..."
sleep 15
fi
if [ $i -eq 10 ]; then
Expand All @@ -59,7 +75,6 @@ jobs:
fi
done

# Docker build and push section
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -70,18 +85,15 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract version for tagging Docker image
working-directory: ${{ env.MODULE_PATH }}
id: get_version
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
run: echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV

- name: Build and tag Docker image
- name: Build Docker images
working-directory: ./deploy
run: |
docker build \
--build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \
-t tensoropsai/llmstudio:${{ env.VERSION }} \
.
make version=${{ env.VERSION }} build-${{ github.event.inputs.library }}

- name: Push Docker image to Docker Hub
- name: Push Docker images
run: |
docker push tensoropsai/llmstudio:${{ env.VERSION }}

docker push tensoropsai/${{ github.event.inputs.library }}:${{ env.VERSION }}
63 changes: 63 additions & 0 deletions .github/workflows/upload-pypi-proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Upload Python package to PyPI and build/push Docker images.

on:
push:
branches:
- main
paths:
- "libs/proxy/**"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v2

# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

# Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -

# Configure Poetry with PyPI token
- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}

# Build and publish package to PyPI
- name: Build and publish to PyPI
working-directory: ./libs/proxy
run: |
poetry build
poetry publish

# Extract the new version number from pyproject.toml
- name: Extract version for tagging Docker image
working-directory: ./libs/proxy
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV

# Wait for the package to become available on PyPI
- name: Wait for PyPI to update
run: |
echo "Checking for llmstudio-proxy==${{ env.VERSION }} on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio-proxy==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio-proxy==${{ env.VERSION }} is available on PyPI."
break
else
echo "Package llmstudio-proxy==${{ env.VERSION }} not available yet. Waiting 15 seconds..."
sleep 15
fi
if [ $i -eq 10 ]; then
echo "Package did not become available in time."
exit 1
fi
done
63 changes: 63 additions & 0 deletions .github/workflows/upload-pypi-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Upload Python package to PyPI and build/push Docker images.

on:
push:
branches:
- main
paths:
- "libs/llmstudio/**"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v2

# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

# Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -

# Configure Poetry with PyPI token
- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}

# Build and publish package to PyPI
- name: Build and publish to PyPI
working-directory: ./libs/llmstudio
run: |
poetry build
poetry publish

# Extract the new version number from pyproject.toml
- name: Extract version for tagging Docker image
working-directory: ./libs/llmstudio
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV

# Wait for the package to become available on PyPI
- name: Wait for PyPI to update
run: |
echo "Checking for llmstudio==${{ env.VERSION }} on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio==${{ env.VERSION }} is available on PyPI."
break
else
echo "Package llmstudio==${{ env.VERSION }} not available yet. Waiting 15 seconds..."
sleep 15
fi
if [ $i -eq 10 ]; then
echo "Package did not become available in time."
exit 1
fi
done
Loading
Loading