Add more information to the helpful string 'database error' #16
Workflow file for this run
This file contains 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
on: | |
push: | |
branches: | |
- master | |
- jgilles/bottest2 | |
workflow_dispatch: | |
inputs: | |
pr_number: | |
description: 'Pull Request Number' | |
required: false | |
default: '' | |
issue_comment: | |
types: [created] | |
name: Benchmarks | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
jobs: | |
benchmark: | |
name: run 30-bot bot test | |
runs-on: bots-runner | |
# filter for a comment containing 'benchmarks please' | |
if: ${{ github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, 'bots please')) }} | |
env: | |
PR_NUMBER: ${{ github.event.inputs.pr_number || github.event.issue.number || null }} | |
steps: | |
- name: Check membership | |
if: ${{ github.event_name == 'issue_comment' }} | |
env: | |
CONTRIB_ORG: clockworklabs | |
COMMENT_AUTHOR: ${{ github.event.comment.user.login }} | |
ORG_READ_TOKEN: ${{ secrets.ORG_READ_TOKEN }} | |
run: | | |
curl -OL https://github.com/cli/cli/releases/download/v2.37.0/gh_2.37.0_linux_amd64.deb && sudo dpkg -i gh_2.37.0_linux_amd64.deb | |
if [[ $(GH_TOKEN=$ORG_READ_TOKEN gh api --paginate /orgs/{owner}/members --jq 'any(.login == env.COMMENT_AUTHOR)') != true ]]; then | |
gh pr comment $PR_NUMBER -b "Sorry, you don't have permission to run benchmarks." | |
exit 1 | |
fi | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Post initial comment | |
run: | | |
if [[ $PR_NUMBER ]]; then | |
comment_parent=issues/$PR_NUMBER | |
comment_update=issues/comments | |
else | |
comment_parent=commits/$GITHUB_SHA | |
comment_update=comments | |
fi | |
comment_body="Bot test in progress..." | |
comment_id=$(gh api "/repos/{owner}/{repo}/$comment_parent/comments" -f body="$comment_body" --jq .id) | |
echo "COMMENT_UPDATE_URL=/repos/{owner}/{repo}/$comment_update/$comment_id" >>$GITHUB_ENV | |
- name: find PR branch | |
if: ${{ env.PR_NUMBER }} | |
run: echo "PR_REF=$(gh pr view $PR_NUMBER --json headRefName --jq .headRefName)" >>"$GITHUB_ENV" | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.PR_REF || github.ref }} | |
# if we're on master we want to know what the sha of HEAD~1 is so | |
# that we can compare results from it to HEAD (in the "Fetch markdown | |
# summary PR" step). otherwise, we can use a fully shallow checkout | |
fetch-depth: ${{ env.PR_NUMBER && 1 || 2 }} | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
components: clippy | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
override: true | |
- name: Run bot test script | |
run: | | |
echo "We're on a bots runner, so expecting to find bots and tracy in their expected locations" | |
export BOTS_DIR="$HOME/bots" | |
export TRACY_CAPTURE_BIN="$HOME/tracy/capture/build/unix/capture-release" | |
crates/bench/bottest.sh | |
mkdir bottest-results | |
cp crates/bench/bottest/bottest.zip bottest-results/$RESULTS_NAME.zip | |
# this will work for both PR and master | |
- name: Upload bot test results to DO spaces | |
uses: shallwefootball/s3-upload-action@master | |
with: | |
aws_key_id: ${{ secrets.AWS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} | |
aws_bucket: "spacetimedb-ci-benchmarks" | |
source_dir: bottest-results | |
endpoint: https://nyc3.digitaloceanspaces.com | |
destination_dir: bottests | |
- name: Post comment | |
run: | | |
BODY="<details><summary>Bot test results</summary> | |
Click [here](https://spacetimedb-ci-benchmarks.nyc3.digitaloceanspaces.com/bottests/$RESULTS_NAME.zip) to download a ZIP file with the tracy trace | |
from this test. | |
</details>" | |
gh api "$COMMENT_UPDATE_URL" -X PATCH -f body="$BODY" | |
- name: Post failure comment | |
if: ${{ failure() && env.COMMENT_UPDATE_URL }} | |
run: | | |
BODY="Bot test failed. Please check [the workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details." | |
gh api "$COMMENT_UPDATE_URL" -X PATCH -f body="$BODY" | |
- name: Clean up | |
if: always() | |
run: | | |
rm -fr /stdb/* | |
rm -fr bottest-results/ | |
rm -fr crates/bench/bottest/ |