-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add new Makefile target to run it tests inside Docker #487
Changes from all commits
f985ce3
f741b32
0d750b0
9f7b83b
f5e6bc8
79c6ab8
25c7b66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM ubuntu:16.04 | ||
|
||
ARG NEW_USER_UID | ||
ARG NEW_USER | ||
|
||
RUN apt-get -y update && \ | ||
apt-get install -y curl python3 python3-pip vim openssh-client \ | ||
git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ | ||
openjdk-8-jdk | ||
|
||
RUN pip3 install tox virtualenvwrapper twine sphinx sphinx_rtd_theme wheel | ||
|
||
RUN curl --progress-bar -o openjdk-10.0.1_linux-x64_bin.tar.gz \ | ||
https://download.java.net/java/GA/jdk10/10.0.1/fb4372174a714e6b8c52526dc134031e/10/openjdk-10.0.1_linux-x64_bin.tar.gz && \ | ||
mkdir -p /opt/jdk-10 ; tar xzf openjdk-10.0.1_linux-x64_bin.tar.gz -C /opt/jdk-10 --strip-components 1 && rm openjdk-10.0.1_linux-x64_bin.tar.gz | ||
|
||
RUN useradd -u ${NEW_USER_UID} -U -d /home/${NEW_USER} -s /bin/bash -m ${NEW_USER} | ||
|
||
USER ${NEW_USER} | ||
WORKDIR /home/${NEW_USER} | ||
|
||
RUN git clone https://github.com/yyuu/pyenv.git ~/.pyenv | ||
|
||
ENV HOME /home/${NEW_USER} | ||
ENV PYENV_ROOT=/home/${NEW_USER}/.pyenv | ||
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH | ||
ENV JAVA_HOME=/opt/jdk-10 | ||
ENV RUNTIME_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | ||
|
||
RUN pyenv install 3.4.8 | ||
RUN pyenv install 3.5.5 | ||
RUN pyenv install 3.6.5 | ||
RUN pyenv global 3.6.5 3.5.5 3.4.8 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
clean: | ||
clean: nondocs-clean docs-clean | ||
|
||
nondocs-clean: | ||
rm -rf .benchmarks .eggs .tox .rally_it .cache build dist esrally.egg-info logs junit-py*.xml | ||
|
||
docs-clean: | ||
cd docs && $(MAKE) clean | ||
|
||
# Avoid conflicts between .pyc/pycache related files created by local Python interpreters and other interpreters in Docker | ||
python-caches-clean: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I type
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, this is harmless and should always return Consecutive slashes will get collapsed as per the Single Unix Specification. Seems that using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Makes sense. |
||
-@find . -name "__pycache__" -exec rm -rf -- \{\} \; | ||
-@find . -name ".pyc" -exec rm -rf -- \{\} \; | ||
|
||
docs: | ||
cd docs && $(MAKE) html | ||
|
||
test: | ||
python3 setup.py test | ||
|
||
it: | ||
it: python-caches-clean | ||
tox | ||
|
||
it34: | ||
it34: python-caches-clean | ||
tox -e py34 | ||
|
||
it35: | ||
it35: python-caches-clean | ||
tox -e py35 | ||
|
||
it36: | ||
it36: python-caches-clean | ||
tox -e py36 | ||
|
||
benchmark: | ||
|
@@ -34,4 +43,11 @@ release-checks: | |
release: release-checks clean docs it | ||
./release.sh $(release_version) $(next_version) | ||
|
||
.PHONY: clean docs test it it34 it35 it36 benchmark coverage release release-checks | ||
docker-it: nondocs-clean python-caches-clean | ||
@if ! export | grep UID; then export UID=$(shell id -u); fi ; \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not familiar with this syntax. Why is there an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
less junk on the output esp. with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't know about that. I also saw now that this is actually just one long line separated by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a small correction not all output will get suppressed (e.g. the output generated from the commands themselves e.g. e.g. if you have a Makefile target called:
this will display the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I should have said "echoing" instead of "output". Thanks for the explanation. |
||
if ! export | grep USER; then export USER=$(shell echo $$USER); fi ; \ | ||
if ! export | grep PWD; then export PWD=$(shell pwd); fi ; \ | ||
docker-compose build --pull; `# add --pull here to rebuild a fresh image` \ | ||
docker-compose run --rm rally-tests /bin/bash -c "make docs-clean && make it" | ||
|
||
.PHONY: clean nondocs-clean docs-clean python-caches-clean docs test docker-it it it34 it35 it36 benchmark coverage release release-checks |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '2.2' | ||
services: | ||
rally-tests: | ||
build: | ||
context: . | ||
args: | ||
- NEW_USER_UID=${UID} | ||
- NEW_USER=${USER} | ||
container_name: rally-tests | ||
volumes: | ||
- ${PWD}/.:/home/${USER}/rally | ||
image: rally-tests | ||
user: ${UID} | ||
working_dir: /home/${USER}/rally | ||
stdin_open: true | ||
tty: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether
clean
should clean everything (including Python caches).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am ambivalent about this one because it you don't use docker it will introduce some slowness every time you run
make docs
ormake it
as I've noticed some downloads happening. At the same time it ensures consistency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it does not make sense to clean Python caches for
make docs
. However, I think formake it
would make sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it would make sense for
make it
. I think we should add it to the individualit34/35/36
targets too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.