android-test: sample 3/6/9/12-month wallet tags as WARN only
Pick nearest release tags to 90/180/270/365 days for the older matrix slot; failures there never hard-block (only ≤14d releases can).
This commit is contained in:
parent
a4f525e40c
commit
984b2d6434
4 changed files with 107 additions and 56 deletions
|
|
@ -46,15 +46,57 @@ severity_for_tag() {
|
|||
}
|
||||
|
||||
# List wallet-* release tags newest first (exclude rc/dev).
|
||||
# Args: max count (default 5)
|
||||
# Args: max count (default 5). Pass 0 or "all" for no limit.
|
||||
list_wallet_release_tags() {
|
||||
local n="${1:-5}"
|
||||
local src="${TALER_ANDROID_SRC:-$HOME/taler/taler-android}"
|
||||
[ -d "$src/.git" ] || return 1
|
||||
git -C "$src" fetch --tags origin 2>/dev/null || true
|
||||
git -C "$src" for-each-ref --sort=-creatordate --format='%(refname:short)' refs/tags \
|
||||
| grep -E '^wallet-[0-9]+\.[0-9]+(\.[0-9]+)?$' \
|
||||
| head -n "$n"
|
||||
local cmd=(git -C "$src" for-each-ref --sort=-creatordate --format='%(refname:short)' refs/tags)
|
||||
if [ "$n" = "all" ] || [ "$n" = "0" ]; then
|
||||
"${cmd[@]}" | grep -E '^wallet-[0-9]+\.[0-9]+(\.[0-9]+)?$'
|
||||
else
|
||||
"${cmd[@]}" | grep -E '^wallet-[0-9]+\.[0-9]+(\.[0-9]+)?$' | head -n "$n"
|
||||
fi
|
||||
}
|
||||
|
||||
# Pick one tag closest to each age milestone (days). Always intended as WARN samples.
|
||||
# Default milestones: 3,6,9,12 months ≈ 90,180,270,365 days.
|
||||
# Env: MILESTONE_DAYS="90 180 270 365" MILESTONE_TOLERANCE_DAYS=50
|
||||
# Prints lines: TAG AGE_DAYS TARGET_DAYS (only when a tag within tolerance exists)
|
||||
select_milestone_tags() {
|
||||
local src="${TALER_ANDROID_SRC:-$HOME/taler/taler-android}"
|
||||
local milestones="${MILESTONE_DAYS:-90 180 270 365}"
|
||||
local tol="${MILESTONE_TOLERANCE_DAYS:-50}"
|
||||
local skip="${1:-}" # optional tag to exclude (e.g. current STABLE_TAG)
|
||||
local -a tags=()
|
||||
mapfile -t tags < <(list_wallet_release_tags all 2>/dev/null || true)
|
||||
[ "${#tags[@]}" -gt 0 ] || return 0
|
||||
|
||||
local target best_tag best_age best_delta age t delta
|
||||
local -A used=()
|
||||
for target in $milestones; do
|
||||
best_tag=""
|
||||
best_age=""
|
||||
best_delta=99999
|
||||
for t in "${tags[@]}"; do
|
||||
[ -n "$t" ] || continue
|
||||
[ "$t" = "$skip" ] && continue
|
||||
[ -n "${used[$t]:-}" ] && continue
|
||||
age=$(release_age_days "$t" "$src" 2>/dev/null || true)
|
||||
[[ "$age" =~ ^[0-9]+$ ]] || continue
|
||||
delta=$(( age > target ? age - target : target - age ))
|
||||
if [ "$delta" -le "$tol" ] && [ "$delta" -lt "$best_delta" ]; then
|
||||
best_delta=$delta
|
||||
best_tag=$t
|
||||
best_age=$age
|
||||
fi
|
||||
done
|
||||
if [ -n "$best_tag" ]; then
|
||||
used[$best_tag]=1
|
||||
echo "$best_tag $best_age $target"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Guess F-Droid APK URL for a wallet version name (e.g. 1.6.1).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue