diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1aea861..28cf3b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,23 +11,38 @@ jobs: test-python: name: Test Python Code runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v4 - - - name: Setup Pixi - uses: prefix-dev/setup-pixi@v0.8.1 - + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install system libraries + run: | + sudo apt-get update + # ecCodes C library so the `gribapi`/`eccodes` Python bindings import + sudo apt-get install -y libeccodes-dev + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + # Runtime deps needed to import the ocp_tool modules (no conda/pixi). + # pyfesom2 is not imported at module top level, so it is not required here. + pip install numpy scipy netcdf4 xarray matplotlib cartopy pandas pyyaml eccodes + - name: Check Python scripts syntax run: | - pixi run python -m py_compile run_ocp_tool.py - pixi run python -m py_compile ocp_tool/*.py + python -m py_compile run_ocp_tool.py + python -m py_compile ocp_tool/*.py echo "✓ All Python scripts have valid syntax" - + - name: Test import of ocp_tool modules run: | - pixi run python -c " + python -c " from ocp_tool.config import load_config, OCPConfig from ocp_tool.gaussian_grids import generate_gaussian_grid from ocp_tool.lsm import process_land_sea_mask @@ -40,30 +55,35 @@ jobs: code-quality: name: Code Quality Checks runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v4 - - - name: Setup Pixi - uses: prefix-dev/setup-pixi@v0.8.1 + + - name: Set up Python + uses: actions/setup-python@v5 with: - environments: dev - + python-version: '3.11' + + - name: Install linters + run: | + python -m pip install --upgrade pip + pip install flake8 black isort + - name: Run flake8 run: | # Stop the build if there are Python syntax errors or undefined names - pixi run -e dev flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,__pycache__,build,dist,.pixi + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,__pycache__,build,dist,.pixi # Exit-zero treats all errors as warnings - pixi run -e dev flake8 . --count --exit-zero --max-complexity=15 --max-line-length=120 --statistics --exclude=.git,__pycache__,build,dist,.pixi - + flake8 . --count --exit-zero --max-complexity=15 --max-line-length=120 --statistics --exclude=.git,__pycache__,build,dist,.pixi + - name: Check code formatting with black run: | - pixi run -e dev black --check --diff --exclude='(\.git|\.pixi)' . || echo "::warning::Code formatting issues found." - + black --check --diff --exclude='(\.git|\.pixi)' . || echo "::warning::Code formatting issues found." + - name: Check import sorting with isort run: | - pixi run -e dev isort --check-only --diff --skip .pixi . || echo "::warning::Import sorting issues found." + isort --check-only --diff --skip .pixi . || echo "::warning::Import sorting issues found." documentation: name: Documentation Check