From 4eb490be1b94a2d37bcd5c7bd2fd147e6465f3bc Mon Sep 17 00:00:00 2001
From: Antonis Christofides <antonis@antonischristofides.com>
Date: Sat, 30 Nov 2024 17:34:17 +0200
Subject: [PATCH] Update github action

---
 .github/workflows/run-tests-automatically.yml | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/run-tests-automatically.yml b/.github/workflows/run-tests-automatically.yml
index f149a7ba..979bb8b1 100644
--- a/.github/workflows/run-tests-automatically.yml
+++ b/.github/workflows/run-tests-automatically.yml
@@ -1,4 +1,4 @@
-name: Build
+name: Tests
 
 on:
   push:
@@ -13,7 +13,7 @@ jobs:
     runs-on: ubuntu-22.04
     strategy:
       matrix:
-        python-version: ["3.9", "3.10"]
+        python-version: ["3.11"]
 
     steps:
     - uses: actions/checkout@v3
@@ -24,7 +24,7 @@ jobs:
     - name: Set up Node 
       uses: actions/setup-node@v3
       with:
-        node-version: '10'
+        node-version: '18'
     - name: Set up Chrome
       uses: browser-actions/setup-chrome@latest
     - name: Set up chromedriver
@@ -42,7 +42,7 @@ jobs:
         sudo -u postgres psql -U postgres -c "create database openmeteo owner runner"
         python -m pip install --upgrade pip 'setuptools<58'  # See https://stackoverflow.com/questions/69123406
         CPLUS_INCLUDE_PATH=/usr/include/gdal C_INCLUDE_PATH=/usr/include/gdal pip install 'gdal==3.4.1'
-        pip install 'psycopg2>=2.8,<2.9' codecov coverage isort flake8 'black>=22.8,<23'
+        pip install 'psycopg2>=2.8,<2.9' codecov coverage isort flake8 'black<25'
         pip install -r requirements.txt
         pip install -r requirements-dev.txt
         npm install
@@ -52,8 +52,13 @@ jobs:
         python manage.py makemigrations --check
         black --check .
         flake8 --max-line-length=88 .
-        isort --check-only --diff .
+        isort --check-only --diff --profile=black .
         npm run lint
         coverage run --include="./*" --omit="*/tests/*","*/tests.py","*/migrations/*","./enhydris_project/*" manage.py test -v2
+        coverage json
         npm run test
-        codecov
+
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v4
+        with:
+          token: ${{ secrets.CODECOV_TOKEN }}