diff --git a/.github/workflows/modpoll-release.yml b/.github/workflows/modpoll-release.yml index 5b539ae..2386b12 100644 --- a/.github/workflows/modpoll-release.yml +++ b/.github/workflows/modpoll-release.yml @@ -112,6 +112,13 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: ref: ${{ needs.candidate.outputs.git-tag }} + # The release checks come from the workflow's own commit: a republish builds an older tag that may + # predate them. + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + ref: ${{ github.sha }} + path: .release-tools + sparse-checkout: .github/scripts - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 @@ -127,7 +134,7 @@ jobs: GIT_TAG: ${{ needs.candidate.outputs.git-tag }} IMAGE_VERSION: ${{ needs.candidate.outputs.image-version }} run: | - python "$GITHUB_WORKSPACE/.github/scripts/release.py" version "$GIT_TAG" + python "$GITHUB_WORKSPACE/.release-tools/.github/scripts/release.py" version "$GIT_TAG" --root "$GITHUB_WORKSPACE" image="$REGISTRY/$OWNER/modpoll:$IMAGE_VERSION" # The image installs from the workspace lock, so it builds from the repository root. if docker buildx imagetools inspect "$image" >/dev/null 2>&1; then @@ -188,6 +195,13 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: ref: ${{ needs.candidate.outputs.git-tag }} + # The release checks come from the workflow's own commit: a republish builds an older tag that may + # predate them. + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + ref: ${{ github.sha }} + path: .release-tools + sparse-checkout: .github/scripts - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6 with: version: 0.11.19 @@ -206,7 +220,7 @@ jobs: env: GIT_TAG: ${{ needs.candidate.outputs.git-tag }} run: | - python "$GITHUB_WORKSPACE/.github/scripts/release.py" download "$GIT_TAG" --directory "$RUNNER_TEMP/acceptance/distributions" + python "$GITHUB_WORKSPACE/.release-tools/.github/scripts/release.py" download "$GIT_TAG" --directory "$RUNNER_TEMP/acceptance/distributions" cp -r tests tools examples "$RUNNER_TEMP/acceptance/" uv venv "$RUNNER_TEMP/acceptance/.venv" uv pip install --python "$RUNNER_TEMP/acceptance/.venv/bin/python" "$RUNNER_TEMP"/acceptance/distributions/*.whl pytest pyserial==3.5 diff --git a/packages/modpoll/tests/test_process_lifecycle.py b/packages/modpoll/tests/test_process_lifecycle.py index f3c108d..b9ba6d6 100644 --- a/packages/modpoll/tests/test_process_lifecycle.py +++ b/packages/modpoll/tests/test_process_lifecycle.py @@ -37,9 +37,14 @@ def test_process_exits_promptly_after_successful_poll(tmp_path, sig): server.polled = threading.Event() thread = threading.Thread(target=server.serve_forever, daemon=True) thread.start() + # faulthandler dumps every thread's stack on SIGABRT, so a process that does not exit in time + # shows where it is blocked. + stderr = (tmp_path / "stderr.txt").open("w+") process = subprocess.Popen( [ sys.executable, + "-X", + "faulthandler", "-m", "modpoll", "--config", @@ -53,16 +58,26 @@ def test_process_exits_promptly_after_successful_poll(tmp_path, sig): "0", ], stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, + stderr=stderr, ) try: assert server.polled.wait(10), "polling did not start" process.send_signal(sig) - assert process.wait(timeout=5) == 0 + try: + returncode = process.wait(timeout=5) + except subprocess.TimeoutExpired: + process.send_signal(signal.SIGABRT) + process.wait(timeout=5) + stderr.seek(0) + pytest.fail( + f"modpoll did not exit within 5 s of {sig.name}:\n{stderr.read()}" + ) + assert returncode == 0 finally: if process.poll() is None: process.kill() process.wait(timeout=5) + stderr.close() server.shutdown() thread.join(timeout=5)