-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael R. Blanton
committed
May 11, 2024
1 parent
becf65b
commit 3d210a0
Showing
21 changed files
with
315 additions
and
1,495 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# Changes here will be overwritten by Copier | ||
_commit: v1.4.3 | ||
_commit: v2.0.1 | ||
_src_path: gh:lincc-frameworks/python-project-template | ||
author_email: [email protected] | ||
author_name: Michael R. Blanton | ||
custom_install: false | ||
package_name: kcorrect | ||
project_license: BSD | ||
project_name: kcorrect | ||
project_organization: blanton144 |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,86 @@ | ||
# This workflow will run benchmarks with airspeed velocity (asv) for pull requests. | ||
# It will compare the performance of the main branch with the performance of the merge | ||
# with the new changes and publish a comment with this assessment. | ||
|
||
name: Run ASV benchmarks for PR | ||
# with the new changes. It then publishes a comment with this assessment by triggering | ||
# the publish-benchmarks-pr workflow. | ||
# Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. | ||
name: Run benchmarks for PR | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
PYTHON_VERSION: "3.10" | ||
WORKING_DIR: ${{ github.workspace }}/benchmarks | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
env: | ||
PYTHON_VERSION: "3.10" | ||
WORKING_DIR: ${{ github.workspace }}/benchmarks | ||
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts | ||
|
||
jobs: | ||
setup-python: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Cache Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: python-${{ env.PYTHON_VERSION }} | ||
|
||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "${{ env.PYTHON_VERSION }}" | ||
|
||
- name: Cache Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: python-${{ env.PYTHON_VERSION }} | ||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
asv-pr: | ||
runs-on: ubuntu-latest | ||
needs: setup-python | ||
|
||
permissions: | ||
actions: read | ||
pull-requests: write | ||
|
||
defaults: | ||
run: | ||
working-directory: ${{ env.WORKING_DIR }} | ||
|
||
steps: | ||
- name: Checkout PR branch of the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: python-${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
python -m pip install --upgrade pip | ||
pip install asv==0.5.1 virtualenv tabulate lf-asv-formatter | ||
- name: Get current job logs URL | ||
uses: Tiryoh/gha-jobid-action@v0 | ||
id: jobs | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
job_name: ${{ github.job }} | ||
|
||
- name: Create ASV machine config file | ||
run: asv machine --machine gh-runner --yes | ||
|
||
- name: Run comparison of PR against main branch | ||
run: | | ||
git remote add upstream https://github.com/${{ github.repository }}.git | ||
git fetch upstream | ||
asv continuous upstream/main HEAD || true | ||
asv compare upstream/main HEAD --sort ratio | tee output | ||
python -m lf_asv_formatter | ||
printf "\n\nClick [here]($STEP_URL) to view all benchmarks." >> output | ||
env: | ||
STEP_URL: "${{ steps.jobs.outputs.html_url }}#step:8:1" | ||
|
||
- name: Publish comment to PR | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const workingDir = process.env.WORKING_DIR; | ||
try { | ||
process.chdir(workingDir); | ||
const comment = fs.readFileSync('output', 'utf-8'); | ||
const { data } = await github.rest.issues.createComment({ | ||
...context.repo, | ||
issue_number: context.issue.number, | ||
body: comment, | ||
}); | ||
console.log('Comment published:', data.html_url); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
- name: Checkout PR branch of the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Display Workflow Run Information | ||
run: | | ||
echo "Workflow Run ID: ${{ github.run_id }}" | ||
- name: Cache Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: python-${{ env.PYTHON_VERSION }} | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
python -m pip install --upgrade pip | ||
pip install asv==0.6.1 virtualenv tabulate lf-asv-formatter | ||
- name: Make artifacts directory | ||
run: mkdir -p ${{ env.ARTIFACTS_DIR }} | ||
- name: Save pull request number | ||
run: echo ${{ github.event.pull_request.number }} > ${{ env.ARTIFACTS_DIR }}/pr | ||
- name: Get current job logs URL | ||
uses: Tiryoh/gha-jobid-action@v1 | ||
id: jobs | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
job_name: ${{ github.job }} | ||
- name: Create ASV machine config file | ||
run: asv machine --machine gh-runner --yes | ||
- name: Save comparison of PR against main branch | ||
run: | | ||
git remote add upstream https://github.com/${{ github.repository }}.git | ||
git fetch upstream | ||
asv continuous upstream/main HEAD --verbose || true | ||
asv compare upstream/main HEAD --sort ratio --verbose | tee output | ||
python -m lf_asv_formatter --asv_version "$(echo asv --version)" | ||
printf "\n\nClick [here]($STEP_URL) to view all benchmarks." >> output | ||
mv output ${{ env.ARTIFACTS_DIR }} | ||
env: | ||
STEP_URL: "${{ steps.jobs.outputs.html_url }}#step:11:1" | ||
- name: Upload artifacts (PR number and benchmarks output) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: benchmark-artifacts | ||
path: ${{ env.ARTIFACTS_DIR }} |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.