diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..1abc73b --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,25 @@ +## **To run this CI/CD Workflow:** +- Simply, make a PR to the `main` branch or push changes to the `main` branch +- Go to the `Actions` Tab to view the status of the workflow. + +## Details of Implementation +- **CI Pipeline** + - Specify that the CI Pipeline is triggered on PR or push to `main` + - Checkout code via `Github Actions` + - Install `docker-compose` + - Log in to Docker Hub + - Run `docker-compose build` to build frontend and backend images + - **Note**: we have defined a redis container within the docker-compose file in case that we want to implement a test suite that requires redis to run + - Tag frontend and backend images and push them to Docker Hub + - List docker images +- **CD Pipeline** + - Specify workflow to run only after CI Pipeline has been completed + - Run code on `ubuntu-latest` + - Checkout code via `Github Actions` + - Log in to Docker Hub + - Pull Docker backend and frontend images + - Deploy backend and frontend containers + - Run Automated Tests on backend and frontend + - We first install necessary packages (i.e. `npm install`) + - Then, we run `npm test` for the respective containers each having their own test suite + diff --git a/.github/workflows/SystemDesign.md b/.github/workflows/SystemDesign.md new file mode 100644 index 0000000..496c7cf --- /dev/null +++ b/.github/workflows/SystemDesign.md @@ -0,0 +1,24 @@ +## **System Design for Building, Pushing, Deploying Docker** +### **CI Pipeline** +- `A2_Part1.yml` file + - Responsible for building docker images for the frontend and backend and pushing them to DockerHub +- `A2_Part2.yml` file + - Responsible for pulling frontend and backend containers and running automated tests within their respective containers + + + +## **System Design for Automated Testing** +### **Backend** +- In `package.json`: +- `npm test` + - runs `jest --coverage --forceExit --maxWorkers=2` +- In `__ tests __` : + - `setProfilePic.test.js` + - verify that making `POST` request at `/set-profile-pic` endpoint results in 200 response code +### **Frontend** +- In `package.json`: + - `npm test` + - runs `jest --coverage --transformIgnorePatterns \"node_modules/(?!axios)/\"` +- In `__ tests __` : + - `LoginPage.test.js`: + - check that the Login component contains the phrase “Swipe. Match. Network.”