diff --git a/.env b/.env index 316039e1..bd222edc 100644 --- a/.env +++ b/.env @@ -5,7 +5,7 @@ SQL_ENGINE=django.db.backends.postgresql SQL_DATABASE=pigeonhole_dev SQL_USER=pigeonhole SQL_PASSWORD=password -SQL_HOST=db +SQL_HOST=pigeonhole-database SQL_PORT=5432 DATABASE=postgres DJANGO_SUPERUSER_PASSWORD=abc diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..8fe05fad --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,45 @@ +name: Lint CI + +on: + - pull_request + +jobs: + flake8: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + working-directory: ./backend + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Analysing the code with flake8 + working-directory: ./backend + run: | + flake8 pigeonhole/ testapi/ + + ESLint: + runs-on: self-hosted + steps: + + # Check out the repository + - uses: actions/checkout@v3 + + # Install Node.js + - uses: actions/setup-node@v3 + with: + node-version: 18.17.0 + + # Install your dependencies + - name: Install your dependencies + working-directory: ./frontend + run: npm ci + + # Run ESLint + - name: Run ESLint + working-directory: ./frontend + run: npm run lint \ No newline at end of file diff --git a/backend/.flake8 b/backend/.flake8 new file mode 100644 index 00000000..5645f40b --- /dev/null +++ b/backend/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length=120 +exclude=testapi/migrations diff --git a/backend/pigeonhole/urls.py b/backend/pigeonhole/urls.py index 226e7ead..b95080c5 100644 --- a/backend/pigeonhole/urls.py +++ b/backend/pigeonhole/urls.py @@ -14,4 +14,4 @@ path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] -urlpatterns += router.urls \ No newline at end of file +urlpatterns += router.urls diff --git a/backend/requirements.txt b/backend/requirements.txt index d9b87230..3d0d187c 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -2,5 +2,6 @@ Django~=5.0.2 django-cors-headers~=3.14.0 djangorestframework-simplejwt~=5.2.2 djangorestframework~=3.14.0 +flake8==7.0.0 psycopg2-binary~=2.9.5 -pytz~=2022.7.1 +pytz~=2022.7.1 \ No newline at end of file diff --git a/backend/testapi/admin.py b/backend/testapi/admin.py index 8c38f3f3..4185d360 100644 --- a/backend/testapi/admin.py +++ b/backend/testapi/admin.py @@ -1,3 +1,3 @@ -from django.contrib import admin +# from django.contrib import admin # Register your models here. diff --git a/backend/testapi/models.py b/backend/testapi/models.py index 71a83623..0b4331b3 100644 --- a/backend/testapi/models.py +++ b/backend/testapi/models.py @@ -1,3 +1,3 @@ -from django.db import models +# from django.db import models # Create your models here. diff --git a/backend/testapi/serializers.py b/backend/testapi/serializers.py index f65b4605..e38a2148 100644 --- a/backend/testapi/serializers.py +++ b/backend/testapi/serializers.py @@ -11,4 +11,4 @@ class Meta: class GroupSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Group - fields = ['url', 'name'] \ No newline at end of file + fields = ['url', 'name'] diff --git a/backend/testapi/tests.py b/backend/testapi/tests.py index 7ce503c2..a79ca8be 100644 --- a/backend/testapi/tests.py +++ b/backend/testapi/tests.py @@ -1,3 +1,3 @@ -from django.test import TestCase +# from django.test import TestCase # Create your tests here. diff --git a/backend/testapi/views.py b/backend/testapi/views.py index 2361c5c8..93f7d4ad 100644 --- a/backend/testapi/views.py +++ b/backend/testapi/views.py @@ -19,4 +19,4 @@ class GroupViewSet(viewsets.ModelViewSet): """ queryset = Group.objects.all() serializer_class = GroupSerializer - permission_classes = [permissions.AllowAny] \ No newline at end of file + permission_classes = [permissions.AllowAny]