From 3fa87c6a174ad3a72a7efaa577ce933f466b7ee0 Mon Sep 17 00:00:00 2001 From: Andrew Lapp Date: Fri, 17 May 2024 08:16:22 -0500 Subject: [PATCH] fix --- .github/workflows/asv_benchmarks.yml | 18 ++++++++++++++---- .github/workflows/asv_pr.yml | 23 +++++++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/asv_benchmarks.yml b/.github/workflows/asv_benchmarks.yml index 6f919468d..441a8c31a 100644 --- a/.github/workflows/asv_benchmarks.yml +++ b/.github/workflows/asv_benchmarks.yml @@ -1,9 +1,17 @@ -name: Update Historical ASV Benchmarks +name: Update GitHub Pages for Historical ASV Benchmarks on: push: branches: [main] +permissions: + contents: write # Grant write access to repository contents + +env: + PYTHON_VERSION: "3.10" + WORKING_DIR: ${{ github.workspace }}/benchmarks + ARTIFACTS_DIR: ${{ github.workspace }}/artifacts + jobs: update-pages: runs-on: ubuntu-latest @@ -15,13 +23,15 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[test] - pip install asv asv-runner # PR TODO: move to pyprojct.toml + pip install asv + + - name: Create ASV machine config file + run: asv machine --machine gh-runner --yes - name: Run ASV benchmarks run: asv run diff --git a/.github/workflows/asv_pr.yml b/.github/workflows/asv_pr.yml index 928239456..a1c106f84 100644 --- a/.github/workflows/asv_pr.yml +++ b/.github/workflows/asv_pr.yml @@ -4,6 +4,15 @@ on: pull_request: branches: [main] +permissions: + contents: read # Read access for repository contents + pull-requests: write # Write access for pull requests + +env: + PYTHON_VERSION: "3.10" + WORKING_DIR: ${{ github.workspace }}/benchmarks + ARTIFACTS_DIR: ${{ github.workspace }}/artifacts + jobs: benchmark: runs-on: ubuntu-latest @@ -15,13 +24,15 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[test] - pip install asv asv-runner # PR TODO: move to pyprojct.toml + pip install asv + + - name: Create ASV machine config file + run: asv machine --machine gh-runner --yes - name: Run ASV benchmarks run: asv run @@ -31,11 +42,11 @@ jobs: 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 + asv compare upstream/main HEAD --sort ratio --verbose | tee ${{ env.ARTIFACTS_DIR }}/output - name: Post benchmark results as PR comment uses: marocchino/sticky-pull-request-comment@v2 with: - token: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} header: "Benchmark Results" - path: output + path: ${{ env.ARTIFACTS_DIR }}/output