Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Fix release bug #3585

Merged
merged 4 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
docker create --user dev --name taichi_test --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix registry.taichigraphics.com/taichidev-ubuntu18.04:v0.1.1 /home/dev/unix_docker_test.sh $PY $GPU_TEST
docker cp .github/workflows/scripts/unix_docker_test.sh taichi_test:/home/dev/unix_docker_test.sh
docker cp wheel/*.whl taichi_test:/home/dev/
docker cp ./requirements_test.txt taichi_test:/home/dev/requirements_test.txt
docker cp tests/ taichi_test:/home/dev/
docker start -a taichi_test
env:
Expand All @@ -105,7 +106,7 @@ jobs:
mkdir dist
cp wheel/*.whl dist/
pip install twine requests==2.26
python misc/upload_release.py
python3 misc/upload_release.py

- name: clean docker container
if: always()
Expand Down
27 changes: 15 additions & 12 deletions misc/upload_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,28 @@ def upload_taichi_version():
timeout=5)
response.raise_for_status()
except requests.exceptions.ConnectionError as err:
sys.exit('Updating latest version failed: No internet,', err)
sys.exit('Updating latest version failed: No internet, ' +
err.toString())
except requests.exceptions.HTTPError as err:
sys.exit('Updating latest version failed: Server error,', err)
sys.exit('Updating latest version failed: Server error, ' +
err.toString())
except requests.exceptions.Timeout as err:
sys.exit(
'Updating latest version failed: Time out when connecting server,',
err)
'Updating latest version failed: Time out when connecting server, '
+ err.toString())
except requests.exceptions.RequestException as err:
sys.exit('Updating latest version failed:', err)
sys.exit('Updating latest version failed: ' + err.toString())
response = response.json()
print(response['message'])


def upload_artifact():
is_nightly = os.getenv('PROJECT_NAME', 'taichi') == 'taichi'
pwd_env = 'PROD_PWD' if is_nightly else 'NIGHT_PWD'
def upload_artifact(is_taichi):
pwd_env = 'PROD_PWD' if is_taichi else 'NIGHT_PWD'
twine_password = os.getenv(pwd_env)
if not twine_password:
sys.exit(f'Missing password env var {pwd_env}')
command = ["twine", "upload"]
if is_nightly:
command = ["python", "-m", "twine", "upload"]
if is_taichi:
command.extend(['--repository', 'testpypi'])
command.extend(
['--verbose', '-u', '__token__', '-p', twine_password, 'dist/*'])
Expand All @@ -51,5 +52,7 @@ def upload_artifact():


if __name__ == '__main__':
upload_taichi_version()
upload_artifact()
is_taichi = os.getenv('PROJECT_NAME', 'taichi') == 'taichi'
if is_taichi:
upload_taichi_version()
upload_artifact(is_taichi)