Soc renaming #2195
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
| # SPDX-FileCopyrightText: ASSUME Developers | |
| # | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| jupyter: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: '**/pyproject.toml' | |
| - name: Run Jupyter notebooks | |
| run: | | |
| pip install -e . | |
| pip install jupyter | |
| cd examples/notebooks | |
| jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output output.ipynb 01_minimal_manual_example.ipynb | |
| jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output output.ipynb 02_automated_run_example.ipynb | |
| jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output output.ipynb 03_custom_unit_example.ipynb | |
| jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output output.ipynb 10_DSU_and_flexibility.ipynb | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: '**/pyproject.toml' | |
| - name: Cache pre-commit environments | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| python -m pip install -e .[test] | |
| - name: Run pre-commit hooks | |
| uses: pre-commit/[email protected] | |
| with: | |
| extra_args: --all-files --show-diff-on-failure | |
| - name: Test with pytest & integration tests | |
| run: | | |
| pytest -m "not require_learning and not require_network" | |
| - name: Install pypsa dependencies | |
| run: | | |
| python -m pip install -e .[network] | |
| - name: Test with pypsa | |
| run: | | |
| pytest -m "require_network and not require_learning" | |
| - name: Install torch dependencies | |
| run: | | |
| python -m pip install -e .[learning] | |
| - name: Test pytest with torch & integration tests | |
| run: | | |
| pytest --cov --cov-report=xml --junitxml="result.xml" | |
| - name: Upload tests results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.python-version }} | |
| path: | | |
| coverage.xml | |
| result.xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| flags: pytest |