Extended the CI #10
Workflow file for this run
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 | |
| # Static analysis | |
| static-analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v4 | |
| - name: Download and run cloc | |
| run: | | |
| curl -s https://raw.githubusercontent.com/AlDanial/cloc/master/cloc > cloc | |
| chmod +x cloc | |
| ./cloc --version | |
| ./cloc $(git ls-files) | |
| - name: Code formatting with black | |
| run: | | |
| pip install black | |
| pip install "black[jupyter]" | |
| black --check src/ | |
| - name: Code formatting with isort | |
| run: | | |
| pip install isort | |
| isort --check src/ | |
| - name: Code formatting with prospector | |
| continue-on-error: true | |
| run: | | |
| pip install mypy | |
| mypy src/ | |
| - name: Code formatting with prospector | |
| continue-on-error: true | |
| run: | | |
| pip install prospector | |
| prospector src/ | |
| - name: Code formatting with ruff | |
| continue-on-error: true | |
| run: | | |
| pip install ruff | |
| ruff check src/ | |
| - name: Code formatting with pylint | |
| continue-on-error: true | |
| run: | | |
| pip install pylint | |
| pylint src/ |