Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52ee33a

Browse files
jeking3Byron
authored andcommitted
Added a Dockerfile that creates a clean Ubuntu Xenial test environment
1 parent14b221b commit52ee33a

9 files changed

+122
-10
lines changed

‎.appveyor.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ environment:
55
CYGWIN64_GIT_PATH:"C:\\cygwin64\\bin;%GIT_DAEMON_PATH%"
66

77
matrix:
8-
## MINGW
9-
#
108
-PYTHON:"C:\\Python27"
119
PYTHON_VERSION:"2.7"
1210
GIT_PATH:"%GIT_DAEMON_PATH%"
@@ -25,21 +23,24 @@ environment:
2523
-PYTHON:"C:\\Miniconda35-x64"
2624
PYTHON_VERSION:"3.5"
2725
IS_CONDA:"yes"
26+
MAYFAIL:"yes"
2827
GIT_PATH:"%GIT_DAEMON_PATH%"
29-
3028
## Cygwin
31-
#
3229
-PYTHON:"C:\\Miniconda-x64"
3330
PYTHON_VERSION:"2.7"
3431
IS_CONDA:"yes"
3532
IS_CYGWIN:"yes"
33+
MAYFAIL:"yes"
3634
GIT_PATH:"%CYGWIN_GIT_PATH%"
3735
-PYTHON:"C:\\Python35-x64"
3836
PYTHON_VERSION:"3.5"
39-
GIT_PATH:"%CYGWIN64_GIT_PATH%"
4037
IS_CYGWIN:"yes"
38+
MAYFAIL:"yes"
39+
GIT_PATH:"%CYGWIN64_GIT_PATH%"
4140

42-
41+
matrix:
42+
allow_failures:
43+
-MAYFAIL:"yes"
4344
install:
4445
-set PATH=%PYTHON%;%PYTHON%\Scripts;%GIT_PATH%;%PATH%
4546

‎.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/
2+
.tox/

‎.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ matrix:
99
include:
1010
-python:3.7
1111
dist:xenial
12-
sudo:required
1312
-python:"nightly"
1413
dist:xenial
15-
sudo:required
1614
allow_failures:
1715
-python:"nightly"
16+
dist:xenial
1817
git:
1918
# a higher depth is needed for most of the tests - must be high enough to not actually be shallow
2019
# as we clone our own repository in the process

‎Dockerfile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# Contributed by: James E. King III (@jeking3) <jking@apache.org>
3+
#
4+
# This Dockerfile creates an Ubuntu Xenial build environment
5+
# that can run the same test suite as Travis CI.
6+
#
7+
8+
FROM ubuntu:xenial
9+
MAINTAINER James E. King III <jking@apache.org>
10+
ENV CONTAINER_USER=user
11+
ENV DEBIAN_FRONTEND noninteractive
12+
13+
RUN apt-get update && \
14+
apt-get install -y --no-install-recommends \
15+
add-apt-key \
16+
apt \
17+
apt-transport-https \
18+
apt-utils \
19+
ca-certificates \
20+
curl \
21+
git \
22+
net-tools \
23+
openssh-client \
24+
sudo \
25+
vim \
26+
wget
27+
28+
RUN add-apt-key -v 6A755776 -k keyserver.ubuntu.com && \
29+
add-apt-key -v E1DF1F24 -k keyserver.ubuntu.com && \
30+
echo"deb http://ppa.launchpad.net/git-core/ppa/ubuntu xenial main" >> /etc/apt/sources.list && \
31+
echo"deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main" >> /etc/apt/sources.list && \
32+
apt-get update && \
33+
apt-get install -y --install-recommends git python2.7 python3.4 python3.5 python3.6 python3.7 && \
34+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python2.7 27 && \
35+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 34 && \
36+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 35 && \
37+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 36 && \
38+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 37
39+
40+
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
41+
python3 get-pip.py && \
42+
pip3 install tox
43+
44+
# Clean up
45+
RUN rm -rf /var/cache/apt/* && \
46+
rm -rf /var/lib/apt/lists/* && \
47+
rm -rf /tmp/* && \
48+
rm -rf /var/tmp/*
49+
50+
#################################################################
51+
# Build as a regular user
52+
# Credit: https://github.com/delcypher/docker-ubuntu-cxx-dev/blob/master/Dockerfile
53+
# License: None specified at time of import
54+
# Add non-root user for container but give it sudo access.
55+
# Password is the same as the username
56+
RUN useradd -m ${CONTAINER_USER} && \
57+
echo ${CONTAINER_USER}:${CONTAINER_USER} | chpasswd && \
58+
echo"${CONTAINER_USER} ALL=(root) ALL" >> /etc/sudoers
59+
RUN chsh --shell /bin/bash ${CONTAINER_USER}
60+
USER ${CONTAINER_USER}
61+
#################################################################
62+
63+
# The test suite will not tolerate running against a branch that isn't "master", so
64+
# check out the project to a well-known location that can be used by the test suite.
65+
# This has the added benefit of protecting the local repo fed into the container
66+
# as a volume from getting destroyed by a bug exposed by the test suite. :)
67+
ENV TRAVIS=ON
68+
RUN git clone --recursive https://github.com/gitpython-developers/GitPython.git /home/${CONTAINER_USER}/testrepo && \
69+
cd /home/${CONTAINER_USER}/testrepo && \
70+
./init-tests-after-clone.sh
71+
ENV GIT_PYTHON_TEST_GIT_REPO_BASE=/home/${CONTAINER_USER}/testrepo
72+
ENV TRAVIS=
73+
74+
# Ensure any local pip installations get on the path
75+
ENV PATH=/home/${CONTAINER_USER}/.local/bin:${PATH}
76+
77+
# Set the global default git user to be someone non-descript
78+
RUN git config --global user.email ci@gitpython.org && \
79+
git config --global user.name"GitPython CI User"
80+

‎Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.PHONY: all clean release force_release docker-build test nose-pdb
2+
13
all:
24
@grep -Ee'^[a-z].*:' Makefile| cut -d: -f1| grep -vF all
35

@@ -16,3 +18,17 @@ force_release: clean
1618
git push --tags origin master
1719
python3 setup.py sdist bdist_wheel
1820
twine upload -s -i byronimo@gmail.com dist/*
21+
22+
docker-build:
23+
docker build --quiet -t gitpython:xenial -f Dockerfile.
24+
25+
test: docker-build
26+
# NOTE!!!
27+
# NOTE!!! If you are not running from master or have local changes then tests will fail
28+
# NOTE!!!
29+
docker run --rm -v${CURDIR}:/src -w /src -t gitpython:xenial tox
30+
31+
nose-pdb: docker-build
32+
# run tests under nose and break on error or failure into python debugger
33+
# HINT: set PYVER to "pyXX" to change from the default of py37 to pyXX for nose tests
34+
docker run --rm --env PYVER=${PYVER} -v${CURDIR}:/src -w /src -it gitpython:xenial /bin/bash dockernose.sh

‎dockernose.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
if [-z"${PYVER}" ];then
4+
PYVER=py37
5+
fi
6+
7+
tox -e${PYVER} --notest
8+
PYTHONPATH=/src/.tox/${PYVER}/lib/python*/site-packages /src/.tox/${PYVER}/bin/nosetests --pdb$*

‎git/cmd.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,11 @@ def execute(self, command,
715715
stdout_sink= (PIPE
716716
ifwith_stdout
717717
elsegetattr(subprocess,'DEVNULL',None)oropen(os.devnull,'wb'))
718-
log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)",
719-
command,cwd,universal_newlines,shell)
718+
istream_ok="None"
719+
ifistream:
720+
istream_ok="<valid stream>"
721+
log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)",
722+
command,cwd,universal_newlines,shell,istream_ok)
720723
try:
721724
proc=Popen(command,
722725
env=env,

‎git/remote.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ def _get_fetch_info_from_stderr(self, proc, progress):
695695
msg+="Will ignore extra progress lines or fetch head lines."
696696
msg%= (l_fil,l_fhi)
697697
log.debug(msg)
698+
log.debug("info lines: "+str(fetch_info_lines))
699+
log.debug("head info : "+str(fetch_head_info))
698700
ifl_fil<l_fhi:
699701
fetch_head_info=fetch_head_info[:l_fil]
700702
else:

‎test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ ddt>=1.1.1
22
coverage
33
flake8
44
nose
5+
tox
56
mock; python_version=='2.7'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp