diff --git a/Dockerfile b/Dockerfile index 5d111e5..19579ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/requirements.txt b/requirements.txt index 25ea228..35337c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/tests/test_dockerfile.py b/tests/test_dockerfile.py index 0fdfb32..a7caa6a 100644 --- a/tests/test_dockerfile.py +++ b/tests/test_dockerfile.py @@ -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 @@ -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): @@ -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