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

Add unit & integration tests and ES lint #10

Merged
merged 13 commits into from
Jun 24, 2024
4 changes: 4 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DATABASE_URL=postgresql://testuser:testpassword@localhost:5433/testdb?schema=public
NEXTAUTH_SECRET=secret
NODE_ENV="test"
DATABASE_PASSWORD="test"
18 changes: 17 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@
"plugin:tailwindcss/recommended",
"prettier"
],
"plugins": ["prettier"],
"rules": {
"react/no-unescaped-entities": "off",
"react-hooks/exhaustive-deps": "off"
"react-hooks/exhaustive-deps": "off",
"prettier/prettier": [
"error",
{
"semi": true,
"trailingComma": "all",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "auto",
"bracketSpacing": true
}
]
},
"env": {
"jest": true
}
}
28 changes: 28 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build the app and run tests
run-name: ${{ github.actor }} is creating a pull request
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
# - name: Build
# run: npm run build
- name: Run tests
run: npm test
- name: Notify Discord on failure
if: failure()
uses: containrrr/shoutrrr-action@v1
with:
url: ${{ secrets.NOTIFICATION_URL }}
title: "Build failed for ${{ github.actor }}"
message: |
Build failed or tests did not pass
Pull request: ${{ github.event.pull_request.html_url }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

.env
.env

# tests
test-report.html
23 changes: 23 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated files
.next/
dist/
out/

# Dependency directories
node_modules/

# Configuration and lock files
package-lock.json

# Environment files
.env

# Docker-related files
docker-compose.yml

# GitHub Actions workflows
.github/

# Others
tsconfig.json
jest.config.ts
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"trailingComma": "all",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "auto",
"bracketSpacing": true
}
71 changes: 38 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,53 +30,58 @@ Patrigma is a Progressive Web Application (PWA) designed to enhance social inter
### Installation

1. Clone the repository:

```bash
git clone https://github.com/your-username/patrigma.git
cd patrigma
```

2. Install dependencies:
```bash
npm install
```
```bash
npm install
```
3. Set up the environment variables:
```env
DATABASE_URL="your-database-url"
MAPBOX_KEY="your-mapbox-api-key"
NEXT_PUBLIC_MAPBOX_KEY="your-public-mapbox-api-key"
JWT_SECRET="mysecret"
```
4. Apply database migrations:

Dev environment :
```bash
npx prisma migrate dev
```

Prod environment :
```bash
npx prisma migrate deploy
```
```env
DATABASE_URL="your-database-url"
MAPBOX_KEY="your-mapbox-api-key"
NEXT_PUBLIC_MAPBOX_KEY="your-public-mapbox-api-key"
JWT_SECRET="mysecret"
```
4. Apply database migrations:

Dev environment :

```bash
npx prisma migrate dev
```

Prod environment :

```bash
npx prisma migrate deploy
```

5. Seeding database (optionnal):
```bash
npx prisma db seed
```

```bash
npx prisma db seed
```

6. Run the development server:
```bash
npm run dev
```
Open http://localhost:3000 with your browser to see the result.
`bash
npm run dev
`
Open http://localhost:3000 with your browser to see the result.

### Deployment

To deploy Patrigma, follow these steps:

1. Build the application for production:
```bash
npm run build
```
```bash
npm run build
```
2. Start the production server:
```bash
npm run start
```
```bash
npm run start
```
Loading
Loading