Updated optional dependencies #9
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - devel | |
| pull_request: | |
| branches: | |
| - main | |
| - devel | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' # Adjust as needed | |
| # Cache pip dependencies | |
| - name: Cache pip | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| # Create virtual environment and install project from pyproject.toml | |
| - name: Set up virtual environment and install project | |
| run: | | |
| python -m venv env | |
| source env/bin/activate | |
| pip install --upgrade pip | |
| pip install . | |
| # Run a basic command to check installation | |
| - name: Check installation | |
| run: | | |
| source env/bin/activate | |
| template-python | |
| # Run tests | |
| - name: Run tests | |
| run: | | |
| source env/bin/activate | |
| pytest . | |
| env: | |
| CI: true | |
| # Linting job | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| # Cache pip dependencies | |
| - name: Cache pip | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| # Install linting tools | |
| - name: Install linting tools | |
| run: | | |
| python -m venv env | |
| source env/bin/activate | |
| pip install --upgrade pip | |
| pip install black isort | |
| # Code formatting check with black and isort | |
| - name: Run linters | |
| run: | | |
| source env/bin/activate | |
| black --check src/ | |
| isort --check src/ |