From af8b402208c19126dac5cf631237acd1e2369e81 Mon Sep 17 00:00:00 2001 From: FrankLeeeee Date: Mon, 6 Feb 2023 15:23:28 +0800 Subject: [PATCH 1/2] [workflow] added test-pypi check before release --- ...ly.yml => release_nightly_on_schedule.yml} | 0 ..._pypi.yml => release_pypi_after_merge.yml} | 4 +- .../release_test_pypi_before_merge.yml | 52 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) rename .github/workflows/{release_nightly.yml => release_nightly_on_schedule.yml} (100%) rename .github/workflows/{release_pypi.yml => release_pypi_after_merge.yml} (94%) create mode 100644 .github/workflows/release_test_pypi_before_merge.yml diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly_on_schedule.yml similarity index 100% rename from .github/workflows/release_nightly.yml rename to .github/workflows/release_nightly_on_schedule.yml diff --git a/.github/workflows/release_pypi.yml b/.github/workflows/release_pypi_after_merge.yml similarity index 94% rename from .github/workflows/release_pypi.yml rename to .github/workflows/release_pypi_after_merge.yml index 7f3f63cf31f3..797cd69f373e 100644 --- a/.github/workflows/release_pypi.yml +++ b/.github/workflows/release_pypi_after_merge.yml @@ -10,7 +10,7 @@ on: jobs: 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 runs-on: ubuntu-latest timeout-minutes: 20 @@ -22,7 +22,7 @@ jobs: 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 uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release_test_pypi_before_merge.yml b/.github/workflows/release_test_pypi_before_merge.yml new file mode 100644 index 000000000000..367bff9e1f30 --- /dev/null +++ b/.github/workflows/release_test_pypi_before_merge.yml @@ -0,0 +1,52 @@ +name: Publish to Test-PyPI + +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 }} From 4c2245009751a509826a8e88c2bb7332d6ed8b96 Mon Sep 17 00:00:00 2001 From: FrankLeeeee Date: Mon, 6 Feb 2023 15:40:55 +0800 Subject: [PATCH 2/2] polish code --- .github/workflows/release_test_pypi_before_merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_test_pypi_before_merge.yml b/.github/workflows/release_test_pypi_before_merge.yml index 367bff9e1f30..f35a8aad0b62 100644 --- a/.github/workflows/release_test_pypi_before_merge.yml +++ b/.github/workflows/release_test_pypi_before_merge.yml @@ -1,4 +1,4 @@ -name: Publish to Test-PyPI +name: Publish to Test-PyPI Before Merge on: pull_request: