Skip to content

Improve getting started (#377) #725

Improve getting started (#377)

Improve getting started (#377) #725

Workflow file for this run

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.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 -r requirements-dev.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/tqec $(git ls-files '*_test.py')
- name: Mypy type checking
run: |
python -m pip install mypy
mypy src/tqec/
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=tqec --cov-report=xml:coverage.xml ./
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
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