Skip to content

Commit

Permalink
[Release] added workflow to publish whls to PyPI (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
guocuimi authored May 17, 2024
1 parent e87fdd4 commit 4940a6e
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,5 @@ jobs:
tag_name: ${{ inputs.tag }}
draft: true
prerelease: true

# - name: Upload to pypi
# run: |
# pip install twine
# python -m twine upload --repository testpypi python/dist/scalellm-*.tar.gz
# env:
# TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }}


83 changes: 83 additions & 0 deletions .github/workflows/publish_whl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Release wheel
on:
workflow_dispatch:
env:
# Tells where to store caches.
CI_CACHE_DIR: ${{ github.workspace }}/../../ci_cache

jobs:
build_wheel:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
cuda: ["12.1"]
torch: ["2.3"]
runs-on: [self-hosted, linux, release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build wheel
run: |
docker pull vectorchai/scalellm_manylinux:cuda${{ matrix.cuda }}
docker run --rm -t \
-v "$CI_CACHE_DIR":/ci_cache \
-v "$GITHUB_WORKSPACE":/ScaleLLM \
-e PYTHON_VERSION=${{ matrix.python }} \
-e CUDA_VERSION=${{ matrix.cuda }} \
-e TORCH_VERSION=${{ matrix.torch }} \
-e VCPKG_DEFAULT_BINARY_CACHE=/ci_cache/.vcpkg/bincache \
-e CCACHE_DIR=/ci_cache/.ccache \
--user $(id -u):$(id -g) \
vectorchai/scalellm_manylinux:cuda${{ matrix.cuda }} \
bash /ScaleLLM/scripts/build_wheel.sh
timeout-minutes: 60

- name: show wheels
run: ls -lh python/dist

- name: rename wheel to manylinux
run: |
for whl in python/dist/scalellm-*.whl; do
new_whl=${whl//"-linux_"/"-manylinux_2_28_"}
if [ "$whl" != "$new_whl" ]; then
mv $whl $new_whl
fi
done
- name: show wheels
run: ls -lh python/dist

- uses: actions/upload-artifact@v4
with:
name: wheel-cuda${{ matrix.cuda }}-torch${{ matrix.torch }}-python${{ matrix.python }}
path: python/dist/*

publish_whl:
needs: build_wheel
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download wheel
uses: actions/download-artifact@v4
with:
path: python/dist
merge-multiple: true
pattern: wheel-*

- name: Show wheels
run: ls -lh python/dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
packages-dir: python/dist/
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
verbose: true


0 comments on commit 4940a6e

Please sign in to comment.