diff --git a/.github/scripts/make_and_upload_html.py b/.github/scripts/make_and_upload_html.py new file mode 100644 index 0000000..50a3767 --- /dev/null +++ b/.github/scripts/make_and_upload_html.py @@ -0,0 +1,44 @@ +import github +import json +import os +import sys + +key = sys.argv[-1] +git = github.Github(key) + +root_dir = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + os.path.join(os.path.pardir, os.path.pardir)) +with open(os.path.join(root_dir, "data.json")) as f: + data = json.load(f) + +benches = list(data.keys()) +benches.sort() + +html = "" +# html += "

All benchmarks

\n" +html += "
\n" +# for i, b in enumerate(benches): +# html += f"

{b}

\n" +# html += f"
\n" + +html += "\n" + + +r = git.get_repo("bempp/bempp-website") +current = r.get_contents("_includes/_rs_benches.html") + + +r.update_file("_includes/_rs_benches.html", "Update benchmark plots", html, sha=current.sha) diff --git a/.github/scripts/make_html.py b/.github/scripts/make_html.py deleted file mode 100644 index e153368..0000000 --- a/.github/scripts/make_html.py +++ /dev/null @@ -1,31 +0,0 @@ -import json -import os - -root_dir = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - os.path.join(os.path.pardir, os.path.pardir)) -with open(os.path.join(root_dir, "data.json")) as f: - data = json.load(f) - -benches = list(data.keys()) -benches.sort() - -# print("

All benchmarks

") -print("
") -# for i, b in enumerate(benches): -# print(f"

{b}

") -# print(f"
") - -print("") diff --git a/.github/workflows/push-html.yml b/.github/workflows/push-html.yml new file mode 100644 index 0000000..e1ae85a --- /dev/null +++ b/.github/workflows/push-html.yml @@ -0,0 +1,21 @@ +name: Update plots on website + +on: + push: + branches: + - "main" + +jobs: + push-html: + runs-on: ubunut-latest + permissions: + contents: write + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - uses: actions/checkout@v4 + - run: python3 -m pip install PyGithub + - name: Build and push HTML + uses: python3 .github/scripts/make_and_upload_html.py ${{ secrets.GITHUB_TOKEN }} diff --git a/setup.sh b/setup.sh index 58a5f32..7073fe6 100755 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,5 @@ #!/bin/bash +python3 -m pip install PyGithub git clone https://github.com/bempp/bempp-rs cargo install cargo-criterion