Skip to content

Commit

Permalink
Deploy 2023.02.1 to test (#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran committed Feb 22, 2023
2 parents 6338989 + 2bf3160 commit 9ddb3b7
Show file tree
Hide file tree
Showing 49 changed files with 686 additions and 620 deletions.
48 changes: 26 additions & 22 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,31 @@
"workspaceFolder": "/home/calitp/app",
"postStartCommand": ["/bin/bash", "bin/init.sh"],
"postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"batisteo.vscode-django",
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"hashicorp.terraform",
"mhutchie.git-graph",
"monosans.djlint",
"ms-python.python",
"ms-python.vscode-pylance",
"mrorz.language-gettext",
"qwtel.sqlite-viewer"
]
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"batisteo.vscode-django",
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"hashicorp.terraform",
"mhutchie.git-graph",
"monosans.djlint",
"ms-python.python",
"ms-python.vscode-pylance",
"mrorz.language-gettext",
"qwtel.sqlite-viewer"
]
}
}
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ updates:
include: "scope"
labels:
- "dependencies"
- package-ecosystem: "npm"
directory: "/tests/cypress" # Cypress testing
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "dependencies"
34 changes: 34 additions & 0 deletions .github/workflows/tests-cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Cypress tests

on: push

defaults:
run:
shell: bash

jobs:
tests-cypress:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Start app
run: |
touch .env
docker compose up --detach client server
- name: Run Cypress tests
uses: cypress-io/github-action@v5
env:
CYPRESS_baseUrl: http://localhost:8000
with:
command: npm test
working-directory: tests/cypress
wait-on: http://localhost:8000/healthcheck

- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: tests/cypress/screenshots
63 changes: 0 additions & 63 deletions .github/workflows/tests-feature.yml

This file was deleted.

24 changes: 2 additions & 22 deletions .github/workflows/tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build Dockerfile
id: build-client-image
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=cal-itp
cache-to: type=gha,scope=cal-itp,mode=max
context: .
file: appcontainer/Dockerfile
push: false
load: true
tags: benefits_client:${{ github.sha }}

- name: Start app
run: |
docker run \
--detach \
-p 8000:8000 \
-v ${{ github.workspace }}/fixtures:/home/calitp/app/fixtures \
benefits_client:${{ github.sha }}
touch .env
docker compose up --detach client
- name: Run Lighthouse tests for a11y
uses: treosh/lighthouse-ci-action@9.3.1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.env
*.mo
*.tfbackend
*.tmp
benefits/core/migrations/0002_*.py
!benefits/core/migrations/0002_sample_data.py
static/
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
args: ["--maxkb=1500"]

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
types:
Expand All @@ -61,6 +61,6 @@ repos:
types_or: [javascript, css]

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.19.13
rev: v1.19.15
hooks:
- id: djlint-django
5 changes: 2 additions & 3 deletions appcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Authlib==1.2.0
Django==4.1.5
Django==4.1.6
django-csp==3.7
eligibility-api==2023.01.1
opencensus-ext-azure==1.1.6
opencensus-ext-django==0.8.0
requests==2.28.2
sentry-sdk==1.15.0
six==1.16.0
2 changes: 1 addition & 1 deletion benefits/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "2023.01.2"
__version__ = "2023.02.1"

VERSION = __version__
27 changes: 12 additions & 15 deletions benefits/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ def __call__(self, request):
return self.get_response(request)


class HealthcheckUserAgents(MiddlewareMixin):
"""Middleware to return healthcheck for user agents specified in HEALTHCHECK_USER_AGENTS."""

def process_request(self, request):
if hasattr(request, "META"):
user_agent = request.META.get("HTTP_USER_AGENT", "")
if user_agent in settings.HEALTHCHECK_USER_AGENTS:
return HttpResponse("Healthy", content_type="text/plain")

return self.get_response(request)


class VerifierSessionRequired(MiddlewareMixin):
"""Middleware raises an exception for sessions lacking an eligibility verifier configuration."""

Expand Down Expand Up @@ -161,21 +173,6 @@ def process_view(self, request, view_func, view_args, view_kwargs):
return redirect("oauth:login")


# https://github.com/census-instrumentation/opencensus-python/issues/766
class LogErrorToAzure(MiddlewareMixin):
def __init__(self, get_response):
self.get_response = get_response
# wait to do this here to be sure the handler is initialized
self.azure_logger = logging.getLogger("azure")

def process_exception(self, request, exception):
# https://stackoverflow.com/a/45532289
msg = getattr(exception, "message", repr(exception))
self.azure_logger.exception(msg, exc_info=exception)

return None


class RecaptchaEnabled(MiddlewareMixin):
"""Middleware configures the request with required reCAPTCHA settings."""

Expand Down
1 change: 0 additions & 1 deletion benefits/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
21 changes: 13 additions & 8 deletions benefits/core/migrations/0002_sample_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Data migration which loads sample data.
Set environment variable DJANGO_LOAD_SAMPLE_DATA to False to skip loading sample data.
"""
import json
import os

from django.conf import settings
Expand Down Expand Up @@ -201,14 +202,19 @@ def load_sample_data(app, *args, **kwargs):

TransitAgency = app.get_model("core", "TransitAgency")

# load the sample data from a JSON file so that it can be accessed by Cypress as well
sample_agency_data = os.path.join(os.path.dirname(__file__), "sample_agency.json")
with open(sample_agency_data) as f:
sample_agency = json.load(f)

mst_agency = TransitAgency.objects.create(
slug="mst",
short_name=os.environ.get("MST_AGENCY_SHORT_NAME", "MST (sample)"),
long_name=os.environ.get("MST_AGENCY_LONG_NAME", "Monterey-Salinas Transit (sample)"),
agency_id="mst",
merchant_id="mst",
info_url="https://mst.org/benefits",
phone="888-678-2871",
slug=sample_agency["slug"],
short_name=os.environ.get("MST_AGENCY_SHORT_NAME", sample_agency["short_name"]),
long_name=os.environ.get("MST_AGENCY_LONG_NAME", sample_agency["long_name"]),
agency_id=sample_agency["agency_id"],
merchant_id=sample_agency["merchant_id"],
info_url=sample_agency["info_url"],
phone=sample_agency["phone"],
active=True,
private_key=client_private_key,
public_key=client_public_key,
Expand Down Expand Up @@ -239,7 +245,6 @@ def load_sample_data(app, *args, **kwargs):


class Migration(migrations.Migration):

dependencies = [
("core", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion benefits/core/migrations/0003_data_migration_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

migrations_directory = os.path.join(settings.BASE_DIR, "benefits", "core", "migrations")
dependencies = [("core", file.replace(".py", "")) for file in os.listdir(migrations_directory) if file.startswith("0002")]

Expand Down
9 changes: 9 additions & 0 deletions benefits/core/migrations/sample_agency.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"slug": "mst",
"short_name": "MST (sample)",
"long_name": "Monterey-Salinas Transit (sample)",
"agency_id": "mst",
"merchant_id": "mst",
"info_url": "https://mst.org/benefits",
"phone": "888-678-2871"
}
49 changes: 0 additions & 49 deletions benefits/logging.py

This file was deleted.

0 comments on commit 9ddb3b7

Please sign in to comment.