From 09cf4fea04ac41433b78c8726e5b72cbc689a28e Mon Sep 17 00:00:00 2001 From: Callan Gray Date: Wed, 1 Jan 2025 17:55:06 +0800 Subject: [PATCH 1/2] Run benchmarks once on CI Signed-off-by: Callan Gray --- .github/workflows/ci.yml | 23 ++++++++++++++++++++++- pyproject.toml | 12 +++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f713e4d..6980c8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,4 +53,25 @@ jobs: if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.13') }} uses: codecov/codecov-action@v5 with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} + + benchmark: + needs: qa + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.13 + + - name: Install Poetry + uses: abatilo/actions-poetry@v3.0.1 + with: + poetry-version: 1.2.2 + + - name: Install dependencies + run: poetry install + + - name: Run tests + run: poetry run pytest --benchmark-enable diff --git a/pyproject.toml b/pyproject.toml index 0f633c7..061f1b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,4 +69,14 @@ docstring-convention = 'google' profile = "black" [tool.pytest.ini_options] -addopts = "-v --mypy -p no:warnings --cov=athreading --cov-report=html --doctest-modules --ignore=athreading/__main__.py" +addopts = [ + "-v", + "--mypy", + "-p", + "no:warnings", + "--cov=athreading", + "--cov-report=html", + "--doctest-modules", + "--benchmark-disable", + "--ignore=athreading/__main__.py" +] From a7e270f237eb96157c23e23e0d62ff6b0954fbbd Mon Sep 17 00:00:00 2001 From: Callan Gray Date: Wed, 1 Jan 2025 18:10:26 +0800 Subject: [PATCH 2/2] explicitly pick when to run benchmarks and mypy Signed-off-by: Callan Gray --- .github/workflows/ci.yml | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6980c8e..d3e6bd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: run: poetry install - name: Run tests - run: poetry run pytest --cov-branch --cov-report=xml + run: poetry run pytest --mypy --cov-branch --cov-report=xml - name: Upload coverage reports to Codecov if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python-version == '3.13') }} @@ -74,4 +74,4 @@ jobs: run: poetry install - name: Run tests - run: poetry run pytest --benchmark-enable + run: poetry run pytest --benchmark-enable --benchmark-only diff --git a/pyproject.toml b/pyproject.toml index 061f1b4..94995b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,6 @@ profile = "black" [tool.pytest.ini_options] addopts = [ "-v", - "--mypy", "-p", "no:warnings", "--cov=athreading",