Skip to content

Commit 6ddb1f1

Browse files
committed
Changes required to build this project on Jenkins
1 parent 2adde1b commit 6ddb1f1

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

Makefile

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@
1414

1515
define help
1616

17-
Supported targets: 'develop', 'sdist', 'clean', 'test', 'pypi'
17+
Supported targets: 'develop', 'sdist', 'clean', 'test', 'pypi', or 'pypi_stable'.
1818

1919
The 'develop' target creates an editable install (aka develop mode).
2020

21-
The 'sdist' target creates a source distribution.
21+
The 'sdist' target creates a source distribution of this project.
2222

2323
The 'clean' target undoes the effect of 'develop' and 'sdist'.
2424

2525
The 'test' target runs unit tests. Set the 'tests' variable to run a particular test.
2626

27-
The 'pypi' target publishes the current commit of Toil to PyPI after enforcing that the working
28-
copy and the index are clean, and tagging it as an unstable .dev build.
27+
The 'pypi' target publishes the current commit of this project to PyPI after enforcing that the
28+
working copy and the index are clean, and tagging it as an unstable .dev build.
29+
30+
The 'pypi_stable' target is like 'pypi' except that it doesn't tag the build as
31+
an unstable build. IOW, it publishes a stable release.
32+
2933

3034
endef
3135
export help
@@ -69,17 +73,29 @@ test: _check_venv
6973

7074

7175
.PHONY: pypi
72-
pypi: _check_venv _check_clean_working_copy test
73-
$(python) setup.py egg_info sdist bdist_egg upload
76+
pypi: _check_clean_working_copy _check_running_on_jenkins
77+
@test "$$(git rev-parse --verify remotes/origin/master)" != "$$(git rev-parse --verify HEAD)" \
78+
&& echo "Not on master branch, silently skipping deployment to PyPI." \
79+
|| $(python) setup.py egg_info --tag-build=.dev$$BUILD_NUMBER sdist bdist_egg upload
80+
81+
82+
.PHONY: pypi_stable
83+
pypi_stable: _check_clean_working_copy _check_running_on_jenkins
84+
test "$$(git rev-parse --verify remotes/origin/master)" != "$$(git rev-parse --verify HEAD)" \
85+
&& echo "Not on master branch, silently skipping deployment to PyPI." \
86+
|| $(python) setup.py egg_info register sdist bdist_egg upload
7487

7588

7689
.PHONY: clean_pypi
77-
clean_pypi: clean_sdist
90+
clean_pypi:
7891
- rm -rf build/
7992

8093

8194
.PHONY: clean
8295
clean: clean_develop clean_sdist clean_pypi
96+
-rm -rf __pychache__
97+
-rm -rf .cache .eggs
98+
find . -name '*.pyc' | xargs rm
8399

84100

85101
.PHONY: _check_venv
@@ -99,3 +115,10 @@ _check_clean_working_copy:
99115
|| ( echo "$(red)You have are untracked files:$(normal)" \
100116
; git ls-files --other --exclude-standard --directory \
101117
; false )
118+
119+
120+
.PHONY: _check_running_on_jenkins
121+
_check_running_on_jenkins:
122+
@echo "$(green)Checking if running on Jenkins ...$(normal)"
123+
test -n "$$BUILD_NUMBER" \
124+
|| ( echo "$(red)This target should only be invoked on Jenkins.$(normal)" ; false )

jenkins.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
virtualenv venv
2+
. venv/bin/activate
3+
make develop
4+
export PYTEST_ADDOPTS="--junitxml=test-report.xml"
5+
make $make_targets

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
kwargs = dict(
88
name="bd2k-python-lib",
9-
version="1.11.dev1",
9+
version="1.11",
1010

1111
author='Hannes Schmidt',
1212
author_email='hannes@ucsc.edu',

0 commit comments

Comments
 (0)