forked from namalkanti/bloch-simulator-python
-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (46 loc) · 1.69 KB
/
python-package.yml
File metadata and controls
57 lines (46 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Python package
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install OS build dependencies (C extension)
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install Python tooling
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install flake8
# Install your project (this pulls deps from pyproject.toml, including numpy/scipy/matplotlib)
- name: Install package + runtime deps (PEP 517)
run: |
python -m pip install -e . --use-pep517
# Build the extension in the checkout so "import bloch" (from repo) can find the .so
- name: Build C extension in-place
run: |
python setup.py build_ext --inplace
- name: Verify extension is importable (from checkout)
run: |
python -c "import bloch.bloch_simulator as m; print('OK:', m)"
# Make lint non-blocking and exclude generated dirs (recommended)
- name: Lint with flake8 (non-blocking)
run: |
flake8 . --count --exit-zero --max-line-length=127 --statistics --exclude build,dist,*.egg-info,__pycache__
- name: Test with unittest
run: |
python -m unittest discover -v -s bloch/tests -t .