Setup asv
for historical benchmarking
#39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
pre-commit-ci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip pre-commit | |
- name: Run pre-commit hooks | |
run: pre-commit run --all-files | |
build-and-test-python: | |
runs-on: ubuntu-latest | |
needs: pre-commit-ci | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Analyze code with pylint | |
run: | | |
python -m pip install pylint | |
pylint $(git ls-files '*.py') | |
continue-on-error: true | |
- name: Build | |
run: python -m pip install -e . | |
- name: Test and coverage | |
run: | | |
python -m pip install pytest pytest-cov | |
python -m pytest --cov=src/tqecd $(git ls-files '*_test.py') | |
- name: Mypy type checking | |
run: | | |
python -m pip install mypy | |
mypy src/tqecd | |
coverage-python: | |
runs-on: ubuntu-latest | |
needs: pre-commit-ci | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Install dependencies and tqec package | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e '.[test]' | |
- name: Compute code coverage | |
run: | | |
python -m pytest --cov=tqecd --cov-report=xml:coverage.xml ./ | |
- name: Code Coverage Report | |
uses: irongut/[email protected] | |
with: | |
filename: ./coverage.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: false | |
indicators: true | |
output: both | |
thresholds: "50 75" | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
header: code-coverage | |
recreate: true | |
path: code-coverage-results.md |