cibuild: start building version awareness

This commit is contained in:
Aldo Cortesi 2018-05-25 10:50:48 +12:00
parent f55293611e
commit ff92962c51
4 changed files with 13 additions and 2 deletions

View File

@ -41,7 +41,6 @@ release for! The command examples assume that you have a git remote called
- Please check https://hub.docker.com/r/mitmproxy/mitmproxy/tags/ about the latest version
- Update `latest` tag: TODO write instructions
## Website
- Update version here:
https://github.com/mitmproxy/www/blob/master/src/config.toml

View File

@ -13,6 +13,7 @@ import zipfile
import click
import cryptography.fernet
import parver
@contextlib.contextmanager
@ -180,6 +181,14 @@ class BuildEnviron:
def has_docker_creds(self) -> bool:
return self.docker_username and self.docker_password
@property
def is_prod_release(self) -> bool:
try:
v = parver.Version.parse(self.version)
except (parver.ParseError, BuildError):
return False
return not v.is_prerelease
@property
def is_pull_request(self) -> bool:
if self.appveyor_pull_request_number:

View File

@ -89,6 +89,7 @@ setup(
"flake8>=3.5, <3.6",
"Flask>=1.0,<1.1",
"mypy>=0.590,<0.591",
"parver>=0.1<2.0",
"pytest-asyncio>=0.8",
"pytest-cov>=2.5.1,<3",
"pytest-faulthandler>=1.3.1,<2",

View File

@ -58,6 +58,7 @@ def test_buildenviron_pr():
appveyor_pull_request_number = "xxxx",
)
assert be.is_pull_request
assert not be.is_prod_release
def test_buildenviron_commit():
@ -77,6 +78,7 @@ def test_buildenviron_commit():
assert be.should_upload_docker
assert not be.should_upload_pypi
assert be.should_upload_docker
assert not be.is_prod_release
def test_buildenviron_rleasetag():
@ -102,7 +104,7 @@ def test_buildenviron_rleasetag():
assert be.docker_tag == "0.0.1"
assert be.should_upload_pypi
assert be.should_upload_docker
assert be.is_prod_release
def test_buildenviron_branch():
# Simulates a development branch on the main repo