From 4fbafce5a59ec79acde500adf05bb698b7261798 Mon Sep 17 00:00:00 2001 From: Stefano Piani Date: Thu, 22 May 2025 11:55:41 +0200 Subject: [PATCH 1/2] Fixing bug introduced by the new identation --- src/ogs_riverger/efas/efas_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ogs_riverger/efas/efas_manager.py b/src/ogs_riverger/efas/efas_manager.py index 4496bb8..f475db9 100644 --- a/src/ogs_riverger/efas/efas_manager.py +++ b/src/ogs_riverger/efas/efas_manager.py @@ -670,11 +670,11 @@ def _read_unzipped_efas_files( f"ValueError while trying to read file {file_path}" ) from e - logger.debug("Retrieving rivers' data from the map") - file_content = single_ds.isel( - longitude=lon_indices - i_lon1, - latitude=lat_indices - i_lat1, - ).load() + logger.debug("Retrieving rivers' data from the map") + file_content = single_ds.isel( + longitude=lon_indices - i_lon1, + latitude=lat_indices - i_lat1, + ).load() # Remove the surface variable if "surface" in file_content: From 6926ff5054e45d0a35ce000bceaaeaad0bdcd396 Mon Sep 17 00:00:00 2001 From: Stefano Piani Date: Thu, 22 May 2025 11:59:24 +0200 Subject: [PATCH 2/2] Enabling github workflows for the ci --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++ .github/workflows/pre-commit.yml | 29 +++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 64 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..519ca14 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: test + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +jobs: + test: + name: "Test - Python ${{ matrix.python-version}}" + runs-on: ubuntu-24.04 + + strategy: + matrix: + python-version: ["3.10", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + + - name: Install Poetry + run: pipx install poetry==2.1.3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "poetry" + + - name: Install dependencies + run: poetry install --with dev + + - name: Test with Pytest + run: poetry run pytest diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..0e9ae3f --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,29 @@ +name: precommit + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + precommit: + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - name: Clone repo + uses: actions/checkout@v4 + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install Poetry + run: pipx install poetry==2.1.3 + + - name: Install ogs_riverger + run: poetry install --with dev + + - name: Run precommit + run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files diff --git a/.gitignore b/.gitignore index 2b43cfc..0893278 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ **/__pycache__/ .env +.run/*