From 4f4336b59b3644f58ae2cdb9b5d10ade620218af Mon Sep 17 00:00:00 2001 From: Everett Pompeii Date: Wed, 20 Nov 2024 15:38:04 -0500 Subject: [PATCH] ci: Update Bencher CLI usage (#3100) --- .github/workflows/benchmark_pr_track.yml | 49 +++++--------- tailcall-wasm/example/browser/index.html | 81 ++++++++++++------------ 2 files changed, 55 insertions(+), 75 deletions(-) diff --git a/.github/workflows/benchmark_pr_track.yml b/.github/workflows/benchmark_pr_track.yml index 3dbfd9cf30..1f460a26ba 100644 --- a/.github/workflows/benchmark_pr_track.yml +++ b/.github/workflows/benchmark_pr_track.yml @@ -18,43 +18,22 @@ jobs: PR_EVENT: event.json steps: - name: Download Benchmark Results - uses: actions/github-script@v7 + uses: dawidd6/action-download-artifact@v6 with: - script: | - async function downloadArtifact(artifactName) { - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip + name: ${{ env.BENCHMARK_RESULTS }} + run_id: ${{ github.event.workflow_run.id }} + - name: Download PR Event + uses: dawidd6/action-download-artifact@v6 + with: + name: ${{ env.PR_EVENT }} + run_id: ${{ github.event.workflow_run.id }} - name: Export PR Event Data uses: actions/github-script@v7 with: script: | let fs = require('fs'); let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); - core.exportVariable("PR_HEAD", `${prEvent.number}/merge`); + core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha); core.exportVariable("PR_NUMBER", prEvent.number); @@ -64,12 +43,14 @@ jobs: bencher run \ --project tailcall \ --token '${{ secrets.BENCHER_API_TOKEN }}' \ - --branch '${{ env.PR_HEAD }}' \ - --branch-start-point '${{ env.PR_BASE }}' \ - --branch-start-point-hash '${{ env.PR_BASE_SHA }}' \ + --branch "$PR_HEAD" \ + --start-point "$PR_BASE" \ + --start-point-hash "$PR_BASE_SHA" \ + --start-point-clone-thresholds \ + --start-point-reset \ --testbed benchmarking-runner \ --adapter rust_criterion \ --err \ --github-actions '${{ secrets.GITHUB_TOKEN }}' \ - --ci-number '${{ env.PR_NUMBER }}' \ + --ci-number "$PR_NUMBER" \ --file "$BENCHMARK_RESULTS" diff --git a/tailcall-wasm/example/browser/index.html b/tailcall-wasm/example/browser/index.html index a9cacc5cf1..ed07277f43 100644 --- a/tailcall-wasm/example/browser/index.html +++ b/tailcall-wasm/example/browser/index.html @@ -1,48 +1,47 @@ - - - hello-wasm example - - + + + hello-wasm example + + +
+ + + +

+
-
- - - -

-
+ - + let builder = new TailcallBuilder() + builder = await builder.with_config(schemaUrl) + executor = await builder.build() + let btn = document.getElementById("btn") + btn.addEventListener("click", runQuery) + } catch (error) { + alert("error: " + error) + } + } + async function runQuery() { + let query = document.getElementById("queryInput").value + try { + document.getElementById("result").textContent = await executor.execute(query) + } catch (error) { + console.error("Error executing query: " + error) + document.getElementById("result").textContent = "Error: " + error + } + } + setup() + +