Skip to content

🎨 Use travis template #100

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

Merged
merged 3 commits into from
Jul 14, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .moban.dt/local-travis.yml.jj2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends 'travis.yml.jj2' %}

{% block custom_python_versions %}
python:
- 3.7
- 2.7
{% endblock %}

{% block extra_jobs %}
allow_failures:
- stage: test
{% endblock %}

{% block before_script %}
before_script:
- find templates/ -type f -name '*.jj2' -exec echo '{}' \; |{% raw %}
sed -e "s/templates\//{%include \"/" -e "s/$/\" %}/" > test.file
{% endraw %}
{% endblock %}

{% block script %}
- moban -c config/data.yml -t test.file -td templates .
- {{ test_command }}
{% endblock %}
43 changes: 31 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
sudo: false
dist: xenial
language: python
python:
- 2.7
- 3.6
notifications:
email: false
install:
- pip install -r test_requirements.txt -r tests/requirements.txt
python:
- 3.7
- 2.7

stages:
- test
- moban
- lint
- moban

.disable_global: &disable_global
addons: false
cache: false
env: {}
python: false
before_install: false
install: true
install: false
before_script: false
script: false
after_success: false
after_failure: false
before_deploy: false
deploy: false

.lint: &lint
<<: *disable_global
git:
submodules: false
python: 3.6
stage: lint
install: pip install flake8
script: flake8
script: make install_test lint

.moban: &moban
<<: *disable_global
python: 3.6
stage: moban
install: pip install moban>=0.0.4
script:
- make
script: make upstreaming git-diff-check

jobs:
include:
Expand All @@ -43,7 +50,19 @@ jobs:

stage: test

before_install:
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
mv min_requirements.txt requirements.txt ;
fi
- test ! -f rnd_requirements.txt ||
pip install --no-deps -r rnd_requirements.txt
- test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ;
- pip install -r tests/requirements.txt
before_script:
- find templates/ -type f -name '*.jj2' -exec echo '{}' \; |
sed -e "s/templates\//{%include \"/" -e "s/$/\" %}/" > test.file
script:
- find templates/ -type f -name '*.jj2' -exec echo '{}' \;|sed -e "s/templates\//{%include \"/" -e "s/$/\" %}/" > test.file
- moban -c config/data.yml -t test.file -td templates .
- pytest
after_success:
codecov
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
all: upstreaming

upstreaming:
moban -m mobanfile

git-diff-check:
git diff
git diff --ignore-blank-lines | while read line; do if [ "$line" ]; then exit 1; fi; done

lint: flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long
install_test:
pip install -r tests/requirements.txt

lint:
flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long
yamllint .

push:
git config user.email "[email protected]"
Expand Down
3 changes: 3 additions & 0 deletions config/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ rsrcdir: docs/source
rbuilddir: docs/_build
version: 0.1.1rc3
mastertocmaxdepth: 3
lint_command: make install_test lint
moban_command: make upstreaming git-diff-check
test_command: pytest
1 change: 1 addition & 0 deletions mobanfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ configuration:
- sphinx:sphinx/templates/quickstart
targets:
- .gitignore: gitignore.jj2
- .travis.yml: local-travis.yml.jj2
- LICENSE: NEW_BSD_LICENSE.jj2
- README.rst: local-README.rst.jj2
- output: CHANGELOG.rst
Expand Down
83 changes: 71 additions & 12 deletions templates/travis.yml.jj2
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{% if lint_command %}
{% set lint = lint_command%}
{% else %}
{% set lint = 'flake8' %}
{% if not lint_command and lint_command != False %}
{% set lint_command = 'flake8' %}
{% endif %}
{% if not moban_command and moban_command != False %}
{% if mobanfile %}
{% set moban_command = 'moban -m ' + mobanfile %}
{% else %}
{% set moban_command = 'moban' %}
{% endif %}
{% endif %}

sudo: false
dist: xenial
dist: {{ travis_dist | default('xenial') }}
language: python
notifications:
email: false
Expand All @@ -26,42 +30,97 @@ python:
{%block extra_matrix%}
{%endblock%}

{% block stages %}
stages:
- test
{% if lint_command != False %}
- lint
{% endif %}
{% if moban_command != False %}
- moban
{% endif %}

{% endblock %}
.disable_global: &disable_global
addons: false
cache: false
env: {}
python: false
before_install: false
install: true
install: false
before_script: false
script: false
after_success: false
after_failure: false
before_deploy: false
deploy: false

{% if lint_command != False %}
.lint: &lint
<<: *disable_global
git:
submodules: false
python: 3.6
stage: lint
{% if lint_command == 'flake8' %}
install: pip install flake8
script: {{ lint }}
{% endif %}
script: {{ lint_command }}

{% endif %}
{% if moban_command != False %}
.moban: &moban
<<: *disable_global
python: 3.6
stage: moban
install: pip install moban>=0.0.4
{% if moban_command.startswith('moban') and 'exit-code' not in moban_command %}
script:
- {{ moban_command }}
{% if moban_allow_trailing_whitespace %}
- git diff
- git diff --ignore-blank-lines |
while read line; do if [ "$line" ]; then exit 1; fi; done
{% else %}
- git diff --exit-code
{% endif %}
{% else %}
script: {{ moban_command }}
{% endif %}

{% endif %}
{% block extra_dot_blocks %}
{% endblock %}
{% block jobs %}
jobs:
include:
- *moban
- *lint
{% block extra_jobs %}
{% endblock %}
{% endblock %}

stage: test

script: make test

{% block before_install %}
before_install:
{% block custom_install %}
{% endblock%}
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
mv min_requirements.txt requirements.txt ;
fi
- test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt
- test ! -f rnd_requirements.txt ||
pip install --no-deps -r rnd_requirements.txt
- test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ;
- pip install -r tests/requirements.txt
{% endblock %}
{% block before_script %}
{% endblock %}
script:
- make test
{% block script %}
- {{ test_command | default('make test') }}
{% endblock %}
{% block end %}
after_success:
codecov
{% endblock %}
1 change: 0 additions & 1 deletion test_requirements.txt

This file was deleted.

3 changes: 3 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
codecov
moban>=0.0.4
pytest~=3.6.1
flake8
yamllint