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

.moban.yaml: Add CI check scripts #2614

Merged
merged 1 commit into from
Feb 4, 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
48 changes: 48 additions & 0 deletions .ci/check_setuptools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from __future__ import print_function

import subprocess
import sys

import setuptools


def get_setuptools_version():
with open('requirements.txt') as f:
for line in f:
if line.startswith('setuptools'):
line = line.rstrip()
if '>=' not in line:
raise ValueError('%s doesnt use ">="' % line)
_, version = line.split('>=')
return version


def check_setuptools_version(version):
print('Checking setuptools==%s' % version, file=sys.stderr)
if setuptools.__version__ != version:
print('Failed! setuptools==%s' % setuptools.__version__,
file=sys.stderr)
return 2

pip_list = subprocess.check_output(['pip', 'list', '--format=legacy'])
pip_list = pip_list.decode('utf8')
if 'setuptools (%s)' % version not in pip_list:
print('Failed! pip list reports wrong setuptools:\n%s' % pip_list,
file=sys.stderr)
return 3

if __name__ == '__main__':
version = None
try:
version = get_setuptools_version()
except Exception as e:
print('Exception extracting setuptools version from requirements.txt: '
'%s' % e,
file=sys.stderr)
sys.exit(1)

if not version:
print('Unable to find setuptools in requirements.txt',
file=sys.stderr)
sys.exit(1)
sys.exit(check_setuptools_version(version))
2 changes: 1 addition & 1 deletion .ci/check_unsupported.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi
set -e

# The following is emitted on stdout
grep -q 'coala supports only python 3.4.4 or later' setup.log
grep -q 'coala supports only Python 3.4.2 or later' setup.log
# The following is emitted on stderr
grep -q 'error: Setup script exited with 4' setup.log

Expand Down
4 changes: 3 additions & 1 deletion .moban.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ targets:
- .ci/appveyor.yml: ci/appveyor.yml.jj2
- .ci/run_with_env.cmd: run_with_env.cmd
- .ci/check_unsupported.sh: ci/check_unsupported.sh.jj2
- .ci/check_moban.sh: ci/check_moban.sh
- runtime.txt: runtime.txt
- netlify.toml: docs/netlify.toml
- coala-bears.cabal: coala-bears.cabal.jj2
copy:
- .ci/check_moban.sh: ci/check_moban.sh
- .ci/check_setuptools.py: ci/check_setuptools.py
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ before_script:
- .ci/deps.coala-bears.sh

script:
- .ci/check_setuptools.py
- python setup.py bdist_wheel
- pip install $(ls ./dist/*.whl)"[alldeps]"
# Ensure bear requirements are in sync with the bear PipRequirement
Expand Down