-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a dockerfile for testing Add image for testing tsfresh with multiple python versions. This can be a good final sanity check e.g. before a release. * Nit: add document start on yaml file * Initialise makefile Targets include 1. Building dockerised testing environment 2. Testing tsfresh within testing environment 3. Testing tsfresh locally with tox with available python versions 4. Testing tsfresh locally with current active python version 5. Cleaning build artifacts 6. Formatting. This is so that changes can be made before pushing the changes up the remote to trigger the formatting checks. TODO: pre-commit hooks should probs be added too. * Documentation updates Change docs to reflect the new testing invokations. * Responded to PR review - Remove the python PATCH version from makefile - Move calls to `make clean` to be part of the docker test invokation instead of within local test commands - Removed the one line makefile commands (the docs have enough info on the development process so will not bother using `make` for these. - Updated hyperlink to point to main instead of specific commit sha
- Loading branch information
1 parent
ece0714
commit b970a2e
Showing
4 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 22.12.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Bakes the python versions which tsfresh targets into a testing env | ||
FROM ubuntu:22.04 | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
# These are required to build python from source | ||
RUN apt-get update && apt-get install -y \ | ||
python3-pip \ | ||
curl \ | ||
clang \ | ||
git \ | ||
build-essential \ | ||
libssl-dev \ | ||
libreadline-dev \ | ||
zlib1g-dev \ | ||
libbz2-dev \ | ||
libsqlite3-dev \ | ||
llvm \ | ||
libncurses5-dev \ | ||
libgdbm-dev \ | ||
libnss3-dev \ | ||
libffi-dev \ | ||
liblzma-dev \ | ||
libgmp-dev \ | ||
libmpfr-dev \ | ||
&& apt-get clean | ||
|
||
|
||
RUN curl https://pyenv.run | bash | ||
|
||
# For interactive use (if any), this is an edge case. | ||
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc && \ | ||
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc && \ | ||
echo 'eval "$(pyenv init -)"' >> ~/.bashrc | ||
|
||
ENV PYENV_ROOT="/root/.pyenv" | ||
ENV PATH="$PYENV_ROOT/bin:$PATH" | ||
ENV PATH="$PYENV_ROOT/shims:$PATH" | ||
|
||
ARG PYTHON_VERSIONS | ||
RUN for version in $PYTHON_VERSIONS; do \ | ||
echo Installing $version; \ | ||
# Band aid for https://github.com/pyenv/pyenv/issues/1738 | ||
# since this also appears to apply to 3.7.X | ||
if [[ $version =~ ^3\.7\..*$ ]]; then \ | ||
echo Using clang to compile $version; \ | ||
CC=clang pyenv install $version || exit 1; \ | ||
else \ | ||
pyenv install $version || exit 1; \ | ||
fi; \ | ||
done | ||
|
||
RUN pyenv global $PYTHON_VERSIONS | ||
|
||
RUN pip install tox | ||
|
||
WORKDIR /tsfresh | ||
|
||
# Requires adding safe.directory so that tsfresh can build when the | ||
# repo is mounted. | ||
# Note cannot do this at build time as no git directory exists | ||
CMD ["/bin/bash", "-c", "git config --global --add safe.directory /tsfresh && tox -r -p auto"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
WORKDIR := /tsfresh | ||
TEST_IMAGE := tsfresh-test-image | ||
TEST_DOCKERFILE := Dockerfile.testing | ||
TEST_CONTAINER := tsfresh-test-container | ||
PYTHON_VERSIONS := "3.7 3.8 3.9 3.10 3.11" | ||
|
||
# Tests `PYTHON_VERSIONS`, provided they are also | ||
# specified in setup.cfg `envlist` | ||
test-all-testenv: build-docker-testenv run-docker-tests clean | ||
|
||
build-docker-testenv: | ||
docker build \ | ||
-f $(TEST_DOCKERFILE) \ | ||
-t $(TEST_IMAGE) \ | ||
--build-arg PYTHON_VERSIONS=$(PYTHON_VERSIONS) \ | ||
. | ||
|
||
run-docker-tests: | ||
docker run --rm \ | ||
--name $(TEST_CONTAINER) \ | ||
-v .:$(WORKDIR) \ | ||
-v build_artifacts:$(WORKDIR)/build \ | ||
-v tox_artifacts:$(WORKDIR)/.tox \ | ||
-v egg_artifacts:$(WORKDIR)/tsfresh.egg-info \ | ||
$(TEST_IMAGE) | ||
|
||
clean: | ||
rm -rf .tox build/ dist/ *.egg-info | ||
|
||
|
||
.PHONY: build-docker-testenv clean run-docker-tests test-all-testenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters