Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
[CI/CD] Store version number in alpa._version__ (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
merrymercy authored Jul 23, 2022
1 parent 504e770 commit 5afa57b
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 170 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/release_alpa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,3 @@ jobs:
echo "Publish to PyPI"
ls -ltr dist/
python -m twine upload --verbose dist/*
update-version:
runs-on: [ubuntu-latest]
needs: [release-alpa]
steps:
- uses: actions/checkout@v3

- name: Bump VERSION and commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout -b actions/version-bump
cat VERSION | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}' > VERSION.tmp && mv VERSION.tmp VERSION
git add VERSION
git commit -m "Bump candidate version [skip ci]"
- name: Push branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT_TOKEN }}
branch: actions/version-bump
force: true

- name: Create version-bump PR
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.PAT_TOKEN }}
source_branch: "actions/version-bump"
destination_branch: "main"
pr_title: "Bumping VERSION file due to recent release"
pr_body: "*Automated PR*: This should update the candidate version. Please delete source branch upon merge"
130 changes: 0 additions & 130 deletions GENVER

This file was deleted.

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 1 addition & 0 deletions alpa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from alpa.shard_parallel.auto_sharding import AutoShardingOption
from alpa.serialization import save_checkpoint, restore_checkpoint
from alpa.timer import timers
from alpa.version import __version__

from . import api
from . import collective
Expand Down
3 changes: 3 additions & 0 deletions alpa/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Version information."""

__version__ = "1.0.0.dev0"
2 changes: 1 addition & 1 deletion docker/scripts/build_alpa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ git fetch origin +${ALPA_BRANCH}
git checkout -qf FETCH_HEAD

# install jaxlib and jax
export VERSION=$(bash GENVER --pep440)
python3 update_version.py --git-describe
python3 setup.py bdist_wheel

if ! python3 -m auditwheel show dist/alpa-*.whl | egrep 'platform tag: "(manylinux2014_x86_64|manylinux_2_17_x86_64)"' > /dev/null; then
Expand Down
19 changes: 15 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,22 @@
# -- Project information -----------------------------------------------------

project = 'Alpa'
#copyright = '2022, <Author>'
#author = '<Author>'
author = 'Alpa Developers'
copyright = f'2022, {author}'

# The full version, including alpha/beta/rc tags
release = '0.1.4'

def git_describe_version():
"""Get git describe version."""
ver_py = os.path.join("..", "update_version.py")
libver = {"__file__": ver_py}
exec(compile(open(ver_py, "rb").read(), ver_py, "exec"), libver, libver)
gd_version, _ = libver["git_describe_version"]()
return gd_version


import alpa
version = git_describe_version()
release = version


# -- General configuration ---------------------------------------------------
Expand Down
18 changes: 15 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import glob
import os
import re
import shutil
import subprocess
import sys

from setuptools import setup, find_packages

IS_WINDOWS = sys.platform == "win32"
ROOT_DIR = os.path.dirname(__file__)


def get_cuda_version(cuda_home):
Expand Down Expand Up @@ -98,6 +100,16 @@ def get_cuda_version_str(no_dot=False):
]


def get_alpa_version():
with open(os.path.join(ROOT_DIR, "alpa", "version.py")) as fp:
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", fp.read(), re.M
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


def build():
"""Build the custom pipeline marker API."""
# Check cuda version
Expand Down Expand Up @@ -169,13 +181,13 @@ def finalize_options(self):
if self.distribution.has_ext_modules():
self.install_lib = self.install_platlib

with open(os.path.join("README.md"), encoding="utf-8") as f:
with open("README.md", encoding="utf-8") as f:
long_description = f.read()

setup(
name="alpa",
version=os.environ.get("VERSION"),
author="Alpa team",
version=get_alpa_version(),
author="Alpa Developers",
author_email="",
description=
"Alpa automatically parallelizes large tensor computation graphs and "
Expand Down
Loading

0 comments on commit 5afa57b

Please sign in to comment.