Created
April 17, 2025 15:04
-
-
Save bollwyvl/2460433d626e9a62d25f2b1bbd8fb0b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
- read the code so you know it's not crazy | |
- paste this into your logged-in browser session on github (maybe 'allow pasting') | |
- run it | |
- update with new COMMITS | |
*/ | |
COMMITS = { | |
vale: {v0: "4f829d3ccb335d75abc825543dbf068bda938916", v1: "8a4fd98e738fcc3376b9ea316319c220a515e4b8"}, | |
dagster: {v0: "76c76e86bc306ff05ca1fa650a188450bd4da605", v1: "2d18ce2ed3863d7782bd7f561f6175658d505f6e"}, | |
} | |
async function maxDuration(pkg, commit) { | |
const RE_DURATION = /^Successful in (.*)m$/ | |
const url = `https://github.com/conda-forge/${pkg}-feedstock/commit/${commit}/status-details` | |
const req = await fetch(url, {headers: {"Accept": "application/json"}}) | |
const status = await req.json() | |
const durations = []; | |
for(const run of status.checkRuns) { | |
const match = `${run.additionalContext}`.match(RE_DURATION); | |
if(match) { | |
durations.push(parseFloat(match[1])) | |
} | |
} | |
return Math.max(...durations); | |
} | |
async function ciDelta(pkgCommits) { | |
const [pkg, commits] = pkgCommits; | |
let data = {pkg, v0: await maxDuration(pkg, commits.v0), v1: await maxDuration(pkg, commits.v1)}; | |
data.d = data.v0 - data.v1; | |
data.speedup = Math.floor((data.d / data.v0) * 100); | |
return data; | |
} | |
console.table(await Promise.all(Object.entries(COMMITS).map(ciDelta))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment