Repository: TheLabbingProject/django_dicom (language: python)

Issue:
Migrate CI to GitHub Actions



Discussion / hints:

Fix patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index 963af43..0000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-version: 2.1
-
-orbs:
-  python: circleci/python@0.3.0
-  codecov: codecov/codecov@1.0.5
-
-jobs:
-  build-and-test:
-    working_directory: ~/django_dicom
-    docker:
-      - image: themattrix/tox
-        environment:
-          DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
-          DB_NAME: circle_test
-          DB_USER: root
-          DB_PASSWORD: password
-      - image: circleci/postgres:11
-        environment:
-          POSTGRES_USER: root
-          POSTGRES_DB: circle_test
-          POSTGRES_PASSWORD: password
-    steps:
-      - checkout
-      - run:
-          name: Upgrade pip
-          command: pip install --upgrade pip
-      - python/load-cache
-      - python/install-deps
-      - python/save-cache
-      - run:
-          name: Install tox
-          command: pip install tox
-      - run:
-          name: Test using tox
-          command: touch tests/.env && tox
-      - codecov/upload:
-          file: coverage.xml
-          flags: unittests
-
-workflows:
-  main:
-    jobs:
-      - build-and-test
diff --git a/django_dicom/models/values/integer_string.py b/django_dicom/models/values/integer_string.py
index 79ab3bf..a2aa4d3 100644
--- a/django_dicom/models/values/integer_string.py
+++ b/django_dicom/models/values/integer_string.py
@@ -1,4 +1,4 @@
-"""Definition of the :class:`IntegerString` model."""  # noqa: E902
+"""Definition of the :class:`IntegerString` model."""
 from django.core.validators import MaxValueValidator, MinValueValidator
 from django.db import models
 
diff --git a/django_dicom/models/values/signed_long.py b/django_dicom/models/values/signed_long.py
index 273cce3..a9cc077 100644
--- a/django_dicom/models/values/signed_long.py
+++ b/django_dicom/models/values/signed_long.py
@@ -1,4 +1,4 @@
-"""Definition of the :class:`SignedLong` model."""  # noqa: E902
+"""Definition of the :class:`SignedLong` model."""
 from django.core.validators import MaxValueValidator, MinValueValidator
 from django.db import models
 
@@ -37,4 +37,3 @@ class SignedLong(DataElementValue):
     :attr:`~django_dicom.models.values.data_element_value.DataElementValue.raw`
     to assign an :class:`~django.db.models.IntegerField`.
     """
-    """
diff --git a/django_dicom/models/values/signed_short.py b/django_dicom/models/values/signed_short.py
index c050314..90261d3 100644
--- a/django_dicom/models/values/signed_short.py
+++ b/django_dicom/models/values/signed_short.py
@@ -1,4 +1,4 @@
-"""Definition of the :class:`SignedShort` model."""  # noqa: E902
+"""Definition of the :class:`SignedShort` model."""
 from django.core.validators import MaxValueValidator, MinValueValidator
 from django.db import models
 
@@ -37,4 +37,3 @@ class SignedShort(DataElementValue):
     :attr:`~django_dicom.models.values.data_element_value.DataElementValue.raw`
     to assign an :class:`~django.db.models.IntegerField`.
     """
-    """


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..8637b92
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,47 @@
+name: Tests
+
+on:
+  push:
+    branches: [ "main" ]
+  pull_request:
+    branches: [ "main" ]
+
+permissions:
+  contents: read
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    
+    env:
+      DB_NAME: test_db
+      DB_USER: test_user
+      DB_PASSWORD: password
+    
+    strategy:
+      matrix:
+        python-version: ["3.8", "3.9", "3.10", "3.11"]
+
+    steps:
+    - uses: actions/checkout@v3
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v3
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Setup PostgreSQL
+      uses: Harmon758/postgresql-action@v1.0.0   
+      with:
+        postgresql db: test_db
+        postgresql user: test_user
+        postgresql password: password        
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install pytest coverage
+        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+    - name: Test with pytest
+      run: |
+        coverage run run_tests.py
+    - name: Upload coverage report to codecov.io
+      uses: codecov/codecov-action@v3.1.1