Skip to content

Commit

Permalink
Travis: Allow failures of -dev versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Nov 11, 2020
1 parent c9b38b2 commit e6aa2ec
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 22 deletions.
6 changes: 1 addition & 5 deletions repo_helper/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ def cli(ctx, force: bool, commit: Optional[bool], message: str):
ctx.obj["commit"] = commit
ctx.obj["force"] = force

ret = 0

if ctx.invoked_subcommand is None:
ret |= run_repo_helper(path=path, force=force, initialise=False, commit=commit, message=message)
sys.exit(run_repo_helper(path=path, force=force, initialise=False, commit=commit, message=message))

else:
if message != "Updated files with 'repo_helper'.":
Expand All @@ -82,8 +80,6 @@ def cli(ctx, force: bool, commit: Optional[bool], message: str):
f"Perhaps you meant 'repo_helper {ctx.invoked_subcommand} --message'?"
)

sys.exit(ret)


cli_command = partial(cli.command, context_settings=CONTEXT_SETTINGS)
cli_group = partial(cli.group, context_settings=CONTEXT_SETTINGS)
6 changes: 5 additions & 1 deletion repo_helper/files/ci_cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def make_travis(repo_path: pathlib.Path, templates: jinja2.Environment) -> List[
else:
travis = templates.get_template("travis_not_pure_python.yml")

PathPlus(repo_path / ".travis.yml").write_clean(travis.render())
python_versions = templates.globals["python_versions"]
no_dev_versions_ = no_dev_versions(python_versions)
dev_versions = [v for v in python_versions if v not in no_dev_versions_]

PathPlus(repo_path / ".travis.yml").write_clean(travis.render(dev_versions=dev_versions))

return [".travis.yml"]

Expand Down
2 changes: 1 addition & 1 deletion repo_helper/files/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def compile_target_requirements(self) -> None:
"seed_intersphinx_mapping": ">=0.1.1",
"default_values": ">=0.2.0",
"toctree_plus": ">=0.0.4",
"sphinx-toolbox": ">=1.7.1",
"sphinx-toolbox": ">=1.7.2",
}

for name, specifier in my_sphinx_extensions.items():
Expand Down
5 changes: 3 additions & 2 deletions repo_helper/templates/travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ stages:

jobs:
allow_failures:
- arch: arm64

- arch: arm64{% if dev_versions %}
- python: {{ dev_versions }}
{% endif %}
exclude:
{% for version in python_versions[1:] %}- python: '{{ version }}'
arch: arm64
Expand Down
25 changes: 22 additions & 3 deletions tests/test_files/test_ci_cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
from tests.common import check_file_output


def test_travis_case_1(tmp_pathplus, demo_environment, file_regression: FileRegressionFixture):
def test_make_travis_case_1(tmp_pathplus, demo_environment, file_regression: FileRegressionFixture):
managed_files = make_travis(tmp_pathplus, demo_environment)
assert managed_files == [".travis.yml"]
check_file_output(tmp_pathplus / managed_files[0], file_regression)


def test_travis_case_2(tmp_pathplus, demo_environment, file_regression):
def test_make_travis_case_2(tmp_pathplus, demo_environment, file_regression):
demo_environment.globals.update(
dict(
travis_ubuntu_version="bionic",
Expand All @@ -70,7 +70,7 @@ def test_travis_case_2(tmp_pathplus, demo_environment, file_regression):
@pytest.mark.parametrize("enable_conda", [True, False])
@pytest.mark.parametrize("enable_tests", [True, False])
@pytest.mark.parametrize("enable_releases", [True, False])
def test_travis_case_3(
def test_make_travis_case_3(
tmp_pathplus,
demo_environment,
file_regression,
Expand All @@ -93,6 +93,25 @@ def test_travis_case_3(
check_file_output(tmp_pathplus / managed_files[0], file_regression)


def test_make_travis_case_4(tmp_pathplus, demo_environment, file_regression):
demo_environment.globals.update(
dict(
travis_ubuntu_version="bionic",
travis_extra_install_pre=["sudo apt update"],
travis_extra_install_post=["sudo apt install python3-gi"],
travis_additional_requirements=["isort", "black"],
enable_tests=False,
enable_conda=False,
enable_releases=False,
python_versions=["3.6", "3.7", "3.8", "3.9", "3.10-dev"],
)
)

managed_files = make_travis(tmp_pathplus, demo_environment)
assert managed_files == [".travis.yml"]
check_file_output(tmp_pathplus / managed_files[0], file_regression)


def test_travis_deploy_conda(tmp_pathplus, demo_environment, file_regression: FileRegressionFixture):
managed_files = make_travis_deploy_conda(tmp_pathplus, demo_environment)
assert managed_files == [".ci/travis_deploy_conda.sh"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ stages:
jobs:
allow_failures:
- arch: arm64

exclude:
- python: '3.7'
arch: arm64
Expand Down
66 changes: 66 additions & 0 deletions tests/test_files/test_ci_cd_/test_make_travis_case_4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This file is managed by 'repo_helper'. Don't edit it directly.
---

language: python
dist: bionic
cache: pip
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10-dev'

arch:
- amd64
- arm64
install:
- sudo apt update

- pip install --upgrade pip isort black
- pip install tox tox-travis

- sudo apt install python3-gi

script:
- tox -vv


stages:
- test
- deploy_pypi


jobs:
allow_failures:
- arch: arm64
- python: ['3.10-dev']

exclude:
- python: '3.7'
arch: arm64
- python: '3.8'
arch: arm64
- python: '3.9'
arch: arm64
- python: '3.10-dev'
arch: arm64

include:
- stage: test
dist: bionic
python: 3.8

- stage: deploy_pypi
python: "3.6"
script: skip
deploy:
on:
tags: true
repo: octocat/hello-world
provider: pypi
user: "DomDF"
password:
secure: 1234abcd
distributions: "sdist bdist_wheel"
skip_existing: true

0 comments on commit e6aa2ec

Please sign in to comment.