github-action-benchmark
github-action-benchmark copied to clipboard
Allow writing index.html, data.js without pushing to gh-pages
On our gh-pages branch we have a few different things, docs, other benchmarks, etc, and I want finer-grain control over how things are pushed to the branch. I think it makes sense to have an option that outputs these assets (edit: i.e. as html+js files, in a particular directory, without uploading them to git) to the user to let them do what they want with them.
Second that. I struggle to get the html and js file out of the action without any commits, pushes fetches etc. Any plans to make this work? It looks like removing the call to writeBenchmark here might already help, but my fork doesn't work (which is because I have absolutely no experience with writing reusable. public GitHub Actions). Any help is appreciated!
"(...) an option that outputs these assets to the user to let them do what they want with them."
What do you mean by this? Can you be more specific?
I guess having these files as artifacts would be great. Then users can decide what to do with them and where and when. Does that make sense?
I'd like to see this extended to inputs as well. HTML generation should not required Git at all:
- instead of
git checkout gh-pages, the user can put the existingindex.html,data.jsin the working directory- we for example fetch them from cloud storage, but need to keep an
emptybranch around because the action requires a branch to read from and commit to
- we for example fetch them from cloud storage, but need to keep an
- the action updates them with the new results
- instead of
git commit -m "benchmark result for ..."the user can decide what happens with the updated files- i.e. we want to upload to cloud storage
I actually was able to work around this issue, I don't remember exactly how it works:
https://github.com/hydro-project/hydroflow/blob/9d17b4d5da37efcde633a87cf489541cb5371555/.github/workflows/ci.yml#L289-L302
Convert the json into a js file
echo 'window.BENCHMARK_DATA = ' | cat - "$WWW_DIR/bench/data.json" > "$WWW_DIR/bench/data.js"
Just to write the DEFAULT_INDEX_HTML into index.html (the .ts file actually has no typescript)
node --input-type=module -e "$(curl -sSL https://raw.githubusercontent.com/benchmark-action/github-action-benchmark/master/src/default_index_html.ts) console.log(DEFAULT_INDEX_HTML)" > "$WWW_DIR/bench/index.html"
Why not store these files as job artifacts? Other actions (e.g. code-coverage-report-action) do it like this and it works quite well.
I believe workflows cannot access artifacts from previous runs.
AFAIK this works with code-coverage-report-action via the GH REST API.