adding parameters to asv #8
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: Run Benchmarks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.14' | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies | |
| run: pip install asv virtualenv maturin | |
| # 1. GET OLD HISTORY | |
| - name: Load previous results | |
| continue-on-error: true | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| path: old_pages | |
| # 2. PUT HISTORY WHERE ASV EXPECTS IT | |
| - name: Restore results | |
| run: | | |
| if [ -d "old_pages/results" ]; then | |
| echo "Restoring previous benchmark results..." | |
| mkdir -p microbiorust-py/.asv/results | |
| cp -r old_pages/results/* microbiorust-py/.asv/results/ | |
| else | |
| echo "No previous results found. Starting fresh." | |
| fi | |
| - name: Configure ASV | |
| working-directory: microbiorust-py | |
| run: asv machine --machine "github-runner" --yes | |
| # 3. ADD NEW DATA POINT | |
| - name: Run Benchmarks | |
| working-directory: microbiorust-py | |
| run: asv run HEAD^! --machine "github-runner" --show-stderr --quick | |
| # 4. GENERATE WEBSITE | |
| - name: Generate HTML | |
| working-directory: microbiorust-py | |
| run: asv publish | |
| # 5. PACK NEW HISTORY INTO THE WEBSITE FOLDER (Crucial Step!) | |
| - name: Save results for next time | |
| run: | | |
| # Make sure the destination exists inside the HTML folder | |
| mkdir -p microbiorust-py/.asv/html/results | |
| # Copy the accumulated JSON files (Old + New) into the publish dir | |
| cp -r microbiorust-py/.asv/results/* microbiorust-py/.asv/html/results/ | |
| # 6. UPLOAD EVERYTHING | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: microbiorust-py/.asv/html | |
| publish_branch: gh-pages |