Skip to content

Commit

Permalink
[workflow] added pypi/test-pypi release (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankLeeeee authored Aug 2, 2023
1 parent 48e1abc commit 7538e8a
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to PyPI

on:
workflow_dispatch:
pull_request:
paths:
- 'version.txt'
types:
- closed

jobs:
build-n-publish:
if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI-Platform-CLI' && github.event.pull_request.merged == true && github.base_ref == 'main'
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.8.14'

- run: python setup.py sdist build

# publish to PyPI if executed on the main branch
- name: Publish package to PyPI
id: publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
52 changes: 52 additions & 0 deletions .github/workflows/test_pypi_before_update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish to Test-PyPI Before Merge

on:
pull_request:
paths:
- 'version.txt'

jobs:
build-n-publish:
if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI-Platform-CLI'
name: Build and publish Python 🐍 distributions 📦 to Test PyPI
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.8.14'

- name: add timestamp to the version
id: prep-version
run: |
version=$(cat version.txt)
timestamp=$(date +%s)
new_version="${version}.post${timestamp}"
echo $new_version > ./version.txt
echo "version=$new_version" >> $GITHUB_OUTPUT
- run: python setup.py sdist build

# publish to PyPI if executed on the main branch
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
verbose: true

- name: Wait for Test-PyPI refresh
run: sleep 300s
shell: bash

- name: Try installation
run: |
# we need to install the requirements.txt first
# as test-pypi may not contain the distributions for libs listed in the txt file
pip install -r requirements/requirements.txt
pip install --index-url https://test.pypi.org/simple/ colossalai-platform-cli==$VERSION
env:
VERSION: ${{ steps.prep-version.outputs.version }}
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.txt README.md
recursive-include colossalai *.md *.json *.py Dockerfile *.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The CLI is built on top of [Click](https://click.palletsprojects.com/en/8.0.x/),
pip install git+https://github.com/hpcaitech/ColossalAI-Platform-CLI@main
```

2. From PyPI (**Not Available Yet**)
2. From PyPI
```bash
pip install colossalai-platform
```
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_project_files():


setup(
name='colossalai_platform',
name='colossalai-platform',
version=get_version(),
packages=find_packages(exclude=(
'build',
Expand Down Expand Up @@ -62,7 +62,7 @@ def get_project_files():
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: Apache Software License',
'Topic :: Cloud :: Command Line Tool',
'Topic :: System :: Distributed Computing',
'Topic :: Software Development :: Build Tools',
"Topic :: System :: Distributed Computing"
],
)

0 comments on commit 7538e8a

Please sign in to comment.