Investments: RuntimeApi for redeem and collected tokens #1025
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
name: Benchmark | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
benchmark: | |
permissions: | |
pull-requests: write | |
name: benchmark | |
runs-on: ubuntu-latest-4-cores | |
if: ${{ startsWith(github.event.comment.body, '/benchmark ') && github.event.issue.pull_request && contains(github.event.comment.author_association, 'CONTRIBUTOR') }} | |
env: | |
RUST_TOOLCHAIN: "nightly-2023-10-26" | |
steps: | |
- uses: actions/github-script@v6 | |
name: Parse Runtime From Comment | |
id: parse-runtime | |
with: | |
result-encoding: string | |
script: | | |
console.log("Comment body", context.payload.comment.body) | |
const [, , runtime] = context.payload.comment.body.split(/\W+/) | |
if (!['centrifuge', 'altair'].includes(runtime)) throw new Error('Unsupported Runtime: ${runtime}') | |
return `${runtime}` | |
- uses: actions/github-script@v6 | |
name: Acknowledge Run Comment | |
id: ack-run-comment | |
with: | |
script: | | |
const comment = await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `:clock1: Running Benchmarks for \`${{steps.parse-runtime.outputs.result}}\` :clock1:` | |
}) | |
return comment.data.id | |
- name: Prep build on Ubuntu | |
run: | | |
echo "Pre cleanup" | |
df -h | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
echo "Post cleanup" | |
df -h | |
sudo apt-get install protobuf-compiler | |
- name: Get PR Hash | |
id: get_pr_hash | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
script: | | |
const number = context.payload.issue.number; | |
const pr = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: number | |
}); | |
return pr.data.head.sha | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ steps.get_pr_hash.outputs.result }} | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
default: true | |
- name: Run Benchmark ${{steps.parse-runtime.outputs.result}} | |
run: ./ci/script.sh | |
env: | |
TARGET: benchmark | |
RUNTIME: ${{steps.parse-runtime.outputs.result}} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{steps.parse-runtime.outputs.result}}-weights | |
path: runtime/${{steps.parse-runtime.outputs.result}}/src/weights/ | |
- uses: actions/github-script@v6 | |
name: Notify Benchmark finished | |
with: | |
script: | | |
const id = `${{steps.ack-run-comment.outputs.result}}` | |
await github.rest.issues.updateComment({ | |
comment_id: id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: ` | |
:white_check_mark: Uploaded benchmarks for: \`${{steps.parse-runtime.outputs.result}}\` :white_check_mark: | |
Find the artifact here: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId} | |
` | |
}) |