Skip to content

Commit 05d8832

Browse files
author
Nasfame
committed
Merge remote-tracking branch 'origin/main' into feat/model-train
Signed-off-by: Nasfame <laciferin@gmail.com> Took 7 minutes
2 parents 8c5810d + 770312a commit 05d8832

22 files changed

Lines changed: 3143 additions & 5993 deletions

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
.idea/
3+
.github/
4+
.run/
5+
.next/
6+
.vercel/

.github/workflows/cross.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
env:
19+
envfile: ${{secrets.ENV}}
1920
MODE: test
2021
NODE_ENV: testing
2122

@@ -83,8 +84,15 @@ jobs:
8384
architecture: ${{ matrix.architecture }}
8485
check-latest: true
8586

87+
- name: Write environment #TODO: add coachroach ssl certificate
88+
run: |
89+
echo $envfile > .env.tmp
90+
sed 's/ /\n/g' .env.tmp > .env
91+
source .env
92+
8693
- name: Install dependencies
8794
run: pnpm install
8895

96+
8997
# - name: Run tests for ${{runner.os}} TODO: once jest tests pass
9098
# run: npm run test

.github/workflows/docker.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# - "*"
8+
# - "**"
9+
tags:
10+
- '*'
11+
- '**'
12+
13+
pull_request:
14+
branches:
15+
- main
16+
merge_group:
17+
types: [checks_requested]
18+
19+
workflow_dispatch:
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
env:
26+
envfile: ${{secrets.ENV}}
27+
MODE: test
28+
NODE_ENV: testing
29+
30+
jobs:
31+
build-docker:
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
37+
- name: Build Docker
38+
run: docker build .

.github/workflows/e2e.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: E2E
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
pull_request:
9+
branches:
10+
- main
11+
merge_group:
12+
types: [checks_requested]
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
envfile: ${{secrets.ENV}}
21+
MODE: test
22+
NODE_ENV: testing
23+
24+
jobs:
25+
build-and-test:
26+
concurrency: db-test
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- uses: pnpm/action-setup@v2
33+
with:
34+
version: 8.6.6
35+
36+
- uses: actions/setup-node@v3
37+
with:
38+
cache: 'pnpm'
39+
node-version: 19
40+
check-latest: true
41+
42+
- name: Write environment
43+
run: |
44+
echo $envfile > .env
45+
sed -i 's/ /\n/g' .env
46+
source .env
47+
48+
- name: Install dependencies
49+
run: pnpm install
50+
51+
- name: Build
52+
run: npm run build
53+
54+
- name: Prisma Migration
55+
continue-on-error: true
56+
run: |
57+
echo "Migrating DB"
58+
#npx prisma migrate reset --force
59+
npx prisma migrate deploy
60+
61+
- name: Reset the DB
62+
if: ${{ failure() }}
63+
run: |
64+
npx prisma migrate dev
65+
66+
- name: Run tests
67+
run: npm run test
68+
69+
- name: E2E
70+
run: npm run test:e2e

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ next-env.d.ts
4040

4141
build/
4242

43-
.vercel/
43+
.vercel/
44+
prisma/generated/

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Build stage
2+
FROM node:19 AS builder
3+
WORKDIR /app
4+
5+
#COPY package*.json pnpm-lock.yaml ./
6+
7+
COPY . .
8+
9+
RUN sed -i '/provider = "prisma-client-js"/a \ \ binaryTargets = ["native", "linux-musl-openssl-3.0.x"]' prisma/schema.prisma
10+
11+
RUN npm install -g pnpm
12+
RUN pnpm install
13+
14+
RUN #npm run build already post-install
15+
16+
# Deploy stage
17+
FROM node:19-alpine
18+
19+
#only required for railway deployment
20+
21+
ENV PORT=8080
22+
ENV NODE_ENV="production"
23+
ENV MODE="prod"
24+
ENV DATABASE_URL=""
25+
26+
WORKDIR /app
27+
28+
EXPOSE $PORT
29+
30+
COPY --from=builder /app ./
31+
32+
CMD ["sh", "-c", "npm run test && npm run test:e2e"]
33+
34+
ENTRYPOINT ["npm", "run", "start:prod"]
35+
36+
LABEL maintainer="Hiro <laciferin@gmail.com>"

enums/ipfsProviders.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type IPFSProvider = string
2+
3+
export const LIGHTHOUSE:IPFSProvider = "LIGHTHOUSE"
4+
export const IPFS:IPFSProvider = "IPFS"
5+
export const INFURA:IPFSProvider = "INFURA"
6+
export const S3:IPFSProvider = "S3"

jest.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { pathsToModuleNameMapper } from 'ts-jest'
2-
import { compilerOptions } from './tsconfig.node.json'
1+
import {pathsToModuleNameMapper} from 'ts-jest'
2+
import {compilerOptions} from './tsconfig.node.json'
33

44
const jestConfig = {
5-
// preset: 'ts-jest',
5+
preset: 'ts-jest',
66
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
77
prefix: '<rootDir>/',
88
}),
99
testEnvironment: 'node',
1010
collectCoverageFrom: ['**/*.(t|j|mj)s'],
1111
coverageDirectory: '../coverage',
12-
testRegex: '.*\\.spec\\.(t|j|mj)s$',
13-
moduleFileExtensions: ['js', 'json', 'ts', 'mjs'],
12+
testRegex: '.*\\.spec\\.(t|j)s$',
13+
moduleFileExtensions: ['js', 'json', 'ts'],
1414
// automock: true,
1515
verbose: true,
1616
}

package.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,38 @@
55
"author": "laciferin@gmail.com",
66
"license": "MIT",
77
"private": true,
8+
"prisma": {
9+
"seed": "ts-node --transpile-only prisma/seed.ts"
10+
},
811
"scripts": {
912
"postinstall": "npm run build",
1013
"dev": "next dev",
14+
"start:dev": "concurrently \"pnpm:dev\" \"pnpm:prisma:generate:watch\"",
15+
"prebuild": "npm run prisma:generate",
1116
"build": "next build",
1217
"start": "next start",
1318
"lint": "next lint",
1419
"test": "jest --passWithNoTests",
15-
"run-cid": "ts-node utils/archived/cid.ts",
16-
"clean": "rimraf .next build"
20+
"run-cid-archived": "ts-node utils/archived/cid.ts",
21+
"run-cid": "ts-node utils/cid.ts",
22+
"run-compute": "ts-node utils/compute.ts",
23+
"clean": "rimraf .next build",
24+
"prisma:seed": "prisma db seed",
25+
"prisma:generate": "prisma generate",
26+
"prisma:generate:watch": "prisma generate --watch",
27+
"prisma:test:deploy": "cp .env.test .env && prisma migrate deploy && rm .env",
28+
"prisma:local:deploy": "cp .env.local .env && prisma migrate dev && rm .env",
29+
"prisma:deploy": "DEBUG=* prisma migrate deploy",
30+
"test:watch": "MODE=test jest --watch",
31+
"test:cov": "MODE=test jest --coverage",
32+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
33+
"test:e2e": "MODE=test jest --config ./test/jest-e2e.json",
34+
"test:e2e:watch": "MODE=test jest --watch --no-cache --config ./test/jest-e2e.json"
1735
},
1836
"dependencies": {
1937
"@jest/globals": "^29.7.0",
2038
"@lighthouse-web3/sdk": "^0.2.8",
39+
"@prisma/client": "^5.4.2",
2140
"@rainbow-me/rainbowkit": "^1.1.1",
2241
"@types/node": "20.6.2",
2342
"@types/react": "18.2.21",
@@ -27,6 +46,7 @@
2746
"@web3auth/ethereum-provider": "^7.0.4",
2847
"@web3auth/no-modal": "^7.0.4",
2948
"@web3auth/openlogin-adapter": "^7.0.4",
49+
"argon2": "^0.31.1",
3050
"autoprefixer": "10.4.15",
3151
"axios": "^1.5.1",
3252
"blob-to-buffer": "^1.2.9",
@@ -64,7 +84,10 @@
6484
"@types/file-saver": "^2.0.5",
6585
"@types/jest": "^29.5.5",
6686
"@types/mocha": "^10.0.2",
87+
"concurrently": "^8.2.1",
88+
"is-ipfs": "^8.0.1",
6789
"jest": "^29.7.0",
90+
"prisma": "^5.4.2",
6891
"react-devtools": "^4.28.4",
6992
"rimraf": "^5.0.5",
7093
"ts-jest": "^29.1.1",

0 commit comments

Comments
 (0)