Skip to content

add typing overloads for passing file BinaryIO #353

add typing overloads for passing file BinaryIO

add typing overloads for passing file BinaryIO #353

Workflow file for this run

name: Benchmark
on:
push:
branches: [main]
pull_request:
permissions:
pull-requests: write
contents: read
jobs:
benchmark:
if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no benchmark')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up conda env
uses: prefix-dev/[email protected]
- name: Install repository
run: pixi run postinstall
- name: Cache models
uses: actions/cache@v4
env:
cache-name: benchmark-model-cache
with:
path: examples/benchmark_models
key: models-${{ hashFiles('examples/benchmark.py', '.github/workflows/benchmark.yml') }}
- name: Run benchmark
run: |
python examples/benchmark.py
echo "_(benchmark **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_" >> result.md
cat benchmark.md >> result.md
shell: pixi run bash -e {0}
- name: Comment on PR
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
script: |
fs = require('fs')
const createOrUpdateComment = async (
content,
) => {
// Get all comments
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
})
// Check if any of the comments was posted by the bot and could be replaced
for (const comment of comments.data) {
if (comment.user?.login === 'github-actions[bot]') {
await github.rest.issues.updateComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: content
})
return
}
}
// If not, post a new comment
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: content,
})
}
createOrUpdateComment(fs.readFileSync('result.md', 'utf8'))
- name: Add benchmark to Job Summary
run: cat benchmark.md >> "$GITHUB_STEP_SUMMARY"