diff --git a/.github/workflows/aipu-delivery.yml b/.github/workflows/aipu-delivery.yml index c6d60428d..f95b15cb8 100644 --- a/.github/workflows/aipu-delivery.yml +++ b/.github/workflows/aipu-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -85,6 +90,7 @@ jobs: source ~/env_setup.sh # aipu cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/ascend-delivery.yml b/.github/workflows/ascend-delivery.yml index 60f63051f..ec3c7afc2 100644 --- a/.github/workflows/ascend-delivery.yml +++ b/.github/workflows/ascend-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'aarch64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'aarch64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -84,6 +89,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/enflame-gcu300-delivery.yml b/.github/workflows/enflame-gcu300-delivery.yml index 31a4cd9c8..102731069 100644 --- a/.github/workflows/enflame-gcu300-delivery.yml +++ b/.github/workflows/enflame-gcu300-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -83,6 +88,7 @@ jobs: fi rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=4 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree # enflame-gcu300 env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/enflame-gcu400-delivery.yml b/.github/workflows/enflame-gcu400-delivery.yml index 9a4005b46..6f1a0b8a7 100644 --- a/.github/workflows/enflame-gcu400-delivery.yml +++ b/.github/workflows/enflame-gcu400-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -68,7 +73,7 @@ jobs: run: | set -x TRITON_VER="3.5" - CHIP=".gcu400." + CHIP="" export FLAGTREE_BACKEND=enflame WHL_VER=${{ inputs.WHL_VER }} PYTHON_VER=${{ inputs.PYTHON_VER }} @@ -83,6 +88,7 @@ jobs: fi rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/hcu-delivery.yml b/.github/workflows/hcu-delivery.yml index d535cb710..330d7bbea 100644 --- a/.github/workflows/hcu-delivery.yml +++ b/.github/workflows/hcu-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -84,6 +89,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/hopper-delivery.yml b/.github/workflows/hopper-delivery.yml index 63fa22960..e99ba1c86 100644 --- a/.github/workflows/hopper-delivery.yml +++ b/.github/workflows/hopper-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -84,6 +89,7 @@ jobs: fi rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true @@ -109,6 +115,7 @@ jobs: fi rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true @@ -134,6 +141,7 @@ jobs: fi rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/iluvatar-delivery.yml b/.github/workflows/iluvatar-delivery.yml index 7165cd576..143db921a 100644 --- a/.github/workflows/iluvatar-delivery.yml +++ b/.github/workflows/iluvatar-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -84,6 +89,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/metax-delivery.yml b/.github/workflows/metax-delivery.yml index a795d203a..aa2b58445 100644 --- a/.github/workflows/metax-delivery.yml +++ b/.github/workflows/metax-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -85,6 +90,7 @@ jobs: source ~/env_setup.sh # metax cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/mthreads-delivery.yml b/.github/workflows/mthreads-delivery.yml index 548facf5f..621f981ac 100644 --- a/.github/workflows/mthreads-delivery.yml +++ b/.github/workflows/mthreads-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -84,6 +89,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/nv-delivery.yml b/.github/workflows/nv-delivery.yml index 321a91d4a..6d3080a47 100644 --- a/.github/workflows/nv-delivery.yml +++ b/.github/workflows/nv-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -85,6 +90,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true @@ -111,6 +117,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true @@ -137,6 +144,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/sunrise-delivery.yml b/.github/workflows/sunrise-delivery.yml index 23aa51388..e9b9ba424 100644 --- a/.github/workflows/sunrise-delivery.yml +++ b/.github/workflows/sunrise-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -86,6 +91,7 @@ jobs: export TRITON_OFFLINE_BUILD=1 # sunrise export TRITON_BUILD_PROTON=OFF # sunrise rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/.github/workflows/tsingmicro-delivery.yml b/.github/workflows/tsingmicro-delivery.yml index fabc40b33..d2a452c55 100644 --- a/.github/workflows/tsingmicro-delivery.yml +++ b/.github/workflows/tsingmicro-delivery.yml @@ -16,6 +16,8 @@ on: PLATFORM: required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + required: false workflow_call: inputs: WHL_VER: @@ -30,6 +32,9 @@ on: type: string required: true default: 'x86_64' + FLAGTREE_PYPI_KEY: + type: string + required: false concurrency: group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }} @@ -84,6 +89,7 @@ jobs: cd python rm -rf ./build ./*.egg-info + { export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true diff --git a/python/setup.py b/python/setup.py index 56741dcaf..89d9dcb2a 100644 --- a/python/setup.py +++ b/python/setup.py @@ -650,13 +650,26 @@ def get_git_commit_hash(length=8): return "" +def get_flagtree_version(): + import hashlib + PYPI_KEY_MD5 = "ed98ae2a2ba0429b189537c0d3dbef43" + key = os.environ.get("FLAGTREE_PYPI_KEY", "") + flagtree_ver = os.environ.get("FLAGTREE_WHEEL_VERSION", "") + if flagtree_ver: + if hashlib.md5(key.encode()).hexdigest() == PYPI_KEY_MD5: + return flagtree_ver + else: + return flagtree_ver + get_git_commit_hash().replace("+", ".") + return "0.5.0" + get_git_commit_hash() + + readme_path = os.path.join(get_base_dir(), "README.md") with open(readme_path, "r", encoding="utf-8") as fh: long_description = fh.read() setup( name=os.environ.get("FLAGTREE_WHEEL_NAME", "flagtree"), - version=os.environ.get("FLAGTREE_WHEEL_VERSION", "") or "0.5.0" + get_git_commit_hash(), + version=get_flagtree_version(), author="FlagOS", author_email="contact@flagos.io", description=