Skip to content

Feature/tree recombination #81

Feature/tree recombination

Feature/tree recombination #81

Workflow file for this run

name: Performance
# Monitor performance of Coreax code.
on:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
performance-check:
name: Check performance
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
gist_id: 3707a122b3697109068a3e55487de4fc
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install package and dependencies
run: pip install -e .
- name: Assess performance
run: python tests/performance/run.py --output-file $RUNNER_TEMP/performance.json
- name: Download historic performance data
if: github.event_name == 'pull_request'
run: gh gist clone ${{ env.gist_id }} $RUNNER_TEMP/historic
- name: Compare performance against historic data
if: github.event_name == 'pull_request'
run: |
# save the commit subject to a file in case it contains any shell
# special characters
git log -1 --pretty=%s > $RUNNER_TEMP/commit_subject.txt
python tests/performance/compare.py \
$RUNNER_TEMP/performance.json \
$RUNNER_TEMP/historic \
--commit-short-hash $(git log -1 --pretty=%h) \
--commit-subject-file $RUNNER_TEMP/commit_subject.txt \
> $RUNNER_TEMP/comment.md
cat $RUNNER_TEMP/comment.md
- name: Comment performance update on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
var fs = require('fs');
const RUNNER_TEMP = process.env.RUNNER_TEMP
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: fs.readFileSync(`${RUNNER_TEMP}/comment.md`, "utf8")
})
- name: Save performance data to Gist
if: github.event_name == 'push'
env:
# this is the only step that should actually need write permissions
GITHUB_TOKEN: ${{ secrets.COVERAGE_GIST_KEY }}
run: |
OUT_NAME="performance-$(date --utc +%Y-%m-%d--%H-%M-%S)--$GITHUB_SHA--v1.json"
gh gist edit ${{ env.gist_id }} -a $OUT_NAME $RUNNER_TEMP/performance.json