Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8 GitHub actions testing linting #13

Merged
merged 7 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions backend/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length=120
exclude=drtrottoir/migrations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this to our project?

2 changes: 1 addition & 1 deletion backend/pigeonhole/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]

urlpatterns += router.urls
urlpatterns += router.urls
1 change: 1 addition & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ djangorestframework-simplejwt~=5.2.2
djangorestframework~=3.14.0
psycopg2-binary~=2.9.5
pytz~=2022.7.1
flake8==7.0.0
2 changes: 1 addition & 1 deletion backend/testapi/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.contrib import admin
# from django.contrib import admin

# Register your models here.
2 changes: 1 addition & 1 deletion backend/testapi/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.db import models
# from django.db import models

# Create your models here.
2 changes: 1 addition & 1 deletion backend/testapi/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class Meta:
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ['url', 'name']
fields = ['url', 'name']
2 changes: 1 addition & 1 deletion backend/testapi/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.test import TestCase
# from django.test import TestCase

# Create your tests here.
2 changes: 1 addition & 1 deletion backend/testapi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class GroupViewSet(viewsets.ModelViewSet):
"""
queryset = Group.objects.all()
serializer_class = GroupSerializer
permission_classes = [permissions.AllowAny]
permission_classes = [permissions.AllowAny]
Loading