File: codspeed.yml

package info (click to toggle)
pydantic 2.12.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,640 kB
  • sloc: python: 75,984; javascript: 181; makefile: 115; sh: 38
file content (82 lines) | stat: -rw-r--r-- 2,445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: codspeed

on:
  push:
    branches:
      - main
  pull_request:
  # `workflow_dispatch` allows CodSpeed to trigger backtest
  # performance analysis in order to generate initial data.
  workflow_dispatch:

env:
  UV_FROZEN: true
  UV_PYTHON: 3.13

jobs:
  codspeed-profiling:
    name: CodSpeed profiling
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v5

      - uses: astral-sh/setup-uv@v7

      # Using this action is still necessary for CodSpeed to work:
      - uses: actions/setup-python@v6
        with:
          python-version: ${{ env.UV_PYTHON }}

      - id: core-version
        name: resolve pydantic-core tag
        run: |
          set -uex -o pipefail
          echo core-ref=$(python -c "
          import re
          import tomllib
          pyproject_toml = tomllib.loads(open('pyproject.toml').read())
          core = next(d for d in pyproject_toml['project']['dependencies'] if d.startswith('pydantic-core'))
          if (result := re.search(r'==(.+)', core)) is not None:
            print(f'v{result.group(1)}')
          elif (result := re.search(r'@ git\+https://github\.com/pydantic/pydantic-core\.git@(.+)', core)) is not None:
            print(result.group(1))
          else:
            raise RuntimeError('Could not resolve pydantic-core ref')
          ") >> $GITHUB_OUTPUT

      - name: install deps
        run: uv sync --group testing-extra --extra email --frozen

      - name: checkout pydantic-core
        uses: actions/checkout@v5
        with:
          repository: pydantic/pydantic-core
          ref: ${{ steps.core-version.outputs.core-ref }}
          path: pydantic-core

      - name: install rust stable
        uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools

      - name: cache rust
        uses: Swatinem/rust-cache@v2
        with:
          workspaces: pydantic-core

      - name: install pydantic-core with profiling symbols
        run: |
          cd pydantic-core
          ln -s ../.venv .venv
          uv sync --group all --inexact
          uv pip uninstall pytest-speed
          uv run make build-pgo
        env:
          CARGO_PROFILE_RELEASE_DEBUG: "line-tables-only"
          CARGO_PROFILE_RELEASE_STRIP: "false"

      - name: Run CodSpeed benchmarks
        uses: CodSpeedHQ/action@v4
        with:
          mode: instrumentation
          run: uv run --no-sync pytest ./tests/benchmarks --codspeed