Skip to content

Commit

Permalink
Merge pull request #27 from Codespice1/develop
Browse files Browse the repository at this point in the history
Merge changes into staging environment
  • Loading branch information
D-Antonelli authored Aug 8, 2024
2 parents 7f6a910 + 75b6fd8 commit 2e6465d
Show file tree
Hide file tree
Showing 45 changed files with 12,985 additions and 27 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
docker
.git
12 changes: 12 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# integrations
STRIPE_KEY=

# auth
NEXTAUTH_URL=
NEXTAUTH_SECRET=

AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
9 changes: 9 additions & 0 deletions .env.staging.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# integrations
STRIPE_KEY=

# auth
NEXTAUTH_URL=
NEXTAUTH_SECRET=

GITHUB_ID=
GITHUB_SECRET=
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I have tested the changes in different screen sizes (mobile, tablet, desktop)
- [ ] This is an UI update and I have tested the changes in different screen sizes (mobile, tablet, desktop)


## Deployment notes
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Main workflow

on:
[push]

jobs:
build_and_test:
runs-on: ubuntu-latest
timeout-minutes: 5

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

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.14.0'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Build the Next.js application
env:
STRIPE_KEY: ${{ secrets.STRIPE_KEY }}
NEXTAUTH_URL: ${{secrets.NEXTAUTH_URL}}
NEXTAUTH_SECRET: ${{secrets.NEXTAUTH_SECRET}}
AUTH_GITHUB_ID: ${{secrets.AUTH_GITHUB_ID}}
AUTH_GITHUB_SECRET: ${{secrets.AUTH_GITHUB_SECRET}}
GOOGLE_CLIENT_ID: ${{secrets.GOOGLE_CLIENT_ID}}
GOOGLE_CLIENT_SECRET: ${{secrets.GOOGLE_CLIENT_SECRET}}
run: npm run build --if-present

- name: Code linting
run: npm run lint

- name: Run tests and collect coverage
run: npm run test

- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env.staging

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

.vscode/tasks.json
/certificates/*
cypress.env.json
26 changes: 26 additions & 0 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Contributing
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Commit your changes (git commit -am 'Add some feature').
- Push to the branch (git push origin feature-branch).
- Create a new Pull Request.

## Git Workflow

1. **Branch Types**:
- **Feature**: For new features (`feature/#id-short-description`).
- **Hotfix**: For bug fixes and performance improvements.
- **Bugfix**:
- **Release**:

2. **Commit Messages**:
- Include the issue ID and a brief description (`#1: Adds sign-up functionality`).

3. **Branch Hierarchy**:
- **Main**: Stable code, deployed to users.
- **Staging**: Pre-release testing environment.
- **Develop**: Latest code for development.

4. **Branch Naming Conventions**:
- Format: `<username>/feature/<#id-task>-<short-descrip
- Example: `D-Antonelli/feature/#1-user-authentication`
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
# Finance Accumulator
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

Finance Accumulator is a comprehensive full-stack application designed to help businesses manage and track their income and expenses by integrating with popular financial services such as Stripe, PayPal, and Shopify.
## Getting Started

## Contributing
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Commit your changes (git commit -am 'Add some feature').
- Push to the branch (git push origin feature-branch).
- Create a new Pull Request.
First, run the development server:

## Git Workflow
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

1. **Branch Types**:
- **Feature**: For new features (`feature/#id-short-description`).
- **Hotfix**: For bug fixes and performance improvements.
- **Bugfix**:
- **Release**:

2. **Commit Messages**:
- Include the issue ID and a brief description (`#1: Adds sign-up functionality`).

3. **Branch Hierarchy**:
- **Main**: Stable code, deployed to users.
- **Staging**: Pre-release testing environment.
- **Develop**: Latest code for development.

4. **Branch Naming Conventions**:
- Format: `<username>/feature/<#id-task>-<short-descrip
- Example: `D-Antonelli/feature/#1-user-authentication`
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status
default:
# basic
target: auto #default
threshold: 0%
base: auto
11 changes: 11 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "cypress";

export default defineConfig({
chromeWebSecurity: false,

e2e: {
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.ts')(on, config)
},
},
});
48 changes: 48 additions & 0 deletions cypress/e2e/google-login.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// default set-up from next-auth documentation. needs some fixes

describe("Login page", () => {
before(() => {
cy.log(`Visiting login page`);
cy.visit("http://localhost:3000");
});

it("Login with Google", () => {
const username: string = Cypress.env("GOOGLE_USER");
const password: string = Cypress.env("GOOGLE_PW");
const loginUrl: string = Cypress.env("SITE_NAME");
const cookieName: string = Cypress.env("COOKIE_NAME");

const socialLoginOptions = {
username,
password,
loginUrl,
headless: true,
logs: true,
isPopup: true,
loginSelector: `a[href="${Cypress.env("SITE_NAME")}/api/auth/signin/google"]`,
postLoginSelector: ".test-stripe",
};

return cy.task("GoogleSocialLogin", socialLoginOptions).then((result: any) => {
const {cookies} = result;

cy.clearCookies();

const cookie = cookies.filter((cookie: any) => cookie.name === cookieName).pop();
if (cookie) {
cy.setCookie(cookie.name, cookie.value, {
domain: cookie.domain,
expiry: cookie.expires,
httpOnly: cookie.httpOnly,
path: cookie.path,
secure: cookie.secure,
});

// remove the two lines below if you need to stay logged in
// for your remaining tests
cy.visit("/api/auth/signout");
cy.get("form").submit();
}
});
});
});
5 changes: 5 additions & 0 deletions cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('template spec', () => {
it('passes', () => {
cy.visit('https://example.cypress.io')
})
})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
7 changes: 7 additions & 0 deletions cypress/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { GoogleSocialLogin } = require("cypress-social-logins").plugins

module.exports = (on: any, config: any) => {
on("task", {
GoogleSocialLogin: GoogleSocialLogin,
})
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
8 changes: 8 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
Loading

0 comments on commit 2e6465d

Please sign in to comment.