Skip to content

Commit

Permalink
Merge pull request #10 from Infleqtion/github-workflows
Browse files Browse the repository at this point in the history
Add github continuous integration workflow
  • Loading branch information
perlinm authored Jan 12, 2024
2 parents 11c4988 + a97e5db commit 83f50d4
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 0 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ] # these are the defaults, plus ready_for_review
branches: [ main ]
workflow_dispatch:
workflow_call:

jobs:
format:
name: Format check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
- name: Format
run: |
checks/format_.py
lint:
name: Lint check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
- name: Pylint
run: |
checks/pylint_.py --all
flake8:
name: Flake8 check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
- name: Flake8
run: |
checks/flake8_.py
mypy:
name: Type check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
- name: Type check
run: |
checks/mypy_.py
coverage:
name: Pytest and Coverage check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
- name: Coverage check
run: |
checks/coverage_.py
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ networkx = ">=2.6.2"
numpy = ">=1.22.0"
sympy = ">=1.12"

# TODO: remove once https://github.com/python/typeshed/issues/11254 is resolved
# more context: https://github.com/Infleqtion/qLDPC/pull/10
types-protobuf = "<=4.24.0.4"

checks-superstaq = { version = ">=0.5.0", optional = true }

[tool.poetry.extras]
Expand Down

0 comments on commit 83f50d4

Please sign in to comment.