Skip to content

Commit bd41633

Browse files
committed
Move benchmarks from GH Actions to ADO; remove cb job from GH workflow
1 parent 5eaf533 commit bd41633

2 files changed

Lines changed: 43 additions & 82 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5,91 +5,9 @@ name: CI/CD
55

66
on:
77
push:
8-
pull_request:
9-
branches: [ dev ]
10-
11-
# This guards against unknown PR until a community member vet it and label it.
12-
types: [ labeled ]
138

149
jobs:
15-
ci:
16-
env:
17-
# Fake a TRAVIS env so that the pre-existing test cases would behave like before
18-
TRAVIS: true
19-
LAB_APP_CLIENT_ID: ${{ secrets.LAB_APP_CLIENT_ID }}
20-
LAB_APP_CLIENT_CERT_BASE64: ${{ secrets.LAB_APP_CLIENT_CERT_BASE64 }}
21-
LAB_APP_CLIENT_CERT_PFX_PATH: lab_cert.pfx
22-
23-
# Derived from https://docs.github.com/en/actions/guides/building-and-testing-python#starting-with-the-python-workflow-template
24-
runs-on: ubuntu-22.04
25-
strategy:
26-
matrix:
27-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
28-
29-
steps:
30-
- uses: actions/checkout@v4
31-
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v5
33-
# It automatically takes care of pip cache, according to
34-
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#about-caching-workflow-dependencies
35-
with:
36-
python-version: ${{ matrix.python-version }}
37-
cache: 'pip'
38-
39-
- name: Install dependencies
40-
run: |
41-
python -m pip install --upgrade pip
42-
python -m pip install flake8 pytest
43-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
44-
- name: Populate lab cert.pfx
45-
# https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#storing-base64-binary-blobs-as-secrets
46-
run: echo $LAB_APP_CLIENT_CERT_BASE64 | base64 -d > $LAB_APP_CLIENT_CERT_PFX_PATH
47-
- name: Test with pytest
48-
run: pytest --benchmark-skip
49-
- name: Lint with flake8
50-
run: |
51-
# stop the build if there are Python syntax errors or undefined names
52-
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
53-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
54-
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
55-
56-
cb:
57-
# Benchmark only after the correctness has been tested by CI,
58-
# and then run benchmark only once (sampling with only one Python version).
59-
needs: ci
60-
runs-on: ubuntu-latest
61-
permissions:
62-
contents: write
63-
steps:
64-
- uses: actions/checkout@v4
65-
- name: Set up Python 3.9
66-
uses: actions/setup-python@v5
67-
with:
68-
python-version: 3.9
69-
cache: 'pip'
70-
- name: Install dependencies
71-
run: |
72-
python -m pip install --upgrade pip
73-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
74-
- name: Setup an updatable cache for Performance Baselines
75-
uses: actions/cache@v4
76-
with:
77-
path: .perf.baseline
78-
key: ${{ runner.os }}-performance-${{ hashFiles('tests/test_benchmark.py') }}
79-
restore-keys: ${{ runner.os }}-performance-
80-
- name: Run benchmark
81-
run: pytest --benchmark-only --benchmark-json benchmark.json --log-cli-level INFO tests/test_benchmark.py
82-
- name: Render benchmark result
83-
uses: benchmark-action/github-action-benchmark@v1
84-
with:
85-
tool: 'pytest'
86-
output-file-path: benchmark.json
87-
fail-on-alert: true
88-
- name: Publish Gibhub Pages
89-
run: git push origin gh-pages
90-
9110
cd:
92-
needs: ci
9311
# Note: github.event.pull_request.draft == false WON'T WORK in "if" statement,
9412
# because the triggered event is a push, not a pull_request.
9513
# This means each commit will trigger a release on TestPyPI.

azure-pipelines.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,46 @@ stages:
2424
- template: .Pipelines/template-pipeline-stages.yml
2525
parameters:
2626
runPublish: false
27+
28+
- stage: Benchmark
29+
displayName: 'Run benchmarks'
30+
dependsOn: CI
31+
# Only run on post-merge pushes to dev — not on PRs or scheduled runs.
32+
# Benchmarks are noisy and the baseline cache is only meaningful on a stable branch.
33+
condition: |
34+
and(
35+
succeeded('CI'),
36+
eq(variables['Build.Reason'], 'IndividualCI')
37+
)
38+
jobs:
39+
- job: Benchmark
40+
displayName: 'Performance benchmarks (Python 3.9)'
41+
pool:
42+
vmImage: ubuntu-latest
43+
steps:
44+
- task: UsePythonVersion@0
45+
inputs:
46+
versionSpec: '3.9'
47+
displayName: 'Set up Python 3.9'
48+
49+
- script: |
50+
python -m pip install --upgrade pip
51+
pip install -r requirements.txt
52+
displayName: 'Install dependencies'
53+
54+
- task: Cache@2
55+
displayName: 'Restore performance baseline cache'
56+
inputs:
57+
key: '"perf-baseline" | "$(Agent.OS)" | tests/test_benchmark.py'
58+
path: .perf.baseline
59+
60+
- bash: |
61+
pytest --benchmark-only --benchmark-json benchmark.json --log-cli-level INFO tests/test_benchmark.py
62+
displayName: 'Run benchmarks'
63+
64+
- task: PublishBuildArtifacts@1
65+
displayName: 'Publish benchmark results'
66+
condition: succeededOrFailed()
67+
inputs:
68+
PathtoPublish: 'benchmark.json'
69+
ArtifactName: 'benchmark-results'

0 commit comments

Comments
 (0)