Skip to content

Commit

Permalink
feat: release
Browse files Browse the repository at this point in the history
- update gh actions
- update readme
- update pr template
  • Loading branch information
0xArdy authored Jul 10, 2024
2 parents fcbce9e + 67c6829 commit edb0437
Show file tree
Hide file tree
Showing 11 changed files with 1,394 additions and 150 deletions.
5 changes: 3 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## Issue ticket number and link

closes XXX

## Checklist before requesting a review

- [ ] I have conducted a self-review of my code.
- [ ] I have conducted a QA.
- [ ] If it is a core feature, I have included comprehensive tests.
- [ ] Do we need to implement analytics?
- [ ] Will this be part of a product update? If yes, please write one sentence about this update.
52 changes: 10 additions & 42 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
name: Build and Format
name: Check for crypto and Format

on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: '21.4'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install project dependencies
run: pnpm install --frozen-lockfile --prefer-frozen-lockfile

- name: Build project dependencies
run: pnpm run build
env:
NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }}

check:
name: Check for crypto
runs-on: ubuntu-latest
Expand All @@ -44,35 +19,28 @@ jobs:
only_notify: true
token: ${{ secrets.GITHUB_TOKEN }}

test:
name: Lint and Test
format:
name: Lint and Prettier
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8.15
version: 8

- uses: actions/setup-node@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '21.4'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install
- name: Install project dependencies
run: pnpm install --frozen-lockfile --prefer-frozen-lockfile

- name: Build the project
run: pnpm run build

- name: Run Prettier
run: pnpm prettier

- name: Run Linter
run: pnpm lint

- name: Cypress run
uses: cypress-io/github-action@v5
with:
start: pnpm start, pnpm test
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: E2E and Unit Tests

on:
push:
workflow_dispatch:

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Create env file
run: |
touch .env
echo "NEXT_PUBLIC_RPC_URL=${{ secrets.NEXT_PUBLIC_RPC_URL }}" >> .env
echo "NEXT_PUBLIC_PROJECT_ID=${{ secrets.NEXT_PUBLIC_PROJECT_ID }}" >> .env
echo "NEXT_PUBLIC_ALCHEMY_KEY=${{ secrets.NEXT_PUBLIC_ALCHEMY_KEY }}" >> .env
- name: run Cypress and Jest
uses: cypress-io/github-action@v6
with:
build: pnpm build
start: pnpm start
wait-on: 'http://localhost:3000'
command: pnpm test
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Available scripts that can be run using `pnpm`:
| `prettier:fix` | Format code using Prettier and automatically fix issues. |
| `format` | Run Prettier and ESLint to format and fix code issues. |
| `format:check` | Check code formatting and linting without making changes. |
| `test` | Run tests using Cypress |
| `test:watch` | Run Cypress in watch mode. |
| `test` | Run tests using Cypress and Jest |

## Technologies Used

Expand Down
16 changes: 16 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Config } from 'jest';
import nextJest from 'next/jest.js';

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
});

// Add any custom config to be passed to Jest
const config: Config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config);
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"prepare": "husky install && wonderland-crypto-husky-checks install",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"test": "pnpm cypress:run"
"test:e2e": "pnpm cypress run",
"test:unit": "jest",
"test": "pnpm run test:unit && pnpm run test:e2e"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": "eslint --cache --fix",
Expand All @@ -48,10 +50,13 @@
},
"devDependencies": {
"@defi-wonderland/crypto-husky-checks": "1.3.0",
"@jest/globals": "29.7.0",
"@testing-library/jest-dom": "6.1.2",
"@testing-library/react": "14.2.1",
"@testing-library/user-event": "14.4.3",
"@types/jest": "29.5.12",
"@types/lodash.merge": "4.6.7",
"@types/node": "20.12.13",
"@types/react": "18.2.15",
"@types/react-dom": "18.2.7",
"@typescript-eslint/eslint-plugin": "6.0.0",
Expand All @@ -66,10 +71,14 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"husky": "8.0.3",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jsdom": "24.0.0",
"lodash.merge": "4.6.2",
"prettier": "3.0.3",
"styled-components": "6.0.7",
"ts-jest": "29.1.4",
"ts-node": "10.9.2",
"typescript": "5.4.2"
}
}
Loading

0 comments on commit edb0437

Please sign in to comment.