From e6445af2cd2a8b7d1ec3c5c43404182a863a1599 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Mon, 14 Dec 2020 20:00:58 +0100 Subject: [PATCH] cibuild: cleanup outdated providers --- release/cibuild.py | 38 ------------------------ test/conftest.py | 12 +------- test/release/test_cibuild.py | 57 +++++++----------------------------- 3 files changed, 12 insertions(+), 95 deletions(-) diff --git a/release/cibuild.py b/release/cibuild.py index 3af43e966..9317e3cfe 100755 --- a/release/cibuild.py +++ b/release/cibuild.py @@ -51,12 +51,6 @@ class BuildEnviron: *, system="", root_dir="", - travis_tag="", - travis_branch="", - travis_pull_request="", - appveyor_repo_tag_name="", - appveyor_repo_branch="", - appveyor_pull_request_number="", github_ref="", github_event_name="", should_build_wheel=False, @@ -72,25 +66,11 @@ class BuildEnviron: self.system = system self.root_dir = root_dir - self.travis_tag = travis_tag - self.travis_branch = travis_branch - - if travis_tag and travis_tag != travis_branch: - raise ValueError( - f"Something is wrong - TRAVIS_TAG={travis_tag}, but TRAVIS_BRANCH={travis_branch}" - ) - - self.travis_pull_request = travis_pull_request - self.should_build_wheel = should_build_wheel self.should_build_docker = should_build_docker self.should_build_pyinstaller = should_build_pyinstaller self.should_build_wininstaller = should_build_wininstaller - self.appveyor_repo_tag_name = appveyor_repo_tag_name - self.appveyor_repo_branch = appveyor_repo_branch - self.appveyor_pull_request_number = appveyor_pull_request_number - self.github_ref = github_ref self.github_event_name = github_event_name @@ -105,12 +85,6 @@ class BuildEnviron: return cls( system=platform.system(), root_dir=os.path.normpath(os.path.join(os.path.dirname(__file__), "..")), - travis_tag=os.environ.get("TRAVIS_TAG", ""), - travis_branch=os.environ.get("TRAVIS_BRANCH", ""), - travis_pull_request=os.environ.get("TRAVIS_PULL_REQUEST"), - appveyor_repo_tag_name=os.environ.get("APPVEYOR_REPO_TAG_NAME", ""), - appveyor_repo_branch=os.environ.get("APPVEYOR_REPO_BRANCH", ""), - appveyor_pull_request_number=os.environ.get("APPVEYOR_PULL_REQUEST_NUMBER", ""), github_ref=os.environ.get("GITHUB_REF", ""), github_event_name=os.environ.get("GITHUB_EVENT_NAME", ""), should_build_wheel=bool_from_env("CI_BUILD_WHEEL"), @@ -156,10 +130,6 @@ class BuildEnviron: @property def branch(self) -> str: - if self.travis_branch: - return self.travis_branch - if self.appveyor_repo_branch: - return self.appveyor_repo_branch if self.github_ref and self.github_ref.startswith("refs/heads/"): return self.github_ref.replace("refs/heads/", "") if self.github_ref and self.github_ref.startswith("refs/pull/"): @@ -256,10 +226,6 @@ class BuildEnviron: def is_pull_request(self) -> bool: if self.github_event_name == "pull_request": return True - if self.appveyor_pull_request_number: - return True - if self.travis_pull_request and self.travis_pull_request != "false": - return True return False @property @@ -297,10 +263,6 @@ class BuildEnviron: @property def tag(self) -> str: - if self.travis_tag: - return self.travis_tag - if self.appveyor_repo_tag_name: - return self.appveyor_repo_tag_name if self.github_ref and self.github_ref.startswith("refs/tags/"): return self.github_ref.replace("refs/tags/", "") return "" diff --git a/test/conftest.py b/test/conftest.py index 5ce4b6f37..27ab2f2bf 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,7 +1,7 @@ import os import socket -from mitmproxy.utils import data, compat +from mitmproxy.utils import data import pytest @@ -17,16 +17,6 @@ skip_not_windows = pytest.mark.skipif( reason='Skipping due to not Windows' ) -skip_appveyor = pytest.mark.skipif( - "APPVEYOR" in os.environ, - reason='Skipping due to Appveyor' -) - -skip_new_proxy_core = pytest.mark.skipif( - compat.new_proxy_core, - reason='Skipping legacy test for old proxy core' -) - try: s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) s.bind(("::1", 0)) diff --git a/test/release/test_cibuild.py b/test/release/test_cibuild.py index 3831e78f3..d826c3615 100644 --- a/test/release/test_cibuild.py +++ b/test/release/test_cibuild.py @@ -15,7 +15,7 @@ def test_buildenviron_common(): be = cibuild.BuildEnviron( system="Linux", root_dir="/foo", - travis_branch="master", + github_ref="refs/heads/master", ) assert be.release_dir == os.path.join(be.root_dir, "release") assert be.dist_dir == os.path.join(be.root_dir, "release", "dist") @@ -36,22 +36,12 @@ def test_buildenviron_common(): with pytest.raises(cibuild.BuildError): be.platform_tag - with pytest.raises(ValueError, match="TRAVIS_TAG"): - be = cibuild.BuildEnviron( - system="Linux", - root_dir="/foo", - travis_tag="one", - travis_branch="two", - ) - def test_buildenviron_pr(): # Simulates a PR. We build everything, but don't have access to secret # credential env variables. be = cibuild.BuildEnviron( - travis_tag="", - travis_branch="master", - travis_pull_request="true", + github_event_name="pull_request", should_build_wheel=True, should_build_pyinstaller=True, should_build_docker=True, @@ -60,24 +50,6 @@ def test_buildenviron_pr(): def test_ci_systems(): - appveyor = cibuild.BuildEnviron( - appveyor_pull_request_number="1234", - appveyor_repo_branch="foo", - appveyor_repo_tag_name="qux", - ) - assert appveyor.is_pull_request - assert appveyor.branch == "foo" - assert appveyor.tag == "qux" - - travis = cibuild.BuildEnviron( - travis_pull_request="1234", - travis_branch="foo", - travis_tag="foo", - ) - assert travis.is_pull_request - assert travis.branch == "foo" - assert travis.tag == "foo" - github = cibuild.BuildEnviron( github_event_name="pull_request", github_ref="refs/heads/master" @@ -121,8 +93,7 @@ def test_buildenviron_releasetag(): be = cibuild.BuildEnviron( system="Linux", root_dir="/foo", - travis_tag="v0.0.1", - travis_branch="v0.0.1", + github_ref="refs/tags/v0.0.1", should_build_wheel=True, should_build_docker=True, should_build_pyinstaller=True, @@ -131,7 +102,7 @@ def test_buildenviron_releasetag(): docker_password="bar", ) assert be.tag == "v0.0.1" - assert be.branch == "v0.0.1" + assert be.branch == "" assert be.version == "0.0.1" assert be.upload_dir == "0.0.1" assert be.docker_tag == "mitmproxy/mitmproxy:0.0.1" @@ -146,8 +117,7 @@ def test_buildenviron_namedtag(): be = cibuild.BuildEnviron( system="Linux", root_dir="/foo", - travis_tag="anyname", - travis_branch="anyname", + github_ref="refs/tags/anyname", should_build_wheel=True, should_build_docker=True, should_build_pyinstaller=True, @@ -156,7 +126,7 @@ def test_buildenviron_namedtag(): docker_password="bar", ) assert be.tag == "anyname" - assert be.branch == "anyname" + assert be.branch == "" assert be.version == "anyname" assert be.upload_dir == "anyname" assert be.docker_tag == "mitmproxy/mitmproxy:anyname" @@ -171,8 +141,7 @@ def test_buildenviron_dev_branch(): be = cibuild.BuildEnviron( system="Linux", root_dir="/foo", - travis_tag="", - travis_branch="mybranch", + github_ref="refs/heads/mybranch", should_build_wheel=True, should_build_docker=True, should_build_pyinstaller=True, @@ -194,8 +163,7 @@ def test_buildenviron_maintenance_branch(): be = cibuild.BuildEnviron( system="Linux", root_dir="/foo", - travis_tag="", - travis_branch="v0.x", + github_ref="refs/heads/v0.x", should_build_wheel=True, should_build_docker=True, should_build_pyinstaller=True, @@ -216,8 +184,7 @@ def test_buildenviron_osx(tmpdir): be = cibuild.BuildEnviron( system="Darwin", root_dir="/foo", - travis_tag="0.0.1", - travis_branch="0.0.1", + github_ref="refs/tags/v0.0.1", ) assert be.platform_tag == "osx" assert be.bdists == { @@ -234,8 +201,7 @@ def test_buildenviron_windows(tmpdir): be = cibuild.BuildEnviron( system="Windows", root_dir="/foo", - travis_tag="v0.0.1", - travis_branch="v0.0.1", + github_ref="refs/tags/v0.0.1", ) assert be.platform_tag == "windows" assert be.bdists == { @@ -263,8 +229,7 @@ def test_buildenviron_check_version(version, tag, ok, tmpdir): be = cibuild.BuildEnviron( root_dir=tmpdir, - travis_tag=tag, - travis_branch=tag or "branch", + github_ref=f"refs/tags/{tag}", ) if ok: be.check_version()