Browse Source

[workflow] added test-pypi check before release (#2591)

* [workflow] added test-pypi check before release

* polish code
pull/2594/head
Frank Lee 2 years ago committed by GitHub
parent
commit
d6cc8f313e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      .github/workflows/release_nightly_on_schedule.yml
  2. 4
      .github/workflows/release_pypi_after_merge.yml
  3. 52
      .github/workflows/release_test_pypi_before_merge.yml

0
.github/workflows/release_nightly.yml → .github/workflows/release_nightly_on_schedule.yml

4
.github/workflows/release_pypi.yml → .github/workflows/release_pypi_after_merge.yml

@ -10,7 +10,7 @@ on:
jobs: jobs:
build-n-publish: build-n-publish:
if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI' && github.event.pull_request.merged == true && github.base_ref == 'main' if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI' && github.event.pull_request.merged == true && github.base_ref == 'main'
name: Build and publish Python 🐍 distributions 📦 to PyPI name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 20 timeout-minutes: 20
@ -22,7 +22,7 @@ jobs:
python-version: '3.8.14' python-version: '3.8.14'
- run: python setup.py sdist build - run: python setup.py sdist build
# publish to PyPI if executed on the main branch # publish to PyPI if executed on the main branch
- name: Publish package to PyPI - name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1

52
.github/workflows/release_test_pypi_before_merge.yml

@ -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'
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 60s
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==$VERSION
env:
VERSION: ${{ steps.prep-version.outputs.version }}
Loading…
Cancel
Save