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

Commit0ede297

Browse files
committed
Added a Dockerfile that creates a clean Ubuntu Xenial test environment
1 parent8d18c47 commit0ede297

File tree

7 files changed

+121
-6
lines changed

7 files changed

+121
-6
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/

‎Dockerfile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
echo"deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main" >> /etc/apt/sources.list && \
30+
apt-get update && \
31+
apt-get install -y --install-recommends python2.7 python3.4 python3.5 python3.6 python3.7 && \
32+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python2.7 27 && \
33+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 34 && \
34+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 35 && \
35+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 36 && \
36+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 37
37+
38+
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
39+
python3 get-pip.py && \
40+
pip3 install tox
41+
42+
# Clean up
43+
RUN rm -rf /var/cache/apt/* && \
44+
rm -rf /var/lib/apt/lists/* && \
45+
rm -rf /tmp/* && \
46+
rm -rf /var/tmp/*
47+
48+
#################################################################
49+
# Build as a regular user
50+
# Credit: https://github.com/delcypher/docker-ubuntu-cxx-dev/blob/master/Dockerfile
51+
# License: None specified at time of import
52+
# Add non-root user for container but give it sudo access.
53+
# Password is the same as the username
54+
RUN useradd -m ${CONTAINER_USER} && \
55+
echo ${CONTAINER_USER}:${CONTAINER_USER} | chpasswd && \
56+
echo"${CONTAINER_USER} ALL=(root) ALL" >> /etc/sudoers
57+
RUN chsh --shell /bin/bash ${CONTAINER_USER}
58+
USER ${CONTAINER_USER}
59+
#################################################################
60+
61+
# The test suite will not tolerate running against a branch that isn't "master", so
62+
# check out the project to a well-known location that can be used by the test suite.
63+
# This has the added benefit of protecting the local repo fed into the container
64+
# as a volume from getting destroyed by a bug exposed by the test suite. :)
65+
ENV TRAVIS=ON
66+
RUN git clone --recursive https://github.com/gitpython-developers/GitPython.git /home/${CONTAINER_USER}/testrepo && \
67+
cd /home/${CONTAINER_USER}/testrepo && \
68+
./init-tests-after-clone.sh
69+
ENV GIT_PYTHON_TEST_GIT_REPO_BASE=/home/${CONTAINER_USER}/testrepo
70+
ENV TRAVIS=
71+
72+
# Ensure any local pip installations get on the path
73+
ENV PATH=/home/${CONTAINER_USER}/.local/bin:${PATH}
74+
75+
# Set the global default git user to be someone non-descript
76+
RUN git config --global user.email ci@gitpython.org && \
77+
git config --global user.name"GitPython CI User"
78+

‎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 -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/remote.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,15 @@ def _get_fetch_info_from_stderr(self, proc, progress):
687687
withopen(osp.join(self.repo.common_dir,'FETCH_HEAD'),'rb')asfp:
688688
fetch_head_info= [l.decode(defenc)forlinfp.readlines()]
689689

690+
# strip out unnecessary informational strings that show up in later
691+
# versions of git:
692+
extraneous= [
693+
' (refs/remotes/origin/HEAD has become dangling)'
694+
]
695+
forextrainextraneous:
696+
ifextrainfetch_info_lines:
697+
fetch_info_lines.remove(extra)
698+
690699
l_fil=len(fetch_info_lines)
691700
l_fhi=len(fetch_head_info)
692701
ifl_fil!=l_fhi:

‎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