Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ WORKDIR /app
# front-end (examples/web_app.py) could not give them.
COPY requirements.txt ./
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& pip install --no-cache-dir "tak @ git+https://github.com/Stephenson-Software/tak@86a6164e47e424b5340677d8fa0f689ab005417b" \
&& pip install --no-cache-dir "tak @ git+https://github.com/Stephenson-Software/tak@v0.5.0" \
&& apt-get purge -y git && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

COPY src/ ./src/
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# tak is the text-adventure kit extracted from this game
# (https://github.com/Stephenson-Software/tak), which FishE now runs on.
# Installing it needs git on the PATH.
tak @ git+https://github.com/Stephenson-Software/tak@86a6164e47e424b5340677d8fa0f689ab005417b
tak @ git+https://github.com/Stephenson-Software/tak@v0.5.0
jsonschema>=4.0,<5.0
36 changes: 33 additions & 3 deletions tests/test_dockerfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""The Dockerfile must install the same tak that everything else is tested on.

tak is pinned to a commit twice. requirements.txt is what CI, run.sh and the
README's Setup step install, so it is the version the suite runs against. The
tak is pinned twice, to a commit or a release tag. requirements.txt is what
CI, run.sh and the README's Setup step install, so it is the version the suite
runs against. The
Dockerfile installs tak on its own line instead - deliberately, since the image
needs nothing else from requirements.txt - and web/build_zip.py copies that
install into the bundle the browser plays. Only requirements.txt is exercised
Expand All @@ -15,7 +16,8 @@

REPOSITORY_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))

TAK_REQUIREMENT = re.compile(r"tak @ git\+\S+?@[0-9a-f]+")
# The ref after the last "@" is a commit hash or a release tag such as v0.5.0.
TAK_REQUIREMENT = re.compile(r"tak @ git\+\S+?@[0-9A-Za-z][0-9A-Za-z._-]*")


def readRepositoryFile(*parts):
Expand Down Expand Up @@ -66,6 +68,34 @@ def test_tak_requirement_finds_a_pin_and_ignores_comments():
]


def test_tak_requirement_finds_a_release_tag_pin():
# prepare
text = 'RUN pip install "tak @ git+https://github.com/Stephenson-Software/tak@v0.5.0" \\\n'

# call
requirements = takRequirements(text)

# check
assert requirements == [
"tak @ git+https://github.com/Stephenson-Software/tak@v0.5.0"
]


def test_tak_requirements_differing_only_in_tag_do_not_match():
# prepare
pinned = takRequirements(
"tak @ git+https://github.com/Stephenson-Software/tak@v0.5.0"
)

# call
installed = takRequirements(
'pip install "tak @ git+https://github.com/Stephenson-Software/tak@v0.5.1"'
)

# check
assert installed != pinned


def test_dockerfile_copies_everything_the_bundle_carries():
# web/build_zip.py runs inside the image, and tak's bundle skips a missing
# directory or file silently - so a path it bundles that the Dockerfile
Expand Down
Loading