From 83241045c0aae5b90bf7a6011dbdf9e3ede06926 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 08:58:21 +0000 Subject: [PATCH 01/10] fix: consolidate demo deployment workflow Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 73 ++++++++++++++++++---- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index a7677e6..3784325 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -11,6 +11,7 @@ permissions: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + RETAINED_GH_PAGES_BUILDS: 3 jobs: build: @@ -191,23 +192,73 @@ jobs: EOF - - name: Deploy build to gh-pages - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./ - destination_dir: demo/build/${{ steps.sha.outputs.short }} - exclude_assets: "WOLF3D,latest-redirect" - keep_files: true + - name: Stage demo deployment + run: | + SHORT_SHA="${{ steps.sha.outputs.short }}" + mkdir -p "staging/demo/build/${SHORT_SHA}" "staging/demo/build/latest" + cp index.html "staging/demo/build/${SHORT_SHA}/index.html" + cp hra.jsdos "staging/demo/build/${SHORT_SHA}/hra.jsdos" + cp latest-redirect/index.html "staging/demo/build/latest/index.html" - - name: Deploy latest redirect to gh-pages + - name: Deploy demo to gh-pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./latest-redirect - destination_dir: demo/build/latest + publish_dir: ./staging/demo/build + destination_dir: demo/build keep_files: true + - name: Smoke test deployed demo + run: | + SHORT_SHA="${{ steps.sha.outputs.short }}" + for url in \ + "https://luke-b.github.io/DosTest/demo/build/${SHORT_SHA}/" \ + "https://luke-b.github.io/DosTest/demo/build/latest/" + do + echo "Checking ${url}" + curl --fail --silent --show-error --location \ + --retry 6 --retry-delay 30 --retry-all-errors \ + "${url}" > /dev/null + done + + - name: Prune old gh-pages builds + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + git clone --depth=1 --branch gh-pages "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages-prune + cd gh-pages-prune + + build_root="demo/build" + mkdir -p "${build_root}" + + mapfile -t build_dirs < <( + find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ + | grep -v '^latest$' \ + | while read -r dir; do + ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || echo 0)" + printf '%s %s\n' "${ts}" "${dir}" + done \ + | sort -rn \ + | awk '{print $2}' + ) + + if [ "${#build_dirs[@]}" -le "${RETAINED_GH_PAGES_BUILDS}" ]; then + echo "No old builds to prune." + exit 0 + fi + + for dir in "${build_dirs[@]:${RETAINED_GH_PAGES_BUILDS}}"; do + echo "Removing old build ${dir}" + rm -rf "${build_root}/${dir}" + done + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add "${build_root}" + git diff --cached --quiet || git commit -m "chore: prune old demo builds [skip ci]" + git push + update-readme: runs-on: ubuntu-latest needs: deploy-demo From 76d0c694fe9a10b972736a662b638f76fbe9fd65 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:02:05 +0000 Subject: [PATCH 02/10] fix: harden gh-pages pruning workflow Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index 3784325..e4bc2f2 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -217,16 +217,20 @@ jobs: do echo "Checking ${url}" curl --fail --silent --show-error --location \ - --retry 6 --retry-delay 30 --retry-all-errors \ + --retry 6 --retry-delay 15 --retry-all-errors \ "${url}" > /dev/null done + - name: Checkout gh-pages for pruning + uses: actions/checkout@v4 + with: + ref: gh-pages + path: gh-pages-prune + token: ${{ secrets.GITHUB_TOKEN }} + - name: Prune old gh-pages builds - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -euo pipefail - git clone --depth=1 --branch gh-pages "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages-prune cd gh-pages-prune build_root="demo/build" @@ -236,7 +240,7 @@ jobs: find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ | grep -v '^latest$' \ | while read -r dir; do - ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || echo 0)" + ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || date +%s)" printf '%s %s\n' "${ts}" "${dir}" done \ | sort -rn \ From 2df3d40d72029bb0b34de952462317301563388f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:03:36 +0000 Subject: [PATCH 03/10] fix: tune deployment smoke test and prune fallback Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index e4bc2f2..7724fc0 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -217,7 +217,7 @@ jobs: do echo "Checking ${url}" curl --fail --silent --show-error --location \ - --retry 6 --retry-delay 15 --retry-all-errors \ + --retry 4 --retry-delay 10 --retry-all-errors \ "${url}" > /dev/null done @@ -240,7 +240,7 @@ jobs: find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ | grep -v '^latest$' \ | while read -r dir; do - ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || date +%s)" + ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || echo 0)" printf '%s %s\n' "${ts}" "${dir}" done \ | sort -rn \ From 768a58a1a18ad3d6e31b91e51fac87adbe1b6f69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:05:08 +0000 Subject: [PATCH 04/10] fix: clarify sha build pruning logic Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index 7724fc0..db2b654 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -236,7 +236,7 @@ jobs: build_root="demo/build" mkdir -p "${build_root}" - mapfile -t build_dirs < <( + mapfile -t sha_build_dirs < <( find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ | grep -v '^latest$' \ | while read -r dir; do @@ -247,19 +247,19 @@ jobs: | awk '{print $2}' ) - if [ "${#build_dirs[@]}" -le "${RETAINED_GH_PAGES_BUILDS}" ]; then + if [ "${#sha_build_dirs[@]}" -le "${RETAINED_GH_PAGES_BUILDS}" ]; then echo "No old builds to prune." exit 0 fi - for dir in "${build_dirs[@]:${RETAINED_GH_PAGES_BUILDS}}"; do + for dir in "${sha_build_dirs[@]:${RETAINED_GH_PAGES_BUILDS}}"; do echo "Removing old build ${dir}" rm -rf "${build_root}/${dir}" done git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add "${build_root}" + git add --all "${build_root}" git diff --cached --quiet || git commit -m "chore: prune old demo builds [skip ci]" git push From 555918020d2a8c9278936282507e7806a5cbec82 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:06:57 +0000 Subject: [PATCH 05/10] fix: trim smoke retry delay and skip untracked builds Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index db2b654..dd97748 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -217,7 +217,7 @@ jobs: do echo "Checking ${url}" curl --fail --silent --show-error --location \ - --retry 4 --retry-delay 10 --retry-all-errors \ + --retry 4 --retry-delay 5 --retry-all-errors \ "${url}" > /dev/null done @@ -240,7 +240,8 @@ jobs: find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ | grep -v '^latest$' \ | while read -r dir; do - ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || echo 0)" + ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || true)" + [ -n "${ts}" ] || continue printf '%s %s\n' "${ts}" "${dir}" done \ | sort -rn \ From 3db62f6cfda07926cf77a8d4160804f26cbc45b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:08:28 +0000 Subject: [PATCH 06/10] fix: validate retained build count in pruning step Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index dd97748..11e6f7c 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -235,25 +235,32 @@ jobs: build_root="demo/build" mkdir -p "${build_root}" + retain_count="${RETAINED_GH_PAGES_BUILDS}" + + case "${retain_count}" in + ''|*[!0-9]*|0) + echo "RETAINED_GH_PAGES_BUILDS must be a positive integer." >&2 + exit 1 + ;; + esac mapfile -t sha_build_dirs < <( find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ | grep -v '^latest$' \ | while read -r dir; do - ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || true)" - [ -n "${ts}" ] || continue + ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || git show -s --format=%ct HEAD)" printf '%s %s\n' "${ts}" "${dir}" done \ | sort -rn \ | awk '{print $2}' ) - if [ "${#sha_build_dirs[@]}" -le "${RETAINED_GH_PAGES_BUILDS}" ]; then + if [ "${#sha_build_dirs[@]}" -le "${retain_count}" ]; then echo "No old builds to prune." exit 0 fi - for dir in "${sha_build_dirs[@]:${RETAINED_GH_PAGES_BUILDS}}"; do + for dir in "${sha_build_dirs[@]:${retain_count}}"; do echo "Removing old build ${dir}" rm -rf "${build_root}/${dir}" done From c6e047513b613919e4d8726d05da66cab3d86ded Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:10:22 +0000 Subject: [PATCH 07/10] fix: make prune directory scan more portable Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index 11e6f7c..326158b 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -245,10 +245,14 @@ jobs: esac mapfile -t sha_build_dirs < <( - find "${build_root}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ - | grep -v '^latest$' \ - | while read -r dir; do - ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null || git show -s --format=%ct HEAD)" + find "${build_root}" -mindepth 1 -maxdepth 1 -type d \ + | while read -r dir_path; do + dir="$(basename "${dir_path}")" + [ "${dir}" = "latest" ] && continue + if ! ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null)"; then + echo "Failed to determine timestamp for ${build_root}/${dir}" >&2 + exit 1 + fi printf '%s %s\n' "${ts}" "${dir}" done \ | sort -rn \ From e14eff4a80af859f5758718c272a703b2ff94ceb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:12:19 +0000 Subject: [PATCH 08/10] fix: avoid subshell failure in prune ordering Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index 326158b..034da58 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -217,7 +217,7 @@ jobs: do echo "Checking ${url}" curl --fail --silent --show-error --location \ - --retry 4 --retry-delay 5 --retry-all-errors \ + --retry 3 --retry-delay 5 --retry-all-errors \ "${url}" > /dev/null done @@ -244,20 +244,18 @@ jobs: ;; esac - mapfile -t sha_build_dirs < <( - find "${build_root}" -mindepth 1 -maxdepth 1 -type d \ - | while read -r dir_path; do - dir="$(basename "${dir_path}")" - [ "${dir}" = "latest" ] && continue - if ! ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null)"; then - echo "Failed to determine timestamp for ${build_root}/${dir}" >&2 - exit 1 - fi - printf '%s %s\n' "${ts}" "${dir}" - done \ - | sort -rn \ - | awk '{print $2}' - ) + build_timestamps_file="$(mktemp)" + while read -r dir_path; do + dir="$(basename "${dir_path}")" + [ "${dir}" = "latest" ] && continue + if ! ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null)"; then + echo "Failed to determine timestamp for ${build_root}/${dir}" >&2 + exit 1 + fi + printf '%s %s\n' "${ts}" "${dir}" >> "${build_timestamps_file}" + done < <(find "${build_root}" -mindepth 1 -maxdepth 1 -type d) + + mapfile -t sha_build_dirs < <(sort -rn "${build_timestamps_file}" | awk '{print $2}') if [ "${#sha_build_dirs[@]}" -le "${retain_count}" ]; then echo "No old builds to prune." From faf7f25af5fee8954d3d8d427a3c44fcc593acef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:13:51 +0000 Subject: [PATCH 09/10] fix: improve prune step error reporting Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index 034da58..9257853 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -239,7 +239,7 @@ jobs: case "${retain_count}" in ''|*[!0-9]*|0) - echo "RETAINED_GH_PAGES_BUILDS must be a positive integer." >&2 + echo "RETAINED_GH_PAGES_BUILDS must be set to a positive integer." >&2 exit 1 ;; esac @@ -248,8 +248,12 @@ jobs: while read -r dir_path; do dir="$(basename "${dir_path}")" [ "${dir}" = "latest" ] && continue - if ! ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>/dev/null)"; then - echo "Failed to determine timestamp for ${build_root}/${dir}" >&2 + if [ ! -d "${build_root}/${dir}" ]; then + echo "Build directory ${build_root}/${dir} does not exist." >&2 + exit 1 + fi + if ! ts="$(git log -1 --format=%ct -- "${build_root}/${dir}" 2>&1)"; then + echo "Failed to determine timestamp for ${build_root}/${dir}: ${ts}" >&2 exit 1 fi printf '%s %s\n' "${ts}" "${dir}" >> "${build_timestamps_file}" From 0c9b1ce275901ae3ad739ad45c5d1022f5e6f9a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 7 May 2026 09:15:00 +0000 Subject: [PATCH 10/10] fix: guard prune push and filter empty entries Agent-Logs-Url: https://github.com/luke-b/DosTest/sessions/fda21b29-1113-4626-a501-9f33822dfc4e Co-authored-by: luke-b <1448891+luke-b@users.noreply.github.com> --- .github/workflows/borland-dos-pipeline.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/borland-dos-pipeline.yml b/.github/workflows/borland-dos-pipeline.yml index 9257853..d2257c8 100644 --- a/.github/workflows/borland-dos-pipeline.yml +++ b/.github/workflows/borland-dos-pipeline.yml @@ -259,7 +259,7 @@ jobs: printf '%s %s\n' "${ts}" "${dir}" >> "${build_timestamps_file}" done < <(find "${build_root}" -mindepth 1 -maxdepth 1 -type d) - mapfile -t sha_build_dirs < <(sort -rn "${build_timestamps_file}" | awk '{print $2}') + mapfile -t sha_build_dirs < <(sort -rn "${build_timestamps_file}" | awk '{print $2}' | grep -v '^$') if [ "${#sha_build_dirs[@]}" -le "${retain_count}" ]; then echo "No old builds to prune." @@ -274,8 +274,10 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add --all "${build_root}" - git diff --cached --quiet || git commit -m "chore: prune old demo builds [skip ci]" - git push + if ! git diff --cached --quiet; then + git commit -m "chore: prune old demo builds [skip ci]" + git push + fi update-readme: runs-on: ubuntu-latest