@@ -5,91 +5,9 @@ name: CI/CD
55
66on :
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
149jobs :
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.
0 commit comments