diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 67fa10d..c21e07b 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: + benchmarks: 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,18 @@ 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 + mode: ${{ matrix.mode }} + run: uv run pytest tests/benchmarks/ --codspeed --test-group=${{ matrix.shard }} --test-group-count=${{ env.SHARDS }} token: ${{ secrets.CODSPEED_TOKEN }} + + all-checks: + runs-on: ubuntu-latest + steps: + - run: echo "All CI checks passed." + needs: + - benchmarks diff --git a/pyproject.toml b/pyproject.toml index 7d1ed88..811dadf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,19 +37,24 @@ dependencies = [ ] [project.optional-dependencies] -lint = ["mypy ~= 1.11.2", "ruff ~= 0.11.12"] 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.11.12", + "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 0a56fed..cc69240 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.11.12" }, ] [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.11.12" }, +] [[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.2.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9f/5a/c7874fe15e03d86a1109a3274b57a2473edb8a1dda4a4d27f25d848b6ff5/pytest_test_groups-1.2.1.tar.gz", hash = "sha256:67576b295522fc144b3a42fa1801f50ae962389e984b48bab4336686d09032f1", size = 8137 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/31/ff/7ff0ca5e8051931bf7fb65e31f085f7c0577615bf3a4776fb583cb471800/pytest_test_groups-1.2.1-py3-none-any.whl", hash = "sha256:8c7a016448f9ad347fb69a62f417f0a2358ecbf129fe44bc44ee991918a0bb73", size = 5278 }, +] + [[package]] name = "pytest-xdist" version = "3.6.1"