Python Tests #27
This file contains hidden or 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 Tests | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * 1' | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('python/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| cd python/ | |
| pip install -e ".[dev]" | |
| - name: Run tests | |
| run: | | |
| cd python/ | |
| pytest --tb=short -v --no-header -q | |
| - name: Upload test results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: | | |
| python/.pytest_cache/ | |
| python/tests/.pytest_cache/ | |
| retention-days: 7 | |
| lint: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-lint-${{ hashFiles('python/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}-lint- | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| cd python/ | |
| pip install -e ".[dev]" | |
| - name: Run flake8 | |
| run: | | |
| cd python/ | |
| flake8 src/greybox/ | |
| - name: Run ruff check | |
| run: | | |
| cd python/ | |
| ruff check src/greybox/ | |
| - name: Run ruff format | |
| run: | | |
| cd python/ | |
| ruff format --check src/greybox/ | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ubuntu-pip-3.13-typecheck-${{ hashFiles('python/pyproject.toml') }} | |
| restore-keys: | | |
| ubuntu-pip-3.13-typecheck- | |
| ubuntu-pip-3.13- | |
| - name: Install dependencies | |
| run: | | |
| cd python/ | |
| pip install -e ".[dev]" | |
| - name: Run mypy | |
| run: | | |
| cd python/ | |
| mypy src/greybox/ --ignore-missing-imports | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ubuntu-pip-3.13-docs-${{ hashFiles('python/pyproject.toml') }} | |
| restore-keys: | | |
| ubuntu-pip-3.13-docs- | |
| ubuntu-pip-3.13- | |
| - name: Install dependencies | |
| run: | | |
| cd python/ | |
| pip install -e ".[docs]" | |
| - name: Build docs | |
| run: | | |
| cd python/ | |
| sphinx-build -W -b html docs docs/_build/html | |
| - name: Upload documentation | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentation | |
| path: python/docs/_build/html/ | |
| retention-days: 7 |