Skip to content

TST: Add nomx export tests for uslib, uklib and jplib #168

TST: Add nomx export tests for uslib, uklib and jplib

TST: Add nomx export tests for uslib, uklib and jplib #168

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- develop
- 'feature/**'
- 'fix/**'
pull_request:
branches:
- main
- develop
permissions:
contents: read
jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout code
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 dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[test]
- name: Install modelx from GitHub (for serializer_7 support)
# TradLife_A is serialized with modelx serializer_version 7, which is
# available on the modelx main branch but not yet released to PyPI
# (latest PyPI release ships up to serializer_6). Override the modelx
# pulled from PyPI with the main-branch build.
run: |
pip install --force-reinstall --no-deps "modelx @ git+https://github.com/fumitoh/modelx.git@main"
- name: Run tests with pytest
run: |
pytest -v
lint:
name: Lint and code quality checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Run flake8
run: |
flake8 lifelib --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 lifelib --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
continue-on-error: true
- name: Check import sorting with isort
run: |
isort --check-only --diff lifelib
continue-on-error: true
- name: Check code formatting with black
run: |
black --check lifelib
continue-on-error: true
test-install:
name: Test package installation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build package
run: |
python -m pip install --upgrade pip build
python -m build
- name: Install package
run: |
pip install dist/*.whl
- name: Test import
run: |
python -c "import lifelib; print(f'lifelib version: {lifelib.__version__}')"