Skip to content

Commit

Permalink
Merge branch 'main' into feature/task-management-crud-routes
Browse files Browse the repository at this point in the history
  • Loading branch information
MattCMcCoy committed Feb 13, 2024
2 parents 395db6c + 240e95b commit ce09360
Show file tree
Hide file tree
Showing 42 changed files with 1,034 additions and 503 deletions.
60 changes: 16 additions & 44 deletions .github/workflows/CI.yml → .github/workflows/BackendCI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: CI (Formatting/Linting, Testing, Building)
name: Backend CI

on:
push:
branches: ['main']
paths:
- "backend/**"
- ".github/**"
branches: ["main"]
pull_request:
branches: ['main']
paths:
- "backend/**"
- ".github/**"
branches: ["main"]

jobs:
lint:
Expand All @@ -23,25 +29,8 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Format Frontend
run: |
task build
cd client
npm run check
- name: Format Backend
run: |
task build
cd backend
be_format_output=$(go fmt ./...)
if [[ -n "$be_format_output" ]]; then
Expand All @@ -51,7 +40,6 @@ jobs:
fi
- name: Lint Backend
run: |
task build
cd backend
be_lint_output=$(go vet ./...)
if [[ -n "$be_lint_output" ]]; then
Expand Down Expand Up @@ -90,25 +78,19 @@ jobs:
uses: actions/checkout@v4

- name: Import DB seed data
run:
psql -d postgresql://user:[email protected]:5432/carewallet -f init.sql
run: psql -d postgresql://user:[email protected]:5432/carewallet -f init.sql
working-directory: ./backend/db/migrations

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run Go tests
run: |
task build
task test-all
cd backend
go mod tidy
go test -count=1 carewallet/...
build:
name: Build
Expand All @@ -126,17 +108,7 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build app
- name: Build App
run: |
task build
cd backend
go mod tidy
78 changes: 78 additions & 0 deletions .github/workflows/FrontendCI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Frontend CI

on:
push:
paths:
- "client/**"
- ".github/**"
branches: ["main"]
pull_request:
paths:
- "client/**"
- ".github/**"
branches: ["main"]

jobs:
format:
name: Format
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
go-version: [1.21.x]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Format Frontend
run: |
cd client
npm install prettier
npx prettier --check .
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
go-version: [1.21.x]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Lint Frontend
run: |
cd client
npm install
npm run lint
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
go-version: [1.21.x]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Build App
run: |
cd client
npm install
10 changes: 0 additions & 10 deletions .prettierrc

This file was deleted.

154 changes: 62 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,119 +1,89 @@
<div align="center">
<h1>Care-Wallet</h1>
<div>
A fullstack application for the Care-Wallet project
</div>
<br/>
<!-- Github Actions -->
<a href="https://github.com/GenerateNU/Care-Wallet/actions/workflows/CI.yml">
<img src="https://github.com/GenerateNU/Care-Wallet/actions/workflows/CI.yml/badge.svg"
<a href="https://github.com/GenerateNU/Care-Wallet/actions/workflows/BackendCI.yml">
<img src="https://github.com/GenerateNU/Care-Wallet/actions/workflows/BackendCI.yml/badge.svg"
alt="Workflow Status" />
</a>
<a href="https://github.com/GenerateNU/Care-Wallet/actions/workflows/FrontendCI.yml">
<img src="https://github.com/GenerateNU/Care-Wallet/actions/workflows/FrontendCI.yml/badge.svg"
alt="Workflow Status" />
</a>
<br/>
<br/>
<div>
A fullstack application for the Care-Wallet project
</div>
</div>

## Set Up Your Development Environment
## Stack

![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge&logo=go&logoColor=white)
![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white)

![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)
![React Native](https://img.shields.io/badge/react_native-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB)
![TailwindCSS](https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge&logo=tailwind-css&logoColor=white)

First, understand the tech stack:
## Tools

- The database is [PostGreSQL](https://www.postgresql.org/) and will be
containerized using [Docker](https://www.docker.com/).
- The backend is [Golang](https://go.dev/)
- The frontend is [TypeScript](https://www.typescriptlang.org/) with
[ReactNative](https://reactnative.dev/) and
[NativeWind](https://www.nativewind.dev) and uses [Expo](https://expo.dev/) as
a build tool
![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge&logo=expo&logoColor=#D04A37)
![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)
![Swagger](https://img.shields.io/badge/-Swagger-%23Clojure?style=for-the-badge&logo=swagger&logoColor=white)

## Development Enviroment Setup

Before compiling and running our application, we need to install/setup several
languages, package managers, and various tools. The installation process can
vary, so follow the instructions for each item below!

- [Go](https://go.dev/doc/install) - our primary backend language
- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) - our
package manager in the frontend
- [Docker Desktop](https://www.docker.com/products/docker-desktop/) - useful for
running docker
- [ngrok](https://ngrok.com/docs/getting-started/) - Allows us to easily connect
the frontend to backend code
- [expo-go](https://docs.expo.dev/get-started/expo-go/) - Expo allows mobile
devices to scan a QR code and view the code running on a mobile device

If you wish to simulate a phone from your computer either below will work:

- [xcode](https://docs.expo.dev/workflow/ios-simulator/) - A simulator to view
the code on an iphone from a laptop
- [android studio](https://docs.expo.dev/workflow/android-studio-emulator/) - An
emulator to view the code on an android device from a laptop

If everything was successful, you can now compile and run the project!

Next, understand the development tools that will make our lives easier:

- [Pre-commit](https://pre-commit.com) - standardizing code style and commits
- [Swagger](https://github.com/swaggo/swag) - visualizing the api and return
types of requests from the database
- [Task](https://taskfile.dev) - speeding up development by running long
commands in quick phrases

Before committing anything, we need to install several tools. The installation
process can vary, so follow the instructions for each item below!

- [pre-commit](https://pre-commit.com/#installation) - our development tool to
standardize development and ensure every file follows the same styling
guidelines.
- [commitizen](https://commitizen-tools.github.io/commitizen/#installation) -
This allows us to organize commits! By typing `cz c` instead of
`git commit -m ""`, we can organize each of our commits into one of nine
categories:
- **fix**: A bug fix. Correlates with PATCH in SemVer
- **feat**: A new feature. Correlates with MINOR in SemVer
- **docs**: Documentation only changes
- **style**: Changes that do not affect the meaning of the code (white-space,
formatting, missing semi-colons, etc)
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing or correcting existing tests
- **build**: Changes that affect the build system or external dependencies
(example scopes: pip, docker, npm)
- **ci**: Changes to our CI configuration files and scripts (example scopes:
GitLabCI)
- [Task](https://taskfile.dev/installation/) - our development tool to quickly
run commands that run, test, and clean files.

## Extra Dependencies

Install these into the backend directory

1. go install github.com/swaggo/swag/cmd/swag@latest
[Go](https://go.dev/doc/install) our primary backend language.

## Before Running
[Node Package Manager](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
our package manager in the frontend.

1. Create a .env file in the root directory with a single line:
`EXPO_PUBLIC_API_DOMAIN=your-ngrok-static-domain-here`
- this will be used by the frontend services as well as the task file to
launch ngrok!
[Docker](https://www.docker.com/get-started/) and
[Docker Desktop](https://www.docker.com/products/docker-desktop/) our Postgres
Database will be containerized in Docker.

## Running the project
[Ngrok](https://ngrok.com/docs/getting-started/) Allows us to easily connect the
frontend to backend code.

1. Launch Docker Desktop
2. In the base of the repo: run `task start-docker`
[Swagger](https://github.com/swaggo/swag) visualizing the api and return types
of requests from the database.

- This will run `docker-compose down` then `docker-compose up`
[Task](https://taskfile.dev) speeding up development by running long commands in
quick phrases.

3. To build all of the dependencies of the project: run `task build`
[Nodemon](https://www.npmjs.com/package/nodemon) a tool that watches code and
reloads the build if it sees changes.

- This will install both frontend and backend dependencies
## Before Running

4. Then, open a new tab to run commands in: run `task start-backend`
Create an .env file in the root directory:

- This will generate the swagger docs as well as start the backend
- You can now view swagger: http://localhost:8080/swagger/index.html
```
EXPO_PUBLIC_API_DOMAIN=your-ngrok-static-domain-here
AWS_ACCESS_KEY=your-aws-access-key-here
AWS_SECRET_KEY=your-aws-secret-key-here
```

5. Next, in a new tab run `task start-ngrok`
## Before Contributing

6. Finally, open one last new tab: run `task start-frontend`
Before contributing to the project, we need to install/setup several various
tools. The installation process can vary, so follow the instructions for each
item below!

- This will start the frontend
[Pre-commit](https://pre-commit.com) standardizing code style and commits

7. From here follow the prompt in step 6 to launch the frontend on your device
of choice
[Commitizen](https://commitizen-tools.github.io/commitizen/) organizing our
commits into categories

## Running The Project

1. Launch Docker Desktop
2. In the base of the repo: run `task start-docker`
3. Then, open a new tab to run commands in: run `task start-backend` or
`task start-dev`
- You can now view swagger: http://localhost:8080/swagger/index.html
4. Next, in a new tab run `task start-ngrok`
5. Finally, open one last new tab: run `task start-frontend`
Loading

0 comments on commit ce09360

Please sign in to comment.