Skip to content

Commit 13f1434

Browse files
authored
Build and test the Python SDK without having to install Python (#44)
* Run all of the things without python * Touch-up
1 parent b84292d commit 13f1434

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM python:3.8.6 AS base
2+
3+
4+
FROM base AS lint
5+
6+
RUN pip install black
7+
8+
WORKDIR /data
9+
ENTRYPOINT ["black"]
10+
11+
12+
FROM base AS dependencies
13+
14+
COPY requirements.txt .
15+
RUN pip install -r requirements.txt
16+
17+
18+
FROM dependencies AS build
19+
20+
COPY . .
21+
22+
ENTRYPOINT [ "python", "setup.py", "install" ]
23+
24+
25+
FROM dependencies as test
26+
27+
COPY test-requirements.txt .
28+
RUN pip install -r test-requirements.txt
29+
30+
COPY . .
31+
32+
ENTRYPOINT ["python", "-m", "unittest", "discover", "test/"]

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
SHELL = /bin/bash
22

3-
build: install lint
3+
build: lint install
44

55
install:
6-
pip install -r requirements.txt && \
7-
python setup.py install
6+
docker build --target build . -t patch-python-build && \
7+
docker run --rm -v $(PWD)/build:/build patch-python-build
88

99
lint:
10-
pip install black && \
11-
black .
10+
docker build --target lint . -t patch-python-lint && \
11+
docker run --rm -v $(PWD):/data patch-python-lint .
1212

1313
test:
14-
pip install -r test-requirements.txt && \
15-
pip install -r requirements.txt && \
16-
python -m unittest discover test/
14+
docker build --target test . -t patch-python-test && \
15+
docker run --rm \
16+
-e SANDBOX_API_KEY=${SANDBOX_API_KEY} \
17+
patch-python-test
1718

1819
.PHONY: build lint test

0 commit comments

Comments
 (0)