Skip to content

Commit 925a463

Browse files
bhouse-nexthopmshych
authored andcommitted
ci: validate contrib/git-stats gitdm tooling
Add a path-scoped GitHub Action that exercises onie-git-stats end-to-end so the git-stats change can be trusted without manual testing: - Auto-install path: run onie-git-stats with no $GITDM set, asserting it clones the pinned python3 gitdm and produces a non-empty report. - Override path: run again with $GITDM pointing at a pre-existing gitdm, asserting the auto-install cache is NOT re-created and a report is still produced. Triggers only when contrib/git-stats (or this workflow) changes, since nothing else affects the result. Signed-off-by: Brad House <bhouse@nexthop.ai> Signed-off-by: Michael Shych <michaelsh@nvidia.com>
1 parent 2336aae commit 925a463

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: git-stats (gitdm)
2+
3+
# Validate the contrib/git-stats tooling. gitdm is no longer vendored in the
4+
# tree: onie-git-stats auto-installs a pinned python3 gitdm on first run, and
5+
# honors $GITDM to use a pre-existing install instead. This check exercises
6+
# both paths end-to-end (a report is actually generated), so the change can be
7+
# trusted without manual testing. Scoped to contrib/git-stats (and this
8+
# workflow file) since nothing else affects it.
9+
on:
10+
workflow_dispatch:
11+
push:
12+
paths:
13+
- 'contrib/git-stats/**'
14+
- '.github/workflows/git-stats-test.yml'
15+
pull_request:
16+
paths:
17+
- 'contrib/git-stats/**'
18+
- '.github/workflows/git-stats-test.yml'
19+
20+
# Cancel an in-progress run when a newer commit is pushed to the same ref.
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
git-stats:
27+
name: onie-git-stats
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
with:
33+
# onie-git-stats runs "git log <range>"; fetch enough history for it.
34+
fetch-depth: 50
35+
36+
- name: Auto-install path (clone a python3 gitdm, generate a report)
37+
working-directory: contrib/git-stats
38+
run: |
39+
set -eu
40+
./onie-git-stats HEAD~10..HEAD ci
41+
test -d .gitdm # auto-install actually happened
42+
test -s /tmp/ci-results.txt # non-empty text report
43+
test -s /tmp/ci-results.html # non-empty html report
44+
grep -q "Processed" /tmp/ci-results.txt
45+
echo "auto-install path OK"
46+
47+
- name: Override path ($GITDM bypasses the auto-install)
48+
working-directory: contrib/git-stats
49+
run: |
50+
set -eu
51+
# Reuse the gitdm cloned above as a "pre-existing" install, drop the
52+
# auto-install cache, and confirm the override does NOT re-clone it.
53+
mv .gitdm "$RUNNER_TEMP/gitdm"
54+
GITDM="$RUNNER_TEMP/gitdm/gitdm" ./onie-git-stats HEAD~10..HEAD ci2
55+
test ! -e .gitdm # override must skip the clone
56+
test -s /tmp/ci2-results.txt
57+
grep -q "Processed" /tmp/ci2-results.txt
58+
echo "override path OK"

0 commit comments

Comments
 (0)