WIP: Add benchmarks for the skbio.stats module.
#3
Workflow file for this run
This file contains hidden or 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 Specific Releases | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| new_version: | |
| description: 'New release version to add and benchmark (e.g., 0.6.4)' | |
| required: false | |
| default: '' | |
| benchmark_all: | |
| description: 'Re-benchmark all versions (only needed if benchmark code changed)' | |
| type: boolean | |
| required: false | |
| default: false | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| benchmark-releases: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install ASV | |
| run: pip install asv | |
| - name: Setup versions file | |
| run: | | |
| # Create versions.txt if it doesn't exist | |
| if [ ! -f "versions.txt" ]; then | |
| echo "Creating initial versions.txt file" | |
| # Start with current latest release | |
| echo "0.6.3" > versions.txt | |
| fi | |
| - name: Add new version if specified | |
| if: github.event.inputs.new_version != '' | |
| run: | | |
| NEW_VERSION="${{ github.event.inputs.new_version }}" | |
| echo "Adding new version: $NEW_VERSION" | |
| # Check if version already exists | |
| if grep -q "^$NEW_VERSION$" versions.txt; then | |
| echo "Version $NEW_VERSION already exists in versions.txt" | |
| else | |
| echo "$NEW_VERSION" >> versions.txt | |
| echo "Added $NEW_VERSION to versions.txt" | |
| fi | |
| - name: Show versions to benchmark | |
| run: | | |
| echo "Versions to benchmark:" | |
| cat versions.txt | |
| - name: Install scikit-bio dependencies | |
| run: | | |
| # Install dependencies needed to build scikit-bio from source | |
| pip install numpy scipy cython | |
| - name: Gather machine information | |
| run: | | |
| asv machine --yes | |
| - name: Run benchmarks | |
| run: | | |
| if [ "${{ github.event.inputs.benchmark_all }}" = "true" ]; then | |
| echo "Re-benchmarking all versions (this will take a long time)..." | |
| # Benchmark all versions in the file - only needed if benchmark code changed | |
| asv run HASHFILE:versions.txt | |
| elif [ -n "${{ github.event.inputs.new_version }}" ]; then | |
| echo "Benchmarking new version only (recommended for new releases)..." | |
| # Just benchmark the new version - results will be added to existing data | |
| asv run ${{ github.event.inputs.new_version }}^! | |
| else | |
| echo "Running benchmarks for any missing versions..." | |
| # This will only run benchmarks for versions that don't have results yet | |
| asv run HASHFILE:versions.txt | |
| fi | |
| - name: Generate HTML | |
| run: asv publish | |
| - name: Commit updated versions file | |
| if: github.event.inputs.new_version != '' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add versions.txt | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Add version ${{ github.event.inputs.new_version }} to benchmark list" | |
| git push | |
| fi | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: '.asv/html' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Summary | |
| run: | | |
| echo "Benchmarking completed!" | |
| echo "Results deployed to: ${{ steps.deployment.outputs.page_url }}" | |
| echo "Current benchmark versions:" | |
| cat versions.txt |