From c4def4a32439bbb9fb05591b458de33081a093e4 Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Fri, 21 Feb 2025 16:08:13 +0100 Subject: [PATCH] ci: switch to sharded upload --- .github/workflows/codspeed.yml | 18 ++++++++-------- pyproject.toml | 11 +++++++--- uv.lock | 38 ++++++++++++++++++++++------------ 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 67fa10d..57dd2f0 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -8,23 +8,23 @@ on: env: PYTHON_VERSION: "3.12" + SHARDS: 4 jobs: benchmarks-instrumentation: strategy: matrix: - include: - - mode: "instrumentation" - runs-on: ubuntu-24.04 - - mode: "walltime" - runs-on: codspeed-macro + shard: [1, 2, 3, 4] + mode: ["instrumentation", "walltime"] - name: Run ${{ matrix.mode }} benchmarks - runs-on: ${{ matrix.runs-on }} + name: "Run ${{ matrix.mode }} benchmarks (Shard #${{ matrix.shard }})" + runs-on: ${{ matrix.mode == 'instrumentation' && 'ubuntu-24.04' || 'codspeed-macro' }} steps: - uses: actions/checkout@v4 with: submodules: "recursive" + - name: Install required-version defined in uv.toml + uses: astral-sh/setup-uv@v5 - uses: actions/setup-python@v2 with: python-version: ${{ env.PYTHON_VERSION }} @@ -32,10 +32,10 @@ jobs: run: | sudo apt-get update sudo apt-get install valgrind -y - pip install . + uv sync --dev sudo apt-get remove valgrind -y - name: Run benchmarks uses: CodSpeedHQ/action@main with: - run: pytest tests/benchmarks/ --codspeed + run: uv run pytest tests/benchmarks/ --codspeed --test-group=${{ matrix.shard }} --test-group-count=${{ env.SHARDS }} token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 601bff5..b6bb7c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,19 +37,24 @@ dependencies = [ ] [project.optional-dependencies] -lint = ["mypy ~= 1.11.2", "ruff ~= 0.6.5"] compat = [ "pytest-benchmark ~= 5.0.0", "pytest-xdist ~= 3.6.1", # "pytest-speed>=0.3.5", ] -test = ["pytest ~= 7.0", "pytest-cov ~= 4.0.0"] [tool.uv.sources] pytest-codspeed = { workspace = true } [dependency-groups] -dev = ["pytest-codspeed"] +dev = [ + "pytest-codspeed", + "mypy ~= 1.11.2", + "ruff ~= 0.6.5", + "pytest ~= 7.0", + "pytest-cov ~= 4.0.0", + "pytest-test-groups>=1.1.0", +] [project.entry-points] pytest11 = { codspeed = "pytest_codspeed.plugin" } diff --git a/uv.lock b/uv.lock index 0b40df2..68c287d 100644 --- a/uv.lock +++ b/uv.lock @@ -346,36 +346,36 @@ compat = [ { name = "pytest-benchmark" }, { name = "pytest-xdist" }, ] -lint = [ - { name = "mypy" }, - { name = "ruff" }, -] -test = [ - { name = "pytest" }, - { name = "pytest-cov" }, -] [package.dev-dependencies] dev = [ + { name = "mypy" }, + { name = "pytest" }, { name = "pytest-codspeed" }, + { name = "pytest-cov" }, + { name = "pytest-test-groups" }, + { name = "ruff" }, ] [package.metadata] requires-dist = [ { name = "cffi", specifier = ">=1.17.1" }, { name = "importlib-metadata", marker = "python_full_version < '3.10'", specifier = ">=8.5.0" }, - { name = "mypy", marker = "extra == 'lint'", specifier = "~=1.11.2" }, { name = "pytest", specifier = ">=3.8" }, - { name = "pytest", marker = "extra == 'test'", specifier = "~=7.0" }, { name = "pytest-benchmark", marker = "extra == 'compat'", specifier = "~=5.0.0" }, - { name = "pytest-cov", marker = "extra == 'test'", specifier = "~=4.0.0" }, { name = "pytest-xdist", marker = "extra == 'compat'", specifier = "~=3.6.1" }, { name = "rich", specifier = ">=13.8.1" }, - { name = "ruff", marker = "extra == 'lint'", specifier = "~=0.6.5" }, ] [package.metadata.requires-dev] -dev = [{ name = "pytest-codspeed", editable = "." }] +dev = [ + { name = "mypy", specifier = "~=1.11.2" }, + { name = "pytest", specifier = "~=7.0" }, + { name = "pytest-codspeed", editable = "." }, + { name = "pytest-cov", specifier = "~=4.0.0" }, + { name = "pytest-test-groups", specifier = ">=1.1.0" }, + { name = "ruff", specifier = "~=0.6.5" }, +] [[package]] name = "pytest-cov" @@ -390,6 +390,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fe/1f/9ec0ddd33bd2b37d6ec50bb39155bca4fe7085fa78b3b434c05459a860e3/pytest_cov-4.0.0-py3-none-any.whl", hash = "sha256:2feb1b751d66a8bd934e5edfa2e961d11309dc37b73b0eabe73b5945fee20f6b", size = 21554 }, ] +[[package]] +name = "pytest-test-groups" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/20/43/ffe71b6037b7efc7dd74ac15880198a167a46e5e917b426405c203b70e38/pytest_test_groups-1.1.0.tar.gz", hash = "sha256:c17a445676969dd4442e1fe03acd8d8dda87bc8f3beee00a80d5d87adc33eb43", size = 4486 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/66/c4/f94b5290f0fe9abe7e09eb55f6ebcf99acf66830ce18cf891450e4816d2e/pytest_test_groups-1.1.0-py3-none-any.whl", hash = "sha256:8210002934b1932a2a1ee94f817109610f3ff371cf48c8c08f709c2f503db71e", size = 4540 }, +] + [[package]] name = "pytest-xdist" version = "3.6.1"