-
-
Save Nemo157/f35784c5ae2577894d38505f7ac5db7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# Find recent build failures containing a specific message by scraping the | |
# website for builds since a specific nightly (exclusive) | |
# | |
# ./scrape-recent-failures 2022-03-23 'no entry found for key' > fails | |
set -euo pipefail | |
nightly="${1:?missing argument 1: date of last nightly before the problem}" | |
message="${2:?missing argument 2: message to check for}" | |
for page in {1..20} | |
do | |
echo "[34mListing[0m page $page" >&2 | |
curl -sS https://docs.rs/releases/recent-failures/$page \ | |
| pup -p '.release .name text{}' \ | |
| while read -r l | |
do | |
crate="${l%-*}" | |
version="${l##*-}" | |
curl -sS https://docs.rs/crate/$crate/$version/builds \ | |
| pup 'li:first-of-type .release attr{href}' \ | |
| while read -r l | |
do | |
echo "[36mChecking[0m $crate @ $version" >&2 | |
log="$(curl -sS https://docs.rs$l | pup -p 'pre text{}')" | |
if (echo "$log" | egrep -qs "rustc 1\\.[0-9]+\\.[0-9]+-nightly \\([0-9a-f]+ $nightly\\)") | |
then | |
echo "[32mCompleted[0m searching till $nightly" >&2 | |
exit | |
fi | |
if (echo "$log" | grep -qsF "$message") | |
then | |
echo "[33mMatched[0m $crate @ $version" >&2 | |
echo $crate $version | |
fi | |
sleep 1 | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment