Repository navigation
83 lines (75 loc) · 2.8 KB
/
Copy pathgithub-backup-tests.yml
File metadata and controls
83 lines (75 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: github-backup tests
# Test verification for infra/github-backup (#5937).
#
# The github-backup regression suite (tests/, 10 files, ~250 checks over
# clone/reconcile/drain/deploy safety) was enumerated by no workflow and
# had no documented CI runner, so it executed only when a human
# remembered. This workflow runs every file in the suite and fails when
# any file exits non-zero.
#
# The tests are plain python3 scripts (stdlib only, no deps) that exit
# non-zero on failure. Three of them — the test_deploy_*.py modules —
# execute their checks at import time and end in sys.exit at module
# level, so `python3 -m unittest discover` errors on them (errors=3)
# instead of running them. The suite is therefore run file-by-file as
# scripts, which is also how the modules document their own invocation
# ("Run: python3 infra/github-backup/tests/test_*.py"). The run step
# counts the files it executed and fails if the glob matched nothing,
# so a green run can never be a silently skipped suite.
#
# The deploy tests drive the real deploy.mjs with stubbed
# bws/wrangler/git executables, so the job provisions Node as well as
# Python. The remaining tests shell out to the real git CLI, which the
# runner image provides.
#
# Trigger policy matches the house pattern since 5a94833ea3:
# dispatch/schedule only, no push/pull_request triggers.
# CI tier policy: see .github/ci-policy.md.
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: "github-backup: regression suite"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version: 24
- name: Run the github-backup regression suite (each file as a script)
run: |
fail=0
count=0
for t in infra/github-backup/tests/test_*.py; do
count=$((count + 1))
echo "::group::$t"
if python3 "$t"; then
echo "PASS: $t"
else
echo "::error::FAIL: $t"
fail=1
fi
echo "::endgroup::"
done
echo "Ran $count test file(s)."
if [ "$count" -eq 0 ]; then
echo "::error::No test files matched infra/github-backup/tests/test_*.py — the suite was not run."
exit 1
fi
if [ "$fail" -ne 0 ]; then
echo "::error::github-backup regression suite: at least one file failed (see above)."
exit 1
fi
echo "github-backup regression suite: all $count files passed."