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

Integrate Cypress, Github hooks, & CirCI #30

Merged
merged 34 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4f2b580
- Added start for cypress test suite
elipe17 Jun 11, 2024
b8a9237
Merge branch '508-cleanup-test' of https://github.com/raft-tech/djang…
elipe17 Jun 11, 2024
4cdb24b
- Added cypress tests to the task file
elipe17 Jun 11, 2024
661410f
- initial config for circi
elipe17 Jun 12, 2024
43a7a0c
- converting from task to bash command for the moment
elipe17 Jun 12, 2024
23ce665
- fix format
elipe17 Jun 12, 2024
9828629
- changing executor
elipe17 Jun 12, 2024
0a84075
- install node packages
elipe17 Jun 12, 2024
5dcb3c2
- new node command
elipe17 Jun 12, 2024
595a45a
- fixed syntax
elipe17 Jun 12, 2024
6b05e78
- debugging
elipe17 Jun 12, 2024
bd7168e
- use npm to install packages
elipe17 Jun 12, 2024
8bdd7c5
- install task with NOde
elipe17 Jun 12, 2024
404d13f
- remove unneeded orb
elipe17 Jun 12, 2024
6b6bb67
- Adding git hooks
elipe17 Jun 13, 2024
7a094d1
- update format
elipe17 Jun 13, 2024
beeb387
- add missing quote
elipe17 Jun 13, 2024
4d51ce7
- naming
elipe17 Jun 13, 2024
73a684c
- Fix naming
elipe17 Jun 13, 2024
b91980e
- Updating paths
elipe17 Jun 13, 2024
1752376
- Removing unnecessary param
elipe17 Jun 13, 2024
78554e9
- docs update
elipe17 Jun 13, 2024
e980269
- remove settings file
elipe17 Jun 13, 2024
124fac6
Merge branch '508-cleanup-test' of https://github.com/raft-tech/djang…
elipe17 Jun 13, 2024
80ff7fe
- Fix merge conflicts
elipe17 Jun 13, 2024
36c4f58
- Updated model to use correct multiselect filter
elipe17 Jun 13, 2024
3671635
Merge branch '508-cleanup-test' of https://github.com/raft-tech/djang…
elipe17 Jun 13, 2024
299a3e4
- Update so dummy models and admin classes work
elipe17 Jun 13, 2024
d531e22
- Added test for multiselect filtering
elipe17 Jun 13, 2024
89f8dc2
- missing newline
elipe17 Jun 13, 2024
06af396
- changing url to avoid redirect
elipe17 Jun 13, 2024
1090700
- update test task
elipe17 Jun 13, 2024
43bb9e4
- revert
elipe17 Jun 13, 2024
53a01c3
- add init task
elipe17 Jun 14, 2024
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
41 changes: 41 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: 2.1

orbs:
node: circleci/[email protected]

parameters:
build_and_test:
type: boolean
default: false

executors:
machine-executor:
machine:
docker_layer_caching: false
image: ubuntu-2204:2024.01.1

commands:
install_node_packages:
description: Install node packages for Cypress test suite
steps:
- run:
name: Install Cypress
command: cd cypress && npm install && cd ..
- run:
name: Install Task
command: cd cypress && npm install -g @go-task/cli && cd ..

jobs:
build_and_test:
executor: machine-executor
steps:
- checkout
- install_node_packages
- run: task init
- run: task test

workflows:
build_and_test:
when: << pipeline.parameters.build_and_test >>
jobs:
- build_and_test
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug Report template
about: Template for bug reporting
title: ''
labels: dev
assignees: ''

---

Thank you for taking the time to let us know about the issue you found. The basic rule for bug reporting is that
something isn't working the way one would expect it to work. Please provide us with the information requested
below and we will look at it as soon as we are able.

## Description

*Please provide a short description of the bug*

## Action Taken

*In what way were you interacting with the application when you discovered the issue? Please be specific. Did it happen after you made a selection or clicked a button? Which page and which button? This information really helps us get to the bottom of an issue more quickly*

## What I expected to see

*Please provide a short description of what you expected to see*

## What I did see

*Please provide a short description of what you did see. Screenshots are helpful, but please block out any personally identifying information before posting.*

## Other Helpful Information

+ URL of the page I was on:
+ Browser and version:
+ Operating System: ( Windows | MacOS X | Linux | Other )
+ Is the issue repeatable?: ( yes | no | don't know )
+ Has the issue occurred more than once?:
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/dev-issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Development issue template
about: Template for development issues
title: ''
labels: dev
assignees: ''

---

**Description:**
_Provide a brief background and justification for this issue_


**Acceptance Criteria:**
_Create a list of functional outcomes that must be achieved to complete this issue_

- [ ] _Outcome 1_
- [ ] _Outcome 2_
- [ ] _Outcome 3_
- [ ] Testing Checklist has been run and all tests pass
- [ ] README is updated, if necessary

**Tasks:**
_Create a list of granular, specific work items that must be completed to deliver the desired outcomes of this issue_

- [ ] _Task 1_
- [ ] _Task 2_
- [ ] _Task 3_
- [ ] Run Testing Checklist and confirm all tests pass

**Notes:**
_Add additional useful information, such as related issues and functionality that isn't covered by this specific issue, and other considerations that will be helpful for anyone reading this_

- _Note 1_
- _Note 2_
- _Note 3_


**Supporting Documentation:**
_Please include any relevant log snippets/files/screen shots_

- _Doc 1_
- _Doc 2_

**Open Questions:**
_Please include any questions or decisions that must be made before beginning work or to confidently call this issue complete_

- _Open Question 1_
- _Open Question 2_
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/spike.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Spike issue template
about: Template for spike issues
title: 'Spike - '
labels: spike
assignees: ''

---

**Description:**
_Provide a brief background and justification for this issue_

**Open Questions:**
_Please include any questions, possible solutions or decisions that should be explored during work_

- _Open Question 1_
- _Open Question 2_


**Deliverable(s):**
_Create a list of recommendations or proofs of concept to be achieved to complete this issue_

- [ ] _Outcome 1_
- [ ] _Outcome 2_
- [ ] _Outcome 3_

**Supporting Documentation:**
_Please include any relevant log snippets/files/screen shots_

- _Doc 1_
- _Doc 2_

78 changes: 78 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
## Summary of Changes
_Provide a brief summary of changes_
Pull request closes #_

## How to Test
_List the steps to test the PR_
These steps are generic, please adjust as necessary.
```
cd tdrs-frontend && docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d
cd tdrs-backend && docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d
```

1. Open http://localhost:3000/ and sign in.
1. Proceed with functional tests as described herein.
1. Test steps should be captured in the demo GIF(s) and/or screenshots below.
> *Demo GIF(s) and screenshots for testing procedure*

## Deliverables
_More details on how deliverables herein are assessed included [here](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverables)._

### [Deliverable 1: Accepted Features](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-1-Accepted-Features)

Checklist of ACs:
+ [ ] [**_insert ACs here_**]
+ [ ] **`lfrohlich`** and/or **`adpennington`** confirmed that ACs are met.

### [Deliverable 2: Tested Code](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-2-Tested-Code)

+ Are all areas of code introduced in this PR meaningfully tested?
+ [ ] If this PR introduces backend code changes, are they meaningfully tested?
+ [ ] If this PR introduces frontend code changes, are they meaningfully tested?
+ Are code coverage minimums met?
+ [ ] Frontend coverage: [_insert coverage %_] (see `CodeCov Report` comment in PR)
+ [ ] Backend coverage: [_insert coverage %_] (see `CodeCov Report` comment in PR)

### [Deliverable 3: Properly Styled Code](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-3-Properly-Styled-Code)

+ [ ] Are backend code style checks passing on CircleCI?
+ [ ] Are frontend code style checks passing on CircleCI?
+ [ ] Are code maintainability principles being followed?

### [Deliverable 4: Accessible](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-4-Accessibility)

+ [ ] Does this PR complete the epic?
+ [ ] Are links included to any other gov-approved PRs associated with epic?
+ [ ] Does PR include documentation for Raft's a11y review?
+ [ ] Did automated and manual testing with `iamjolly` and `ttran-hub` using Accessibility Insights reveal any errors introduced in this PR?


### [Deliverable 5: Deployed](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-5-Deployed)

+ [ ] Was the code successfully deployed via automated CircleCI process to development on Cloud.gov?

### [Deliverable 6: Documented](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-6-Code-documentation)

+ [ ] Does this PR provide background for why coding decisions were made?
+ [ ] If this PR introduces backend code, is that code easy to understand and sufficiently documented, both inline and overall?
+ [ ] If this PR introduces frontend code, is that code easy to understand and sufficiently documented, both inline and overall?
+ [ ] If this PR introduces dependencies, are their licenses documented?
+ [ ] Can reviewer explain and take ownership of these elements presented in this code review?

### [Deliverable 7: Secure](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-7-Secure)

+ [ ] Does the OWASP Scan pass on CircleCI?
+ [ ] Do manual code review and manual testing detect any new security issues?
+ [ ] If new issues detected, is investigation and/or remediation plan documented?

### [Deliverable 8: User Research](https://github.com/raft-tech/TANF-app/blob/develop/docs/How-We-Work/our-priorities-values-expectations.md#Deliverable-8-User-Research)

Research product(s) clearly articulate(s):
+ [ ] the purpose of the research
+ [ ] methods used to conduct the research
+ [ ] who participated in the research
+ [ ] what was tested and how
+ [ ] impact of research on TDP
+ [ ] (_if applicable_) final design mockups produced for TDP development


44 changes: 44 additions & 0 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
###########################################################################
# GitHub Action Workflow
#
# Step 0: Make changes on your branch to files in admin_interface/, cypress/, django508/, .circleci or .github
# and push changes to your remote branch.
#
# Step 1: Makes a request to the V2 CircleCI API to initiate the project,
# which will filter based upon build_and_test to run the workflow/jobs
# listed here:
# build_and_test:[
# build_and_test,
# ]
#
# Leverages the open source GitHub Action:
# https://github.com/promiseofcake/circleci-trigger-action
###########################################################################
name: Build and test All on push when scripts/commands change
on:
push:
branches-ignore:
- develop
- main
- master
- 'release/**'
paths:
- 'admin_interface/**'
- 'cypress/**'
- 'django508/**'
- '.circleci/**'
- '.github/**'
jobs:
build_and_test_all:
runs-on: ubuntu-latest
name: Build and Test all in CirCI
steps:
- uses: actions/checkout@v2
- name: Build and Test all in CirCI
id: curl-circle-ci
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLE_CI_V2_TOKEN }}
project-slug: ${{ github.repository }}
branch: ${{ (github.event_name == 'pull_request') && github.head_ref || github.ref_name }}
payload: '{"build_and_test": true}'
42 changes: 42 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
###########################################################################
# GitHub Action Workflow
# On pull requests requesting review from individuals, besides staging,
# master, and release branches triggers the full build and test pipeline.
#
# NOTE: release branches, staging(main) and master are skipped because
# these branch builds are managed in CircleCI
#
# Step 0: make PR from your branch into main, then select reviewers.
#
# Step 1: Makes a request to the V2 CircleCI API to initiate the project,
# which will filter based upon build_and_test to run the workflow/jobs
# listed here:
# build_and_test:[
# build_and_test
# ]
#
# Leverages the open source GitHub Action:
# https://github.com/promiseofcake/circleci-trigger-action
###########################################################################
name: Build and test All for PRs
on:
pull_request:
branches-ignore: #handled in circleci
- main
- master
- 'release/**'
types: [review_requested, ready_for_review, synchronize]
jobs:
build_and_test_pr:
runs-on: ubuntu-latest
name: Build and Test PR in CirCI
steps:
- uses: actions/checkout@v2
- name: Build and Test PR in CirCI
id: curl-circle-ci
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLE_CI_V2_TOKEN }}
project-slug: ${{ github.repository }}
branch: ${{ (github.event_name == 'pull_request') && github.head_ref || github.ref_name }}
payload: '{"build_and_test": true}'
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ TODO.txt

# venv
*.sqlite3

# Cypress
node_modules/
cypress/cypress

# VSCode
.vscode
.DS_Store
17 changes: 15 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tasks:
- docker-compose exec bash sh -c "python ./django508/manage.py makemigrations"
- docker-compose exec bash sh -c "python ./django508/manage.py migrate"
- docker-compose exec bash sh -c "python ./django508/manage.py upsert_admin_user --username admin --email [email protected] --password fakepassword"
- docker-compose exec bash sh -c "python ./django508/manage.py create_dummy_models"
- docker-compose down

up:
Expand Down Expand Up @@ -38,25 +39,37 @@ tasks:
- docker-compose up bash -d
- docker-compose exec bash bash

test-e2e-local:
desc: Run cypress tests on the local machine with GUI
cmds:
- task up
- cd cypress && npm run test:e2e

test-e2e:
desc: Run cypress tests headless
cmds:
- task up
- cd cypress && npm run test:e2e-ci

test:
desc: Execute tests
env:
PYTEST_ARGS: '{{.PYTEST_ARGS | default "."}}'
cmds:
- docker-compose up test-app -d
- docker-compose exec test-app sh -c "pytest $PYTEST_ARGS"
- task test-e2e

docker-prune:
desc: Remove all unused containers, networks, images (both dangling and unreferenced), and volumes
cmds:
- docker system prune -a -f

lint:
desc: Execute linters
cmds:
- docker-compose up bash -d
- docker-compose exec bash sh -c "black ."


clean:
desc: Stop and destroy all container and databases
Expand Down
Loading
Loading