1
1
name : Benchmark
2
2
on :
3
+ push :
4
+ branches :
5
+ - main
3
6
pull_request :
4
7
paths :
5
8
- ' .github/workflows/benchmark.yml'
6
9
- ' src/**'
7
10
- ' tests/**'
8
11
workflow_dispatch :
9
- inputs :
10
- base_commit :
11
- description : The base commit to compare against
12
-
13
12
14
13
permissions :
15
14
contents : read
16
15
17
- concurrency :
18
- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
19
- cancel-in-progress : true
20
-
21
16
env :
22
17
CARGO_REGISTRIES_CRATES_IO_PROTOCOL : sparse
23
18
@@ -28,38 +23,23 @@ jobs:
28
23
steps :
29
24
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
30
25
timeout-minutes : 3
31
- with :
32
- persist-credentials : false
33
- path : " cryptography-pr"
34
- - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
35
- timeout-minutes : 3
36
- with :
37
- repository : " pyca/cryptography"
38
- path : " cryptography-base"
39
- ref : " ${{ github.event.inputs.base_commit || github.base_ref }}"
40
26
- name : Clone test vectors
41
27
timeout-minutes : 2
42
- uses : ./cryptography-base/ .github/actions/fetch-vectors
28
+ uses : ./.github/actions/fetch-vectors
43
29
44
30
- name : Setup python
45
31
id : setup-python
46
32
uses : actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
47
33
with :
48
- python-version : " 3.11 "
34
+ python-version : " 3.12 "
49
35
50
- - name : Create virtualenv (base)
51
- run : |
52
- python -m venv .venv-base
53
- .venv-base/bin/pip install -v -c ./cryptography-base/ci-constraints-requirements.txt "./cryptography-base[test]" ./cryptography-base/vectors/
54
- - name : Create virtualenv (PR)
36
+ - name : Create virtualenv
55
37
run : |
56
- python -m venv .venv-pr
57
- .venv-pr /bin/pip install -v -c ./cryptography-pr/ ci-constraints-requirements.txt "./cryptography-pr [test]" ./cryptography-pr /vectors/
38
+ python -m venv .venv
39
+ .venv/bin/pip install -v -c ./ci-constraints-requirements.txt "./[test]" ./vectors/
58
40
59
- - name : Run benchmarks (base)
60
- run : .venv-base/bin/pytest --benchmark-enable --benchmark-only ./cryptography-pr/tests/bench/ --benchmark-json=bench-base.json --x509-limbo-root=x509-limbo/
61
- - name : Run benchmarks (PR)
62
- run : .venv-pr/bin/pytest --benchmark-enable --benchmark-only ./cryptography-pr/tests/bench/ --benchmark-json=bench-pr.json --x509-limbo-root=x509-limbo/
63
-
64
- - name : Compare results
65
- run : python ./cryptography-pr/.github/compare_benchmarks.py bench-base.json bench-pr.json | tee -a $GITHUB_STEP_SUMMARY
41
+ - name : Run benchmarks
42
+ uses : CodSpeedHQ/action@v2
43
+ with :
44
+ token : ${{ secrets.CODSPEED_TOKEN }}
45
+ run : .venv/bin/pytest --codspeed --benchmark-enable --benchmark-only ./tests/bench/ --benchmark-json=bench-pr.json --x509-limbo-root=x509-limbo/
0 commit comments