no need to convert bytearray
to bytes
when using recent versions …
#85
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: Python package | |
on: [push, pull_request] | |
env: | |
PY_COLORS: "1" | |
jobs: | |
codegen: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.11"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install nala | |
pip install -e . | |
- name: Test | |
run: | | |
env PYTHONPATH=. python examples/hello_world.py | |
env PYTHONPATH=. python examples/diagnostics/did.py | |
make test-c-clean | |
make test-c | |
make test-c-clean | |
CC=gcc make test-c | |
make test-c-clean | |
CC=clang make test-c-src | |
- name: Coveralls | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
parallel: true | |
flag-name: Code Generator Test | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ "ubuntu-latest", "windows-latest", "macos-latest" ] | |
python-version: ["3.8", "3.11", "pypy-3.9"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: Install optional windows dependencies | |
run: | | |
python -m pip install -e ".[windows-all]" | |
- name: Test | |
run: | | |
tox -e gh | |
- name: Coveralls | |
if: matrix.os == 'ubuntu-latest' | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
parallel: true | |
flag-name: Test ${{ matrix.os }} ${{ matrix.python-version }} | |
coveralls_finish: | |
needs: [test, codegen] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
parallel-finished: true | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mypy ruff | |
pip install -e .[plot] | |
- name: Static type checking with mypy | |
run: | | |
mypy --python-version 3.8 . | |
mypy --python-version 3.9 . | |
mypy --python-version 3.10 . | |
mypy --python-version 3.11 . | |
- name: Run linters | |
run: | | |
ruff check ./src | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r docs/requirements.txt | |
pip install -e . | |
- name: Build documentation | |
run: | | |
python -m sphinx -Ean docs build | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Build wheel and sdist | |
run: pipx run build | |
- name: Check build artifacts | |
run: pipx run twine check --strict dist/* | |
release: | |
needs: [test, codegen, linter, build] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: | | |
python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: | | |
git clean -dfx | |
python -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
skip_existing: true | |
password: ${{ secrets.pypi_password }} |