[setup] fixed nightly release (#5388)

pull/5403/head
Frank Lee 9 months ago committed by GitHub
parent bf34c6fef6
commit dcdd8a5ef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -6,11 +6,13 @@ on:
- cron: '0 0 * * 6' # release on every Sunday 00:00 UTC time - cron: '0 0 * * 6' # release on every Sunday 00:00 UTC time
jobs: jobs:
build-n-publish: publish:
if: github.repository == 'hpcaitech/ColossalAI' if: github.repository == 'hpcaitech/ColossalAI'
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
outputs:
status: ${{ steps.publish.outcome }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -18,7 +20,9 @@ jobs:
with: with:
python-version: '3.8.14' python-version: '3.8.14'
- run: NIGHTLY=1 python setup.py sdist build - run: |
python .github/workflows/scripts/update_setup_for_nightly.py
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
@ -31,7 +35,7 @@ jobs:
notify: notify:
name: Notify Lark via webhook name: Notify Lark via webhook
needs: build-n-publish needs: publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() }} && github.repository == 'hpcaitech/ColossalAI' if: ${{ always() }} && github.repository == 'hpcaitech/ColossalAI'
steps: steps:
@ -62,4 +66,4 @@ jobs:
REPO: ${{ github.repository }} REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }} RUN_ID: ${{ github.run_id }}
WEBHOOK_URL: ${{ secrets.LARK_NOTIFICATION_WEBHOOK_URL }} WEBHOOK_URL: ${{ secrets.LARK_NOTIFICATION_WEBHOOK_URL }}
STATUS: ${{ steps.publish.outcome }} STATUS: ${{ needs.publish.outputs.status }}

@ -0,0 +1,34 @@
from datetime import datetime
def open_setup_file():
with open("setup.py", "r") as f:
file_lines = f.readlines()
return file_lines
def replace_nightly_package_info(file_lines):
version = datetime.today().strftime("%Y.%m.%d")
package_name = "colossalai-nightly"
for idx, line in enumerate(file_lines):
if "version = get_version()" in line:
file_lines[idx] = f'version = "{version}"\n'
if 'package_name = "colossalai"' in line:
file_lines[idx] = f'package_name = "{package_name}"\n'
return file_lines
def write_setup_file(file_lines):
with open("setup.py", "w") as f:
f.writelines(file_lines)
def main():
file_lines = open_setup_file()
file_lines = replace_nightly_package_info(file_lines)
write_setup_file(file_lines)
if __name__ == "__main__":
main()

@ -1,6 +1,5 @@
import os import os
import sys import sys
from datetime import datetime
from typing import List from typing import List
from setuptools import find_packages, setup from setuptools import find_packages, setup
@ -15,7 +14,6 @@ except ImportError:
THIS_DIR = os.path.dirname(os.path.abspath(__file__)) THIS_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_EXT = int(os.environ.get("BUILD_EXT", "0")) == 1 BUILD_EXT = int(os.environ.get("BUILD_EXT", "0")) == 1
IS_NIGHTLY = int(os.environ.get("NIGHTLY", "0")) == 1
# we do not support windows currently # we do not support windows currently
if sys.platform == "win32": if sys.platform == "win32":
@ -96,23 +94,15 @@ if BUILD_EXT:
else: else:
ext_modules = [] ext_modules = []
# always put not nightly branch as the if branch version = get_version()
# otherwise github will treat colossalai-nightly as the project name package_name = "colossalai"
# and it will mess up with the dependency graph insights
if not IS_NIGHTLY:
version = get_version()
package_name = "colossalai"
else:
# use date as the nightly version
version = datetime.today().strftime("%Y.%m.%d")
package_name = "colossalai-nightly"
setup( setup(
name=package_name, name=package_name,
version=version, version=version,
packages=find_packages( packages=find_packages(
exclude=( exclude=(
"op_builder", "extensions",
"benchmark", "benchmark",
"docker", "docker",
"tests", "tests",

Loading…
Cancel
Save