Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
25 changes: 23 additions & 2 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,36 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Runs a single command using the runners shell
# Runs a single command using the runner's shell
- name: Run a one-line script
run: echo Hello, world!

# Runs a set of commands using the runners shell
# Runs a set of commands using the runner's shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.

# Set up Node.js for the workflow
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

# Install dependencies using Yarn
- name: Install all packages
run: cd code && yarn install

# Lint the codebase to ensure code quality
- name: Run linting
run: cd code && yarn lint

# Run tests to verify functionality
- name: Run tests
run: cd code && yarn test

# Validate Prisma schema for consistency
- name: Validate Prisma schema
run: |
cd code
npx prisma validate
39 changes: 39 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CD

on:
push:
branches:
- "main"
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

steps:
# Checkout repository
- uses: actions/checkout@v4

# Log in to DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Build and push Docker image
- name: Build and Push Docker Image
run: |
docker build -t your-dockerhub-username/resumeai:latest .
docker tag your-dockerhub-username/resumeai:latest your-dockerhub-username/resumeai:latest
docker push your-dockerhub-username/resumeai:latest

# Deploy application on server
- name: Deploy Application
run: |
ssh user@server-ip << 'EOF'
docker pull your-dockerhub-username/resumeai:latest
docker stop resumeai || true
docker rm resumeai || true
docker run -d --name resumeai -p 3000:3000 --env-file .env your-dockerhub-username/resumeai:latest
EOF
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
# Checkout repository
- uses: actions/checkout@v4

# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

# Install dependencies
- name: Install dependencies with Yarn
run: |
cd code
yarn install

# Lint code
- name: Lint codebase
run: |
cd code
yarn lint

# Run tests
- name: Run tests
run: |
cd code
yarn test

# Validate Prisma schema
- name: Validate Prisma schema
run: |
cd code
npx prisma validate

# Build Docker image
- name: Build Docker image
run: |
docker build -t resumeai:latest .

# Run Docker Compose to test services
- name: Test services with Docker Compose
run: docker-compose up --build --abort-on-container-exit --exit-code-from resumeai
2 changes: 2 additions & 0 deletions code/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore coverage folder
coverage/
21 changes: 18 additions & 3 deletions code/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Use a minimal Node.js base image
FROM node:20.9-alpine

# Set working directory
WORKDIR /app
COPY . /app/
RUN yarn install
CMD [ "yarn start" ]

# Copy package.json and yarn.lock first for better caching
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --production

# Copy the rest of the application code
COPY . .

# Expose the application port
EXPOSE 3000

# Command to start the application
CMD ["yarn", "start"]
28 changes: 28 additions & 0 deletions code/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,47 @@ services:
- .env
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5

redis:
image: redis
ports:
- 6379:6379
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5

keycloak:
image: quay.io/keycloak/keycloak
ports:
- 8080:8080
env_file:
- .env
command: start-dev
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 10s
timeout: 5s
retries: 5

resumeai:
build: .
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
keycloak:
condition: service_healthy
ports:
- 3000:3000
env_file:
- .env
command: yarn start

3 changes: 3 additions & 0 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
},
"devDependencies": {
"@eslint/js": "^9.11.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"eslint": "^9.11.0",
Expand All @@ -29,6 +31,7 @@
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.12",
"husky": "^9.1.6",
"jest": "^29.7.0",
"lerna": "^5.1.8",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
Expand Down
25 changes: 25 additions & 0 deletions code/packages/web/eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: ['react', '@typescript-eslint'],
rules: {
// Add custom rules here if necessary
},
};

3 changes: 2 additions & 1 deletion code/packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build": "tsc -b && vite build",
"preview": "vite preview",
"format": "prettier --write \"**/*.+(js|jsx|json|css|md|ts|tsx)\"",
"lint": "eslint \"**/*.+(js|jsx|json|css|md|ts|tsx)\"",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
Expand Down
23 changes: 23 additions & 0 deletions code/packages/web/src/components/ChartComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';

interface ChartProps {
data: Array<{ label: string; value: number }>;
title: string;
}

const ChartComponent: React.FC<ChartProps> = ({ data, title }) => {
return (
<div className="chart-container" style={{ padding: '20px', border: '1px solid #ccc', borderRadius: '8px' }}>
<h3>{title}</h3>
<ul>
{data.map((item, index) => (
<li key={index} style={{ margin: '10px 0' }}>
<span style={{ fontWeight: 'bold' }}>{item.label}:</span> {item.value}
</li>
))}
</ul>
</div>
);
};

export default ChartComponent;
2 changes: 1 addition & 1 deletion code/packages/web/src/components/MenuButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import Badge, { badgeClasses } from '@mui/material/Badge';
import IconButton, { IconButtonProps } from '@mui/material/IconButton';

Expand All @@ -21,3 +20,4 @@ export default function MenuButton({
</Badge>
);
}

2 changes: 1 addition & 1 deletion code/packages/web/src/components/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';

import FormControl from '@mui/material/FormControl';
import InputAdornment from '@mui/material/InputAdornment';
import OutlinedInput from '@mui/material/OutlinedInput';
Expand Down
38 changes: 8 additions & 30 deletions code/packages/web/src/components/SessionsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,9 @@ function AreaGradient({ color, id }: { color: string; id: string }) {

function getDaysInMonth(month: number, year: number) {
const date = new Date(year, month, 0);
const monthName = date.toLocaleDateString('en-US', {
month: 'short',
});
const monthName = date.toLocaleDateString('en-US', { month: 'short' });
const daysInMonth = date.getDate();
const days = [];
let i = 1;
while (days.length < daysInMonth) {
days.push(`${monthName} ${i}`);
i += 1;
}
return days;
return Array.from({ length: daysInMonth }, (_, i) => `${monthName} ${i + 1}`);
}

export default function SessionsChart() {
Expand Down Expand Up @@ -72,7 +64,7 @@ export default function SessionsChart() {
{
scaleType: 'point',
data,
tickInterval: (index, i) => (i + 1) % 5 === 0,
tickInterval: (_, i) => (i + 1) % 5 === 0,
},
]}
series={[
Expand All @@ -84,11 +76,7 @@ export default function SessionsChart() {
stack: 'total',
area: true,
stackOrder: 'ascending',
data: [
300, 900, 600, 1200, 1500, 1800, 2400, 2100, 2700, 3000, 1800, 3300,
3600, 3900, 4200, 4500, 3900, 4800, 5100, 5400, 4800, 5700, 6000,
6300, 6600, 6900, 7200, 7500, 7800, 8100,
],
data: Array(30).fill(3000),
},
{
id: 'referral',
Expand All @@ -98,25 +86,17 @@ export default function SessionsChart() {
stack: 'total',
area: true,
stackOrder: 'ascending',
data: [
500, 900, 700, 1400, 1100, 1700, 2300, 2000, 2600, 2900, 2300, 3200,
3500, 3800, 4100, 4400, 2900, 4700, 5000, 5300, 5600, 5900, 6200,
6500, 5600, 6800, 7100, 7400, 7700, 8000,
],
data: Array(30).fill(2000),
},
{
id: 'organic',
label: 'Organic',
showMark: false,
curve: 'linear',
stack: 'total',
stackOrder: 'ascending',
data: [
1000, 1500, 1200, 1700, 1300, 2000, 2400, 2200, 2600, 2800, 2500,
3000, 3400, 3700, 3200, 3900, 4100, 3500, 4300, 4500, 4000, 4700,
5000, 5200, 4800, 5400, 5600, 5900, 6100, 6300,
],
area: true,
stackOrder: 'ascending',
data: Array(30).fill(4000),
},
]}
height={250}
Expand All @@ -134,9 +114,7 @@ export default function SessionsChart() {
},
}}
slotProps={{
legend: {
hidden: true,
},
legend: { hidden: true },
}}
>
<AreaGradient color={theme.palette.primary.dark} id="organic" />
Expand Down
Loading