Skip to content

Commit

Permalink
Adds github actions (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrinie authored Feb 17, 2024
1 parent 258d41e commit 50ec119
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: FinSL-signbank CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set Django DATABASES environment variable for SQLite
run: |
echo "DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3','NAME': 'db.sqlite3'}}" >> ./signbank/settings/development.py
- name: Make migrations for translatable fields
run: |
python bin/develop.py makemigrations
- name: Migrate
run: |
python bin/develop.py migrate
- name: Run Tests
run: |
python bin/develop.py test
2 changes: 1 addition & 1 deletion signbank/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
INSTALLED_APPS += ('debug_toolbar',)
DEBUG_TOOLBAR_CONFIG = {'RESULTS_CACHE_SIZE': 100}
except ImportError:
except (ImportError, ModuleNotFoundError):
pass
19 changes: 11 additions & 8 deletions signbank/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@
path('info/', infopage, name='infopage'),
]
if settings.DEBUG:
import debug_toolbar
from django.conf.urls.static import static
# Add debug_toolbar when DEBUG=True, also add static+media folders when in development.
# DEBUG should be False when in production!
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
try:
import debug_toolbar
from django.conf.urls.static import static
# Add debug_toolbar when DEBUG=True, also add static+media folders when in development.
# DEBUG should be False when in production!
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
except (ImportError, ModuleNotFoundError):
pass

# This is a catchall pattern, will try to match the rest of the urls with flatpages.
urlpatterns += [re_path('(?P<url>.*/)', flatpages_views.flatpage), ] # Keep this as the last URL in the file!
Expand Down

0 comments on commit 50ec119

Please sign in to comment.