Skip to content

Commit d49b4c8

Browse files
author
root
committed
tested client can install in all versions
1 parent 0550d19 commit d49b4c8

7 files changed

Lines changed: 193 additions & 18 deletions

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ dev-debug: clean build-debug test
135135
install-poetry:
136136
$(PYTHON) -m pip install poetry
137137

138-
install-dev-deps:
138+
install-dev-deps: install-poetry venv-poetry
139139
poetry lock
140140
poetry install --no-interaction --no-root
141141

142142
venv-poetry:
143143
poetry config virtualenvs.in-project true
144144

145-
install-test: install-poetry venv-poetry install-dev-deps dev
145+
install-test: install-dev-deps dev
146146

147147
list-packaged: build
148148
tar -tf $(shell ls -1 dist/*.tar.gz | sort -V | tail -n 1)

tests/Dockerfile-test-py3.10

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM python:3.10-slim as py3.10
22
WORKDIR /app
33

4+
# Install necessary system packages
45
RUN apt-get update && apt-get install -y \
5-
build-essential \
6-
make
6+
gcc \
7+
make \
8+
&& apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/*
710

811
# Copy application files
912
COPY newtype/ ./newtype/
@@ -15,6 +18,37 @@ COPY pyproject.toml ./
1518

1619
RUN python -m venv .venv && \
1720
export PATH=".venv/bin:$PATH" && \
18-
make install-test VERSION=3.10
21+
make install-test VERSION=3.10 && \
22+
deactivate
1923

24+
FROM python:3.10-slim as py3.10
25+
26+
# Change to the client directory
27+
WORKDIR /client
28+
29+
# Install necessary system packages
30+
RUN apt-get update && apt-get install -y \
31+
gcc \
32+
make \
33+
&& apt-get clean \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Copy the distribution files and example script
37+
COPY dist/ ./dist/
38+
COPY tests/ ./
39+
COPY Makefile ./
40+
COPY examples/demo.py ./
41+
42+
# Install the package from the distribution
43+
RUN python -m venv .venv && \
44+
. .venv/bin/activate && \
45+
python -m pip install dist/*.tar.gz && \
46+
python -c "from newtype import NewType" && \
47+
python -m demo && \
48+
python -m pip install pytest && \
49+
python -m pip install pandas && \
50+
make test && \
51+
deactivate
52+
53+
# Set the default command to execute when the container starts
2054
CMD ["echo", "all tests done"]

tests/Dockerfile-test-py3.11

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM python:3.11-slim as py3.11
22
WORKDIR /app
33

4+
# Install necessary system packages
45
RUN apt-get update && apt-get install -y \
5-
build-essential \
6-
make
6+
gcc \
7+
make \
8+
&& apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/*
710

811
# Copy application files
912
COPY newtype/ ./newtype/
@@ -15,6 +18,37 @@ COPY pyproject.toml ./
1518

1619
RUN python -m venv .venv && \
1720
export PATH=".venv/bin:$PATH" && \
18-
make install-test VERSION=3.11
21+
make install-test VERSION=3.11 && \
22+
deactivate
1923

24+
FROM python:3.11-slim as py3.11
25+
26+
# Change to the client directory
27+
WORKDIR /client
28+
29+
# Install necessary system packages
30+
RUN apt-get update && apt-get install -y \
31+
gcc \
32+
make \
33+
&& apt-get clean \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Copy the distribution files and example script
37+
COPY dist/ ./dist/
38+
COPY tests/ ./
39+
COPY Makefile ./
40+
COPY examples/demo.py ./
41+
42+
# Install the package from the distribution
43+
RUN python -m venv .venv && \
44+
. .venv/bin/activate && \
45+
python -m pip install dist/*.tar.gz && \
46+
python -c "from newtype import NewType" && \
47+
python -m demo && \
48+
python -m pip install pytest && \
49+
python -m pip install pandas && \
50+
make test && \
51+
deactivate
52+
53+
# Set the default command to execute when the container starts
2054
CMD ["echo", "all tests done"]

tests/Dockerfile-test-py3.12

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM python:3.12-slim as py3.12
22
WORKDIR /app
33

4+
# Install necessary system packages
45
RUN apt-get update && apt-get install -y \
5-
build-essential \
6-
make
6+
gcc \
7+
make \
8+
&& apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/*
710

811
# Copy application files
912
COPY newtype/ ./newtype/
@@ -15,6 +18,37 @@ COPY pyproject.toml ./
1518

1619
RUN python -m venv .venv && \
1720
export PATH=".venv/bin:$PATH" && \
18-
make install-test VERSION=3.12
21+
make install-test VERSION=3.12 && \
22+
deactivate
1923

24+
FROM python:3.12-slim as py3.12
25+
26+
# Change to the client directory
27+
WORKDIR /client
28+
29+
# Install necessary system packages
30+
RUN apt-get update && apt-get install -y \
31+
gcc \
32+
make \
33+
&& apt-get clean \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Copy the distribution files and example script
37+
COPY dist/ ./dist/
38+
COPY tests/ ./
39+
COPY Makefile ./
40+
COPY examples/demo.py ./
41+
42+
# Install the package from the distribution
43+
RUN python -m venv .venv && \
44+
. .venv/bin/activate && \
45+
python -m pip install dist/*.tar.gz && \
46+
python -c "from newtype import NewType" && \
47+
python -m demo && \
48+
python -m pip install pytest && \
49+
python -m pip install pandas && \
50+
make test && \
51+
deactivate
52+
53+
# Set the default command to execute when the container starts
2054
CMD ["echo", "all tests done"]

tests/Dockerfile-test-py3.8

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,58 @@
1+
# Use Python 3.8 slim image as the base
12
FROM python:3.8-slim as py3.8
3+
4+
# Set the working directory
25
WORKDIR /app
36

7+
# Install necessary system packages
48
RUN apt-get update && apt-get install -y \
5-
build-essential \
6-
make
9+
gcc \
10+
make \
11+
&& apt-get clean \
12+
&& rm -rf /var/lib/apt/lists/*
713

8-
# Copy application files
14+
# Copy application files into the container
915
COPY newtype/ ./newtype/
1016
COPY tests/ ./tests/
1117
COPY build.py ./
1218
COPY Makefile ./
1319
COPY README.md ./
1420
COPY pyproject.toml ./
1521

22+
# Create a virtual environment and install test dependencies
23+
RUN python -m venv .venv && \
24+
. .venv/bin/activate && \
25+
make install-test && \
26+
deactivate
27+
28+
FROM python:3.8-slim as py3.8
29+
30+
# Change to the client directory
31+
WORKDIR /client
32+
33+
# Install necessary system packages
34+
RUN apt-get update && apt-get install -y \
35+
gcc \
36+
make \
37+
&& apt-get clean \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
# Copy the distribution files and example script
41+
COPY dist/ ./dist/
42+
COPY tests/ ./
43+
COPY Makefile ./
44+
COPY examples/demo.py ./
45+
46+
# Install the package from the distribution
1647
RUN python -m venv .venv && \
1748
. .venv/bin/activate && \
18-
make install-test
49+
python -m pip install dist/*.tar.gz && \
50+
python -c "from newtype import NewType" && \
51+
python -m demo && \
52+
python -m pip install pytest && \
53+
python -m pip install pandas && \
54+
make test && \
55+
deactivate
1956

57+
# Set the default command to execute when the container starts
2058
CMD ["echo", "all tests done"]

tests/Dockerfile-test-py3.9

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM python:3.9-slim as py3.9
22
WORKDIR /app
33

4+
# Install necessary system packages
45
RUN apt-get update && apt-get install -y \
5-
build-essential \
6-
make
6+
gcc \
7+
make \
8+
&& apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/*
710

811
# Copy application files
912
COPY newtype/ ./newtype/
@@ -15,6 +18,37 @@ COPY pyproject.toml ./
1518

1619
RUN python -m venv .venv && \
1720
export PATH=".venv/bin:$PATH" && \
18-
make install-test VERSION=3.9
21+
make install-test VERSION=3.9 && \
22+
deactivate
1923

24+
FROM python:3.9-slim as py3.9
25+
26+
# Change to the client directory
27+
WORKDIR /client
28+
29+
# Install necessary system packages
30+
RUN apt-get update && apt-get install -y \
31+
gcc \
32+
make \
33+
&& apt-get clean \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Copy the distribution files and example script
37+
COPY dist/ ./dist/
38+
COPY tests/ ./
39+
COPY Makefile ./
40+
COPY examples/demo.py ./
41+
42+
# Install the package from the distribution
43+
RUN python -m venv .venv && \
44+
. .venv/bin/activate && \
45+
python -m pip install dist/*.tar.gz && \
46+
python -c "from newtype import NewType" && \
47+
python -m demo && \
48+
python -m pip install pytest && \
49+
python -m pip install pandas && \
50+
make test && \
51+
deactivate
52+
53+
# Set the default command to execute when the container starts
2054
CMD ["echo", "all tests done"]

tests/build_test_pyvers_docker_images.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Create logs directory if it doesn't exist
44
mkdir -p ./tests/logs
5+
make build
56

67
# Build Docker images in parallel with logging
78
docker build -t python-newtype-test-mul-vers:3.8 -f ./tests/Dockerfile-test-py3.8 . > ./tests/logs/py3.8-test.log 2>&1 &

0 commit comments

Comments
 (0)