Skip to content

Commit

Permalink
Merge branch 'main' into Club-Search-(SAC31+SAC32)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brennan2005 committed Mar 20, 2024
2 parents eaf019d + bbd33de commit 8586772
Show file tree
Hide file tree
Showing 16 changed files with 2,476 additions and 5,431 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Web

permissions: read-all

on:
push:
paths:
- frontend/sac-web/**
- .github/workflows/web.yml
pull_request:
types: opened
paths:
- frontend/sac-web/**
- .github/workflows/web.yml

jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
cache-dependency-path: frontend/sac-web/yarn.lock
- name: Install dependencies
run: |
cd frontend/sac-web
yarn install
- name: Format
run: |
cd frontend/sac-web
yarn format
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
cache-dependency-path: frontend/sac-web/yarn.lock
- name: Install dependencies
run: |
cd frontend/sac-web
yarn install
- name: Lint
run: |
cd frontend/sac-web
yarn lint
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
cache-dependency-path: frontend/sac-web/yarn.lock
- name: Install dependencies
run: |
cd frontend/sac-web
yarn install
- name: Test
run: |
cd frontend/sac-web
yarn test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
.vscode
.trunk
.env.dev
tmp/
43 changes: 7 additions & 36 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
- [Node.js](https://nodejs.org/en/)
- [Yarn](https://yarnpkg.com/)
- [Go](https://golang.org/)
> Do not install through brew, use the official website
- Do not install through brew, use the official website
- [Docker](https://www.docker.com/)
- [PostgreSQL](https://www.postgresql.org/)
- Install through brew: `brew install postgresql@15`
- It requires you to add all the exports to path so read the end of the installation carefully!
- [Trunk](https://marketplace.visualstudio.com/items?itemName=Trunk.io) (Recommended!)
- Visual Studio Code extension for linting/formatting
- [gofumpt](https://github.com/mvdan/gofumpt)
- A stricter gofmt
- [golangci-lint](https://golangci-lint.run/welcome/install/)
- A Go linters aggregator

# Setup

Expand Down Expand Up @@ -121,45 +125,14 @@
```console
go run main.go // run server
go test ./... // run tests
go fmt ./... // format code
go vet ./... // lint code
gofumpt -l -w . // format code
golangci-lint run --fix // lint code
```

### SAC CLI

To install use `./install.sh` and then run `sac-cli` to see all commands.

```console
NAME:
sac-cli - CLI for SAC

USAGE:
sac-cli [global options] command [command options]

COMMANDS:
swagger, swag Updates the swagger documentation
test, t Runs tests
help, h Shows a list of commands or help for one command
CI:
format, f Runs formatting tools
lint, l Runs linting tools
* can use --fix to fix linting errors for frontend
Database Operations:
clean, c Remove databases used for testing
migrate, m Migrate the database, creating tables and relationships
reset, r Resets the database, dropping all tables, clearing data, and re-running migrations
* can use --data to just reset data and not drop tables
insert, i Inserts mock data into the database
drop, d Drop data with a migration or drops the entire database
* can use --data to just drop data and not drop tables

Development:
be Run the backend
fe Run the frontend

GLOBAL OPTIONS:
--help, -h show help
```
# Git Flow

1. **Create a new branch**
Expand All @@ -179,8 +152,6 @@

- We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit messages. (READ!)

<!-- - We especially recommend [Trunk](https://marketplace.visualstudio.com/items?itemName=Trunk.io) for linting -->

3. **Push changes to GitHub**

```console
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
alt="Mobile CodeQL Workflow Status" />
</a>


<br />

<a href="https://github.com/GenerateNU/sac/actions/workflows/web.yml">
<img src="https://github.com/GenerateNU/sac/actions/workflows/web.yml/badge.svg"
alt="Web Workflow Status" />
</a>

<a href="https://github.com/GenerateNU/sac/actions/workflows/web_codeql.yml">
<img src="https://github.com/GenerateNU/sac/actions/workflows/web_codeql.yml/badge.svg"
Expand Down
5 changes: 2 additions & 3 deletions backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/GenerateNU/sac/backend

go 1.22.0
go 1.22.1

require (
github.com/garrettladley/mattress v0.4.0
Expand All @@ -19,7 +19,7 @@ require (
golang.org/x/crypto v0.21.0
golang.org/x/text v0.14.0
gorm.io/driver/postgres v1.5.7
gorm.io/gorm v1.25.7
gorm.io/gorm v1.25.8
)

require (
Expand All @@ -29,7 +29,6 @@ require (
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/tinylib/msgp v1.1.8 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sync v0.6.0 // indirect
)

Expand Down
4 changes: 2 additions & 2 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM=
gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA=
gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A=
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo=
gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
20 changes: 12 additions & 8 deletions cli/commands/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ import (

func BackendCommand() *cli.Command {
command := &cli.Command{
Name: "backend",
Usage: "Starts the backend server",
Aliases: []string{"be"},
Name: "be",
Usage: "Run the backend",
Category: "Development",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "use-dev-dot-env",
Usage: "Use the .env file in the backend directory",
Aliases: []string{"d"},
Name: "d",
Usage: "Use the .env.dev file in the backend directory",
},
},
Action: func(c *cli.Context) error {
err := RunBackend()
err := RunBackend(c.Bool("d"))
if err != nil {
return cli.Exit(err.Error(), 1)
}
Expand All @@ -34,8 +33,13 @@ func BackendCommand() *cli.Command {
return command
}

func RunBackend() error {
func RunBackend(useDevDotEnv bool) error {
cmd := exec.Command("go", "run", "main.go")

if useDevDotEnv {
cmd.Args = append(cmd.Args, "--use-dev-dot-env")
}

cmd.Dir = BACKEND_SRC_DIR
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func LintFrontend(target string, fix bool) error {
func LintBackend() error {
fmt.Println("Linting backend")

cmd := exec.Command("go", "vet", "./...")
cmd := exec.Command("golangci-lint", "run", "--fix")
cmd.Dir = BACKEND_DIR

err := cmd.Run()
Expand Down
6 changes: 3 additions & 3 deletions cli/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/GenerateNU/sac/cli

go 1.22.0
go 1.22.1

require (
github.com/GenerateNU/sac/backend v0.0.0-20240208151800-c7c93bbd1bb7
Expand Down Expand Up @@ -30,9 +30,9 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,11 @@ go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
20 changes: 10 additions & 10 deletions frontend/sac-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
},
"dependencies": {
"@expo/vector-icons": "^14.0.0",
"@react-navigation/native": "^6.1.15",
"@tanstack/react-query": "^5.25.0",
"axios": "^1.6.7",
"@react-navigation/native": "^6.1.16",
"@tanstack/react-query": "^5.28.4",
"axios": "^1.6.8",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"eslint": "^8.56.0",
"expo": "^50.0.7",
"expo-dev-client": "~3.3.9",
"expo": "^50.0.13",
"expo-dev-client": "~3.3.10",
"expo-font": "~11.10.2",
"expo-linking": "~6.2.2",
"expo-router": "~3.4.8",
Expand All @@ -35,27 +35,27 @@
"nativewind": "^2.0.11",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.51.0",
"react-hook-form": "^7.51.1",
"react-native": "0.73.6",
"react-native-cookies": "^3.3.0",
"react-native-element-dropdown": "^2.10.2",
"react-native-reanimated": "^3.8.0",
"react-native-reanimated": "^3.8.1",
"react-native-safe-area-context": "4.9.0",
"react-native-screens": "~3.29.0",
"react-native-web": "~0.19.6",
"tailwind-merge": "^2.2.1",
"tailwind-merge": "^2.2.2",
"zod": "^3.22.4",
"zustand": "^4.5.2"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@react-native-community/eslint-config": "^3.2.0",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/react": "~18.2.64",
"@types/react": "~18.2.67",
"eslint": "^8.56.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.2.1",
"jest-expo": "~50.0.3",
"jest-expo": "~50.0.4",
"prettier": "^3.2.4",
"react-test-renderer": "18.2.0",
"tailwindcss": "3.3.2",
Expand Down
Loading

0 comments on commit 8586772

Please sign in to comment.