Skip to content

Commit

Permalink
Merge pull request #748 from cal-itp/dev
Browse files Browse the repository at this point in the history
release changes to test environment
  • Loading branch information
afeld authored Jun 27, 2022
2 parents b601047 + 55f35d2 commit f3316cd
Show file tree
Hide file tree
Showing 72 changed files with 1,248 additions and 769 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/deploy-dev.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/deploy-test.yml

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/deploy-prod.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Deploy (prod)
name: Deploy

on:
workflow_dispatch:
push:
branches:
- dev
- test
- prod

defaults:
Expand All @@ -13,13 +15,16 @@ defaults:
jobs:
deploy:
runs-on: ubuntu-latest
environment: prod
concurrency: prod
environment: ${{ github.ref_name }}
concurrency: ${{ github.ref_name }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Write commit SHA to file
run: echo "${{ github.sha }}" >> benefits/static/sha.txt

- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -35,10 +40,11 @@ jobs:
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: GIT-SHA=${{ github.sha }}
cache-from: type=gha,scope=cal-itp
cache-to: type=gha,scope=cal-itp,mode=max
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:prod
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:${{ github.sha }}
16 changes: 16 additions & 0 deletions .github/workflows/labeler-back-end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Label back-end

on:
pull_request:
types: [opened]
paths:
- 'benefits/**/*.py'

jobs:
label-actions:
runs-on: ubuntu-latest
steps:
- name: add-label
uses: andymckay/labeler@master
with:
add-labels: "back-end"
18 changes: 18 additions & 0 deletions .github/workflows/labeler-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Label docker

on:
pull_request:
types: [opened]
paths:
- '.devcontainer/**'
- '.dockerignore'
- 'Dockerfile'

jobs:
label-actions:
runs-on: ubuntu-latest
steps:
- name: add-label
uses: andymckay/labeler@master
with:
add-labels: "docker"
17 changes: 17 additions & 0 deletions .github/workflows/labeler-front-end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Label front-end

on:
pull_request:
types: [opened]
paths:
- 'benefits/**/templates/**'
- 'benefits/static/**'

jobs:
label-actions:
runs-on: ubuntu-latest
steps:
- name: add-label
uses: andymckay/labeler@master
with:
add-labels: "front-end"
16 changes: 16 additions & 0 deletions .github/workflows/labeler-i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Label i18n

on:
pull_request:
types: [opened]
paths:
- 'benefits/locale/**'

jobs:
label-actions:
runs-on: ubuntu-latest
steps:
- name: add-label
uses: andymckay/labeler@master
with:
add-labels: "i18n"
28 changes: 0 additions & 28 deletions .github/workflows/tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,6 @@ jobs:
-v ${{ github.workspace }}/fixtures:/home/calitp/app/fixtures \
benefits_client:${{ github.sha }}
- name: Start server
run: |
docker run \
--detach \
-p 5000:5000 \
ghcr.io/cal-itp/eligibility-server:main
- name: Run UI automation tests
uses: cypress-io/github-action@v2
env:
CYPRESS_baseUrl: http://localhost:8000
with:
command: npm run cypress:ui
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

- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-videos
path: tests/cypress/videos

- name: Run Lighthouse tests for a11y
uses: treosh/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fixtures/*.json
!fixtures/??_*.json
static/
!benefits/static
benefits/static/sha.txt
__pycache__/
.coverage
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Benefits

Transit benefits enrollment, minus the paperwork.
Cal-ITP Benefits is an application that enables automated eligibility verification and enrollment for transit benefits onto customers’ existing contactless bank (credit/debit) cards.

View the technical documentation online: <https://docs.calitp.org/benefits>

Expand Down
10 changes: 0 additions & 10 deletions benefits/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
"""
The core application: Houses base templates and reusable models and components.
"""
from django.apps import AppConfig


class CoreAppConfig(AppConfig):
name = "benefits.core"
label = "core"
verbose_name = "Core"
10 changes: 10 additions & 0 deletions benefits/core/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
The core application: Houses base templates and reusable models and components.
"""
from django.apps import AppConfig


class CoreAppConfig(AppConfig):
name = "benefits.core"
label = "core"
verbose_name = "Core"
4 changes: 2 additions & 2 deletions benefits/core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def authentication(request):

if verifier:
data = {
"required": verifier.requires_authentication,
"required": verifier.is_auth_required,
"logged_in": session.logged_in(request),
"sign_out_route": reverse("oauth:logout"),
}

if verifier.requires_authentication:
if verifier.is_auth_required:
auth_provider = verifier.auth_provider
data["sign_in_button_label"] = auth_provider.sign_in_button_label
data["sign_out_button_label"] = auth_provider.sign_out_button_label
Expand Down
17 changes: 16 additions & 1 deletion benefits/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,23 @@ class LoginRequired(MiddlewareMixin):
def process_view(self, request, view_func, view_args, view_kwargs):
# only require login if verifier requires it
verifier = session.verifier(request)
if not verifier or not verifier.requires_authentication or session.logged_in(request):
if not verifier or not verifier.is_auth_required or session.logged_in(request):
# pass through
return None

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
Loading

0 comments on commit f3316cd

Please sign in to comment.