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

HC 2023 Changes #131

Merged
merged 33 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a938ce4
Update frontend dependencies
tkw1536 Aug 2, 2023
779286c
ci: Update browser installation methods
tkw1536 Aug 2, 2023
01275f1
Bump cryptography from 40.0.2 to 41.0.3
dependabot[bot] Aug 2, 2023
b726489
Merge pull request #128 from JacobsAlumni/dependabot/pip/cryptography…
tkw1536 Aug 2, 2023
33ce9e1
ci: Update actions to latest
tkw1536 Aug 2, 2023
f0b4d81
Bump requests from 2.23.0 to 2.31.0
dependabot[bot] Aug 2, 2023
3a09d46
Merge pull request #122 from JacobsAlumni/dependabot/pip/requests-2.31.0
tkw1536 Aug 2, 2023
4be3e41
Update python dependencies to latest
tkw1536 Aug 5, 2023
34bb70d
django.utils.timezone.utc => datetime.timezone.utc
tkw1536 Aug 5, 2023
94e367f
Add 'DEFAULT_AUTO_KEY' setting
tkw1536 Aug 5, 2023
84eb93b
tests: Update selenium calls
tkw1536 Aug 5, 2023
0ea56e5
Fix test_001_admin tests
tkw1536 Aug 5, 2023
9108cd8
Fix excel export
tkw1536 Aug 5, 2023
c26a468
Remove legacy USE_L10N setting
tkw1536 Aug 5, 2023
50d6da9
fix django-sesame token login
tkw1536 Aug 6, 2023
4eac47f
Use timezone utility module
tkw1536 Aug 6, 2023
b19ad5c
tests: Use proper date object
tkw1536 Aug 6, 2023
b5e78d5
Update annotation in alumni/views.py
tkw1536 Aug 6, 2023
872fa57
lint: Use black
tkw1536 Aug 6, 2023
3569fc0
logout via post requests only
tkw1536 Aug 6, 2023
99c6216
pytest: Treat warnings as errors
tkw1536 Aug 6, 2023
25e904c
pytest: Ignore firefox webdriver warnings
tkw1536 Aug 6, 2023
18e2393
Update Leos email
tkw1536 Aug 14, 2023
4b911db
Merge pull request #129 from JacobsAlumni/with-django-lts
tkw1536 Aug 14, 2023
8e6e371
Add export for donations
tkw1536 Sep 19, 2023
f3d3aa6
Fix formatting
tkw1536 Sep 19, 2023
9c800fc
donations: Add more fields to excel export
tkw1536 Sep 20, 2023
f8b1b88
Merge pull request #130 from JacobsAlumni/with-export-for-donations
tkw1536 Sep 20, 2023
9fdf012
Revert "Update frontend dependencies"
tkw1536 Sep 21, 2023
327fe39
allow 'window.opener' for login popups
tkw1536 Sep 21, 2023
cda9769
Revert "Revert "Update frontend dependencies""
tkw1536 Sep 21, 2023
bd59ef4
Add 'DJANGO_CSRF_ORIGINS' environment variable
tkw1536 Sep 21, 2023
99970f5
donations: Add 'donation_label' instead of donation id
tkw1536 Sep 21, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/docker-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
- uses: docker/build-push-action@v2
- uses: docker/build-push-action@v4
with:
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
platforms: ${{ env.PLATFORMS }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/docker-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
- uses: docker/build-push-action@v2
- uses: docker/build-push-action@v4
with:
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
platforms: ${{ env.PLATFORMS }}
Expand Down
48 changes: 42 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,59 @@ jobs:
browser: ["chrome", "firefox"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Chrome Webdriver
if: ${{ matrix.browser == 'chrome' }}
run: |
python3 -m venv venv
source venv/bin/activate

pip install seleniumbase
sudo apt-get install -y google-chrome-stable
seleniumbase install chromedriver
pip uninstall -y seleniumbase

deactivate
rm -rf venv
- name: Install Firefox Webdriver
if: ${{ matrix.browser == 'firefox' }}
run: |
pip install seleniumbase
# Python by default installs from snap.
# This isn't supported by geckodriver.
#
# The clean solution would be to use a sane distribution
# that doesn't use snap-based firefox by default.
# But GitHub Actions doesn't offer this.

sudo add-apt-repository ppa:mozillateam/ppa
sudo apt-get -qq -y update

echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001

Package: firefox
Pin: version 1:1snap1-0ubuntu2
Pin-Priority: -1
' | sudo tee /etc/apt/preferences.d/mozilla-firefox > /dev/null
sudo apt-get -y install firefox


python3 -m venv venv
source venv/bin/activate

sudo apt-get install -y firefox

pip install seleniumbase
seleniumbase install geckodriver
pip uninstall -y seleniumbase

deactivate
rm -rf venv
- name: Run 'poetry install'
run: |
pip install poetry
Expand All @@ -48,6 +81,9 @@ jobs:

- name: Run 'yarn build'
run: yarn build
- name: Check if 'black' has been run
run:
black --exclude 'migrations' --check .
- name: Run 'pytest'
env:
SELENIUM_WEBDRIVER: ${{ matrix.browser }}
Expand All @@ -58,7 +94,7 @@ jobs:
name: Docker Smoke Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: 'Build Docker Container'
run: docker build -t jacobsalumni/membermanagement .
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ ENV DJANGO_SECRET_KEY ""

# A comma-seperated list of allowed hosts
ENV DJANGO_ALLOWED_HOSTS "localhost"
ENV DJANGO_CSRF_ORIGINS "http://localhost:8000"

# Database settings
## Use SQLITE out of the box
Expand Down
32 changes: 17 additions & 15 deletions MemberManagement/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from django.core.asgi import get_asgi_application


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'MemberManagement.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MemberManagement.settings")

# Have to call before importing consumers as they depend on models
django_asgi_app = get_asgi_application()
Expand All @@ -26,17 +26,19 @@
from donations.consumers import DonationUpdateConsumer



application = ProtocolTypeRouter({
# Django's ASGI application to handle traditional HTTP requests
"http": django_asgi_app,

# WebSocket chat handler
"websocket": AllowedHostsOriginValidator(
AuthMiddlewareStack(
URLRouter([
path("donations/", DonationUpdateConsumer.as_asgi()),
])
)
),
})
application = ProtocolTypeRouter(
{
# Django's ASGI application to handle traditional HTTP requests
"http": django_asgi_app,
# WebSocket chat handler
"websocket": AllowedHostsOriginValidator(
AuthMiddlewareStack(
URLRouter(
[
path("donations/", DonationUpdateConsumer.as_asgi()),
]
)
)
),
}
)
6 changes: 4 additions & 2 deletions MemberManagement/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
from django.conf import settings

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Dict, Any
from django.http import HttpRequest


def js_testmode_flag(request: HttpRequest) -> Dict[str, Any]:
return {'js_test_mode_flag': settings.JS_TEST_MODE_FLAG }
return {"js_test_mode_flag": settings.JS_TEST_MODE_FLAG}


def portal_version(request: HttpRequest) -> Dict[str, Any]:
return {'portal_version': settings.PORTAL_VERSION }
return {"portal_version": settings.PORTAL_VERSION}
50 changes: 26 additions & 24 deletions MemberManagement/docker_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
DEBUG = False

# show a warning that this is not a real site
ENABLE_DEVEL_WARNING = os.environ.setdefault(
"DJANGO_ENABLE_DEVEL_WARNING", "") == "1"
ENABLE_DEVEL_WARNING = os.environ.setdefault("DJANGO_ENABLE_DEVEL_WARNING", "") == "1"

# we want to allow all hosts
ALLOWED_HOSTS = os.environ.setdefault("DJANGO_ALLOWED_HOSTS", "").split(",")
CSRF_TRUSTED_ORIGINS = os.environ.setdefault("DJANGO_CSRF_ORIGINS", "").split(",")

# all our sessions be safe
SECRET_KEY = os.environ.setdefault("DJANGO_SECRET_KEY", "")
Expand All @@ -21,42 +21,48 @@

# Passwords
DATABASES = {
'default': {
'ENGINE': os.environ.setdefault("DJANGO_DB_ENGINE", ""),
'NAME': os.environ.setdefault("DJANGO_DB_NAME", ""),
'USER': os.environ.setdefault("DJANGO_DB_USER", ""),
'PASSWORD': os.environ.setdefault("DJANGO_DB_PASSWORD", ""),
'HOST': os.environ.setdefault("DJANGO_DB_HOST", ""),
'PORT': os.environ.setdefault("DJANGO_DB_PORT", ""),
"default": {
"ENGINE": os.environ.setdefault("DJANGO_DB_ENGINE", ""),
"NAME": os.environ.setdefault("DJANGO_DB_NAME", ""),
"USER": os.environ.setdefault("DJANGO_DB_USER", ""),
"PASSWORD": os.environ.setdefault("DJANGO_DB_PASSWORD", ""),
"HOST": os.environ.setdefault("DJANGO_DB_HOST", ""),
"PORT": os.environ.setdefault("DJANGO_DB_PORT", ""),
}
}

CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [(os.environ.setdefault("REDIS_HOST", "redis"), int(os.environ.setdefault("REDIS_PORT", "6379")))],
"hosts": [
(
os.environ.setdefault("REDIS_HOST", "redis"),
int(os.environ.setdefault("REDIS_PORT", "6379")),
)
],
},
},
}

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = os.environ.setdefault("EMAIL_HOST", "")
EMAIL_HOST_USER = os.environ.setdefault("EMAIL_HOST_USER", "")
EMAIL_HOST_PASSWORD = os.environ.setdefault("EMAIL_HOST_PASSWORD", "")
EMAIL_FROM = os.environ.setdefault("EMAIL_FROM",
'Alumni Association Portal <[email protected]>')
EMAIL_FROM = os.environ.setdefault(
"EMAIL_FROM", "Alumni Association Portal <[email protected]>"
)

# staticfiles
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

# add the stripe keys
STRIPE_SECRET_KEY = os.environ.get('STRIPE_SECRET_KEY')
STRIPE_PUBLISHABLE_KEY = os.environ.get('STRIPE_PUBLISHABLE_KEY')
STRIPE_WEBHOOK_SECRET = os.environ.get('STRIPE_WEBHOOK_SECRET')
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY")
STRIPE_PUBLISHABLE_KEY = os.environ.get("STRIPE_PUBLISHABLE_KEY")
STRIPE_WEBHOOK_SECRET = os.environ.get("STRIPE_WEBHOOK_SECRET")

# set the fixer access key
FIXER_ACCESS_KEY = os.environ.get('FIXER_ACCESS_KEY')
FIXER_ACCESS_KEY = os.environ.get("FIXER_ACCESS_KEY")

# update the client ID for Google login
GSUITE_OAUTH_CLIENT_ID = os.environ.setdefault("GSUITE_OAUTH_CLIENT_ID", "")
Expand All @@ -68,18 +74,14 @@
MEDIA_ROOT = os.environ.setdefault("MEDIA_ROOT", "/data/media")

# Sentry
if os.environ.get('DJANGO_RAVEN_DSN'):
if os.environ.get("DJANGO_RAVEN_DSN"):
# add sentry
INSTALLED_APPS += (
'raven.contrib.django.raven_compat',
)
INSTALLED_APPS += ("raven.contrib.django.raven_compat",)

import os
import raven

RAVEN_CONFIG = {
'dsn': os.environ.get('DJANGO_RAVEN_DSN')
}
RAVEN_CONFIG = {"dsn": os.environ.get("DJANGO_RAVEN_DSN")}


# Donation receipts
Expand Down
Loading
Loading