Skip to content

Commit

Permalink
Integrate Cypress, Github hooks, & CirCI (#30)
Browse files Browse the repository at this point in the history
* - Added start for cypress test suite

* - Added cypress tests to the task file

* - initial config for circi

* - converting from task to bash command for the moment

* - fix format

* - changing executor

* - install node packages

* - new node command

* - fixed syntax

* - debugging

* - use npm to install packages

* - install task with NOde

* - remove unneeded orb

* - Adding git hooks

* - update format

* - add missing quote

* - naming

* - Fix naming

* - Updating paths

* - Removing unnecessary param

* - docs update

* - remove settings file
- add .vscode to igniore

* - Fix merge conflicts

* - Updated model to use correct multiselect filter
- adding stub cypress test for using custom filter

* - Update so dummy models and admin classes work
- Updated multiselect filter to work

* - Added test for multiselect filtering

* - missing newline

* - changing url to avoid redirect

* - update test task

* - revert

* - add init task
  • Loading branch information
elipe17 authored Jun 14, 2024
1 parent 99aa9f8 commit d6d387a
Show file tree
Hide file tree
Showing 27 changed files with 7,010 additions and 15 deletions.
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

0 comments on commit d6d387a

Please sign in to comment.