github-action-benchmark icon indicating copy to clipboard operation
github-action-benchmark copied to clipboard

Allow writing index.html, data.js without pushing to gh-pages

Open MingweiSamuel opened this issue 4 years ago • 8 comments
trafficstars

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.

MingweiSamuel avatar Oct 29 '21 19:10 MingweiSamuel

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!

pancetta avatar Sep 06 '22 15:09 pancetta

"(...) 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?

brainstorm avatar Jan 05 '23 00:01 brainstorm

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?

pancetta avatar Jan 05 '23 10:01 pancetta

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 existing index.html, data.js in the working directory
    • we for example fetch them from cloud storage, but need to keep an empty branch around because the action requires a branch to read from and commit to
  • 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

robertbastian avatar Feb 15 '23 14:02 robertbastian

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"

MingweiSamuel avatar Feb 15 '23 21:02 MingweiSamuel

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.

latonz avatar Apr 09 '24 03:04 latonz

I believe workflows cannot access artifacts from previous runs.

robertbastian avatar Apr 09 '24 06:04 robertbastian

AFAIK this works with code-coverage-report-action via the GH REST API.

latonz avatar Apr 10 '24 03:04 latonz