From 6bf9183c0dfe4e72af37d9b6f4278be283b8ba68 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 15 Jun 2024 13:29:06 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=A7=B9=F0=9F=9A=87=20Remove=20ASV=20b?= =?UTF-8?q?enchmark=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the ASV config and benchmark was removed on staging there is no reason to keep the failing CI workflows aound until we reintroduce benchmarks at some point --- .github/workflows/full_benchmark.yml | 84 -------------- .github/workflows/pr_benchmark.yml | 119 -------------------- .github/workflows/pr_benchmark_reaction.yml | 97 ---------------- 3 files changed, 300 deletions(-) delete mode 100644 .github/workflows/full_benchmark.yml delete mode 100644 .github/workflows/pr_benchmark.yml delete mode 100644 .github/workflows/pr_benchmark_reaction.yml diff --git a/.github/workflows/full_benchmark.yml b/.github/workflows/full_benchmark.yml deleted file mode 100644 index 7781b82ad..000000000 --- a/.github/workflows/full_benchmark.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: "Full Benchmarks" - -on: - schedule: - - cron: "0 5 * * 5" - workflow_dispatch: - -jobs: - run_benchmark: - if: github.repository_owner == 'glotaran' - name: "Run AVS" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - name: Install ASV - run: | - pip install asv virtualenv - - name: Create machine-file - shell: python - run: | - from pathlib import Path - machine_file = Path("/home/runner/.asv-machine.json") - machine_file_content = ''' - { - "gh_action": { - "arch": "x86_64", - "cpu": "Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz", - "num_cpu": "2", - "machine": "gh_action", - "os": "Linux 5.8.0-1033-azure", - "ram": "7GB" - }, - "version": 1 - }''' - machine_file.write_text(machine_file_content) - - name: Run benchmarks - run: | - pushd benchmark - asv run 0d41d63ca3ca33bb0b70e25fe76ab0c16f6d2e1d..main --machine gh_action - - name: Upload results - uses: actions/upload-artifact@v3 - with: - name: benchmark-results - path: benchmark/.asv/results - - upload_results: - name: "Upload Results" - needs: [run_benchmark] - runs-on: ubuntu-latest - steps: - - name: Checkout benchmark result repo - uses: actions/checkout@v4 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token - fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - repository: "glotaran/pyglotaran-benchmarks" - ref: main - - - name: Download result artifact - uses: actions/download-artifact@v3 - with: - name: benchmark-results - path: results - - - name: Commit results - run: | - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git config user.name 'github-actions[bot]' - git add results - git commit -m "⬆️ Update full benchmark" - - - name: Push result repo - uses: ad-m/github-push-action@v0.6.0 - with: - github_token: ${{ secrets.BENCHMARK_PUSH_TOKEN }} - repository: "glotaran/pyglotaran-benchmarks" - branch: main diff --git a/.github/workflows/pr_benchmark.yml b/.github/workflows/pr_benchmark.yml deleted file mode 100644 index 97b905a4b..000000000 --- a/.github/workflows/pr_benchmark.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: "PR Benchmarks" - -on: - pull_request: - -jobs: - run_benchmark: - name: "Run AVS" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - name: Install ASV - run: | - pip install 'asv!=0.5' virtualenv packaging - - - name: show home file - run: | - ls -lah ~ - realpath ~ - - name: Create machine-file - shell: python - run: | - from pathlib import Path - machine_file = Path("/home/runner/.asv-machine.json") - machine_file_content = ''' - { - "gh_action": { - "arch": "x86_64", - "cpu": "Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz", - "num_cpu": "2", - "machine": "gh_action", - "os": "Linux 5.8.0-1033-azure", - "ram": "7GB" - }, - "version": 1 - }''' - machine_file.write_text(machine_file_content) - - - name: Run PR compare benchmarks - id: benchmark_run - run: | - git remote add upstream https://github.com/glotaran/pyglotaran - git fetch upstream - pushd benchmark - last_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)") - asv run "$last_tag^..$last_tag" --machine gh_action - asv run upstream/main^..upstream/main --machine gh_action - asv run HEAD^..HEAD --machine gh_action - asv publish - echo "last_tag=$last_tag" >> "$GITHUB_OUTPUT" - - - name: Checkout benchmark result repo - uses: actions/checkout@v4 - with: - repository: "glotaran/pyglotaran-benchmarks" - ref: main - path: benchmark-repo - - name: Copy benchmark workflows to html folder - run: | - cp -r benchmark-repo/.github benchmark/.asv/html - ls -lah benchmark/.asv/html - - - name: Create PR comment body - shell: python - env: - PR_NR: ${{github.event.number}} - run: | - import os - from pathlib import Path - import subprocess - - pr_nr = os.environ.get("PR_NR") - diff_release_main = subprocess.run( - ["asv", "--config=benchmark/asv.conf.json", "compare", "${{steps.benchmark_run.outputs.last_tag}}", "upstream/main"], - capture_output=True, - ) - diff_main_PR = subprocess.run( - ["asv", "--config=benchmark/asv.conf.json", "compare", "upstream/main", "HEAD"], - capture_output=True, - ) - comment = f"""\ - Benchmark is done. Checkout the [benchmark result page](https://glotaran.github.io/pyglotaran-benchmarks/prs/pr-{pr_nr}). - Benchmark differences below 5% might be due to CI noise. -
- - Benchmark diff ${{steps.benchmark_run.outputs.last_tag}} vs. main - - - ``` - {diff_release_main.stdout.decode()} - ``` -
- -
- - Benchmark diff main vs. PR - - - ``` - {diff_main_PR.stdout.decode()} - ``` -
- """ - - Path("benchmark/.asv/html/pr-diff-comment.txt").write_text(comment) - Path("benchmark/.asv/html/origin_pr_nr.txt").write_text(pr_nr) - - - name: Upload PR html results - uses: actions/upload-artifact@v3 - with: - name: benchmark-pr-html - path: benchmark/.asv/html diff --git a/.github/workflows/pr_benchmark_reaction.yml b/.github/workflows/pr_benchmark_reaction.yml deleted file mode 100644 index 37d64d290..000000000 --- a/.github/workflows/pr_benchmark_reaction.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: PR Benchmark reaction - -# read-write repo token -# access to secrets -on: - workflow_run: - workflows: ["PR Benchmarks"] - types: - - completed - -jobs: - upload: - name: Comment and upload - runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - steps: - - name: Download artifact - uses: actions/github-script@v6 - with: - script: | - var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "benchmark-pr-html" - })[0]; - var download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/benchmark-pr-html.zip', Buffer.from(download.data)); - - - name: Unzip PR Benchmark results - run: | - unzip benchmark-pr-html.zip - rm benchmark-pr-html.zip - - - name: Show tree - run: tree -a . - - - name: Set PR comment - id: bench_diff - shell: python - run: | - import os - from pathlib import Path - - with open(os.getenv("GITHUB_OUTPUT"), "a", encoding="utf8") as f: - comment_file_path = Path("pr-diff-comment.txt") - f.write(f"comment< Date: Sat, 15 Jun 2024 13:46:45 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI_CD_actions.yml | 15 ++++++++------- .../workflows/autoupdate-pre-commit-config.yml | 4 ++-- .github/workflows/doxygen.yml | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI_CD_actions.yml b/.github/workflows/CI_CD_actions.yml index 08a2e8946..8882a58e9 100644 --- a/.github/workflows/CI_CD_actions.yml +++ b/.github/workflows/CI_CD_actions.yml @@ -17,7 +17,7 @@ jobs: - name: Check out repo uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Run pre-commit @@ -33,7 +33,7 @@ jobs: conda-channels: conda-forge activate-conda: false - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -58,7 +58,7 @@ jobs: conda-channels: conda-forge activate-conda: false - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -81,7 +81,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -106,7 +106,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -121,9 +121,10 @@ jobs: python -m pytest --cov=./ --cov-report term --cov-report xml --cov-config pyproject.toml tests - name: Codecov Upload - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} deploy: runs-on: ubuntu-latest @@ -137,7 +138,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" diff --git a/.github/workflows/autoupdate-pre-commit-config.yml b/.github/workflows/autoupdate-pre-commit-config.yml index b0f3ad4af..9779e11dd 100644 --- a/.github/workflows/autoupdate-pre-commit-config.yml +++ b/.github/workflows/autoupdate-pre-commit-config.yml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Python - uses: actions/setup-python@v4 - - uses: actions/cache@v3 + uses: actions/setup-python@v5 + - uses: actions/cache@v4 with: path: ~/.cache/pre-commit key: pre-commit-autoupdate diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 72b6d43ec..2ed941155 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies From d8b9053c147da89eeda8b7fc19d9f30a4e3d8800 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 15 Jun 2024 13:47:50 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=87=F0=9F=A9=B9=20Remove=20unsed?= =?UTF-8?q?=20env=20for=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we don't use a GH env for release this would break the release --- .github/workflows/CI_CD_actions.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/CI_CD_actions.yml b/.github/workflows/CI_CD_actions.yml index 8882a58e9..31f79bdd3 100644 --- a/.github/workflows/CI_CD_actions.yml +++ b/.github/workflows/CI_CD_actions.yml @@ -130,9 +130,6 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') needs: [test, docs, docs-notebooks] - environment: - name: pypi - url: https://pypi.org/p/pyglotaran permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: From ea77b771300e26c03832429fb442e40b490e5968 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 15 Jun 2024 13:51:13 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9A=87=F0=9F=A9=B9=20Change=20link=20?= =?UTF-8?q?to=20tee=20docks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While the link works their setting prevent bots from visiting it breaking the the CI link check --- glotaran/utils/tee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glotaran/utils/tee.py b/glotaran/utils/tee.py index cda4566b9..72713571f 100644 --- a/glotaran/utils/tee.py +++ b/glotaran/utils/tee.py @@ -14,7 +14,7 @@ class TeeContext: """Context manager that allows to work with string written to stdout. This context manager behaves similar to the ``tee`` shell command. - https://linuxize.com/post/linux-tee-command + https://www.geeksforgeeks.org/tee-command-linux-example """ def __init__(self) -> None: