Skip to content

Commit

Permalink
Merge branch '2996-cat4-err-msgs' into 2792-cat3-errs
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimpe committed Jul 31, 2024
2 parents 4bd2e5f + 034d397 commit 6bbb0f1
Show file tree
Hide file tree
Showing 29 changed files with 1,018 additions and 337 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/deploy-on-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ jobs:
STATE=${{ fromJson(steps.get-pr-checks.outputs.data).state }}
echo "::set-output name=STATE::$STATE"
echo "Current PR state: $STATE"
- name: Live Environment Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.LIVE_ENV_GIST }}
gistID: ded3a260ed8245a5b231ba726b3039df
filename: Live-Environments-${{steps.extract-deploy-env.outputs.DEPLOY_ENV}}.json
label: ${{steps.extract-deploy-env.outputs.DEPLOY_ENV}}
message: "${{ github.head_ref }} - ${{ github.sha }}"
color: blue

- name: Circle CI Deployment Trigger
id: curl-circle-ci
if: steps.get-pr-state.outputs.STATE == 'success'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Our vision is to build a new, secure, web-based data reporting system to improve
|**Frontend Coverage**| [![Codecov-Frontend-Dev](https://codecov.io/gh/raft-tech/TANF-app/branch/develop/graph/badge.svg?flag=dev-frontend)](https://codecov.io/gh/raft-tech/TANF-app?flag=dev-frontend) | [![Codeco-Frontend-HHS](https://codecov.io/gh/HHS/TANF-app/branch/main/graph/badge.svg?flag=main-frontend)](https://codecov.io/gh/HHS/TANF-app?flag=main-frontend) | [![Codeco-Frontend-HHS](https://codecov.io/gh/HHS/TANF-app/branch/master/graph/badge.svg?flag=master-frontend)](https://codecov.io/gh/HHS/TANF-app?flag=master-frontend)
|**Backend Coverage**| [![Codecov-Backend-Dev](https://codecov.io/gh/raft-tech/TANF-app/branch/develop/graph/badge.svg?flag=dev-backend)](https://codecov.io/gh/raft-tech/TANF-app/branch/develop?flag=dev-backend)| [![Codecov-Backend-HHS]( https://codecov.io/gh/HHS/TANF-app/branch/main/graph/badge.svg?flag=main-backend)](https://codecov.io/gh/HHS/TANF-app/branch/main?flag=main-backend) | [![Codecov-Backend-HHS]( https://codecov.io/gh/HHS/TANF-app/branch/master/graph/badge.svg?flag=master-backend)](https://codecov.io/gh/HHS/TANF-app/branch/master?flag=master-backend)

[Link to Current Development Deployments](https://github.com/raft-tech/TANF-app/blob/feat/1860/docs/Technical-Documentation/TDP-environments-README.md#development)

*Due to limitations imposed by Github and occasional slow server response times, some badges may require a page refresh to load.*

*TDP is subject to the **[ACF Privacy Policy](https://www.acf.hhs.gov/privacy-policy)** and **[HHS Vulnerability Disclosure Policy](https://www.hhs.gov/vulnerability-disclosure-policy/index.html)***.
Expand Down
196 changes: 196 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
version: '3'

tasks:

create-network:
desc: Create the external network
cmds:
- docker network create external-net

init-backend:
desc: Initialize the backend project
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml up -d --build
- docker-compose -f docker-compose.yml exec web sh -c "python ./manage.py makemigrations"
- docker-compose -f docker-compose.yml exec web sh -c "python ./manage.py migrate"
- docker-compose -f docker-compose.yml down

drop-db:
desc: Drop the backend database
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml down
- docker volume rm tdrs-backend_postgres_data

backend-up:
desc: Start backend web server
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml up -d

backend-down:
desc: Stop backend web server
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml down

backend-logs:
desc: Show and follow backend web server logs
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml logs -f

backend-restart:
desc: Restart backend web server
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml restart -d

backend-bash:
desc: Open a shell in the backend container
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml exec web sh

backend-shell:
desc: Open a Django shell in the backend container
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml exec web sh -c "python ./manage.py shell"

backend-pytest:
desc: 'Run pytest in the backend container E.g: task backend-pytest PYTEST_ARGS="tdpservice/test/ -s -vv"'
dir: tdrs-backend
vars:
PYTEST_ARGS: '{{.PYTEST_ARGS | default "."}}'
cmds:
- task backend-up
- docker-compose -f docker-compose.yml exec web sh -c "pytest {{.PYTEST_ARGS}}"

backend-remove-volumes:
desc: Remove the backend volumes
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml down -v

backend-lint:
desc: Run flake8 in the backend container
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml exec web sh -c "flake8 . && if [ $? -eq 0 ]; then echo 'Flake8 linter found no issues'; fi"

backend-pip-lock:
#TODO: Add a task to lock the pip dependencies
desc: Lock the pip dependencies
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml exec web sh -c "pipenv lock"

psql:
desc: Open a psql shell in the backend container
dir: tdrs-backend
cmds:
- task create-network || true
- docker-compose -f docker-compose.yml up -d postgres
- sleep 5
- docker-compose -f docker-compose.yml exec postgres sh -c "psql -U tdpuser -d tdrs_test"

clean:
desc: Remove all containers, networks, and volumes
cmds:
- docker-compose -f tdrs-backend/docker-compose.yml down -v
- docker-compose -f tdrs-frontend/docker-compose.yml down -v
- docker system prune -f -a

clamav-up:
desc: Start clamav service
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml up -d clamav-rest

frontend-up:
desc: Start frontend web server
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml up -d

frontend-down:
desc: Stop frontend web server
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml down

frontend-restart:
desc: Restart frontend web server
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml restart -d

frontend-av:
desc: Start frontend with optional clamav service
dir: tdrs-frontend
cmds:
- task: frontend-up
- task: clamav-up


# need more work
frontend-init:
desc: Initialize the frontend project
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml up -d --build
- docker-compose -f docker-compose.yml exec tdp-frontend sh -c "apk add nodejs npm"
- docker-compose -f docker-compose.yml exec tdp-frontend sh -c "npm install"
- docker-compose -f docker-compose.yml down

frontend-test:
desc: Run frontend tests
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.local.yml up tdp-frontend-test -d
- docker-compose -f docker-compose.local.yml exec tdp-frontend-test sh -c "npm run test"

frontend-test-cov:
desc: Run frontend tests with coverage
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.local.yml up tdp-frontend-test -d
- docker-compose -f docker-compose.local.yml exec tdp-frontend-test sh -c "npm run test:cov"

frontend-lint:
desc: Run eslint in the frontend container
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.local.yml up -d tdp-frontend-test --quiet-pull
- docker-compose -f docker-compose.yml exec tdp-frontend-test sh -c "npm run lint"

frontend-logs:
desc: Show and follow frontend web server logs
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml logs -f

frontend-bash:
desc: Open a shell in the frontend container
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml exec tdp-frontend sh

up:
desc: Start both frontend and backend web servers
cmds:
- task: backend-up
- task: frontend-up

down:
desc: Stop both frontend and backend web servers
cmds:
- task: backend-down
- task: frontend-down

help:
desc: Show this help message
cmds:
- task --list
Loading

0 comments on commit 6bbb0f1

Please sign in to comment.