-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
416 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
icon_cache | ||
logs | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
TZ="UTC" | ||
ROBOCHIMP_DATABASE_URL="postgresql://postgres:postgres@localhost:5435/robochimp_integration_test?connection_limit=500&pool_timeout=0&schema=public" | ||
DATABASE_URL="postgresql://postgres:postgres@localhost:5435/osb_integration_test?connection_limit=500&pool_timeout=0&schema=public" | ||
CLIENT_ID=111398433321891634 | ||
BOT_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | ||
TEST=true | ||
TEST=true | ||
CI=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
services: | ||
osb: | ||
db: | ||
image: postgres:16-alpine | ||
command: -c 'max_connections=1000' | ||
restart: always | ||
container_name: osb_database | ||
ports: | ||
- "5435:3001" | ||
- "5435:5435" | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
PGPORT: 3001 | ||
PGPORT: 5435 | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
app: | ||
build: | ||
context: . | ||
depends_on: | ||
- db | ||
environment: | ||
ROBOCHIMP_DATABASE_URL: postgresql://postgres:postgres@db:5435/robochimp_integration_test?connection_limit=500&pool_timeout=0&schema=public | ||
DATABASE_URL: postgresql://postgres:postgres@db:5435/osb_integration_test?connection_limit=500&pool_timeout=0&schema=public | ||
WAIT_HOSTS: db:5435 | ||
|
||
volumes: | ||
postgres_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM node:20.15.0-alpine AS base | ||
WORKDIR /usr/src/app | ||
ENV CI=true | ||
RUN apk add --no-cache dumb-init python3 g++ make git | ||
RUN corepack enable | ||
|
||
COPY yarn.lock package.json .yarnrc.yml ./ | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
|
||
FROM base AS dependencies | ||
WORKDIR /usr/src/app | ||
RUN yarn remove zlib-sync && yarn install | ||
|
||
FROM base AS build-run | ||
WORKDIR /usr/src/app | ||
ENV NODE_ENV="development" | ||
ENV NODE_OPTIONS="--enable-source-maps --max_old_space_size=4096" | ||
|
||
COPY --from=dependencies /usr/src/app/node_modules /usr/src/app/node_modules | ||
COPY . . | ||
|
||
ENV CI=true | ||
RUN cp .env.test .env | ||
RUN cp src/config.example.ts src/config.ts | ||
|
||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait | ||
RUN chmod +x /wait | ||
|
||
CMD /wait && \ | ||
yarn prisma db push --schema='./prisma/robochimp.prisma' && \ | ||
yarn prisma db push --schema='./prisma/schema.prisma' && \ | ||
yarn run build:esbuild && \ | ||
yarn vitest run --config vitest.integration.config.mts && \ | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"scripts": { | ||
"watch": "nodemon -e ts -w src --exec 'yarn buildandrun'", | ||
"build": "tsx ./src/scripts/build.ts", | ||
"fix": "tsx ./src/scripts/troubleshooter.ts", | ||
"start": "yarn build && node --enable-source-maps dist/", | ||
|
@@ -9,12 +10,15 @@ | |
"build:tsc": "tsc -p src", | ||
"wipedist": "node -e \"try { require('fs').rmSync('dist', { recursive: true }) } catch(_){}\"", | ||
"dev": "yarn && yarn wipedist && yarn lint && yarn build && yarn test && npm i -g dpdm && dpdm --exit-code circular:1 --progress=false --warning=false --tree=false ./dist/index.js", | ||
"test": "concurrently --timings --raw --kill-others-on-fail \"tsc -p src\" \"yarn test:lint\" \"yarn test:unit\" \"tsc -p tests/integration\" \"tsc -p tests/unit\"", | ||
"test": "concurrently --raw --kill-others-on-fail \"tsc -p src\" \"yarn test:lint\" \"yarn test:unit\" \"tsc -p tests/integration\" \"tsc -p tests/unit\"", | ||
"test:lint": "biome check --diagnostic-level=error", | ||
"test:unit": "vitest run --coverage --config vitest.unit.config.mts", | ||
"test:watch": "vitest --config vitest.unit.config.mts --coverage", | ||
"test:integration": "tsx ./src/scripts/integration-tests.ts", | ||
"watch": "tsc -w -p src" | ||
"buildandrun": "yarn build:esbuild && node dist", | ||
"build:esbuild": "concurrently --raw \"yarn build:main\" \"yarn build:workers\"", | ||
"build:main": "esbuild src/index.ts src/lib/workers/index.ts --minify --legal-comments=none --outdir=./dist --log-level=error --bundle --platform=node --loader:.node=file --external:@napi-rs/canvas --external:@prisma/robochimp --external:@prisma/client --external:zlib-sync --external:bufferutil --external:oldschooljs --external:discord.js --external:node-fetch --external:piscina", | ||
"build:workers": "esbuild src/lib/workers/kill.worker.ts src/lib/workers/finish.worker.ts src/lib/workers/casket.worker.ts --log-level=error --bundle --minify --legal-comments=none --outdir=./dist/lib/workers --platform=node --loader:.node=file --external:@napi-rs/canvas --external:@prisma/robochimp --external:@prisma/client --external:zlib-sync --external:bufferutil --external:oldschooljs --external:discord.js --external:node-fetch --external:piscina" | ||
}, | ||
"dependencies": { | ||
"@napi-rs/canvas": "^0.1.53", | ||
|
@@ -51,7 +55,9 @@ | |
"@types/node-fetch": "^2.6.1", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"concurrently": "^8.2.2", | ||
"esbuild": "0.21.5", | ||
"fast-glob": "^3.3.2", | ||
"nodemon": "^3.1.4", | ||
"prettier": "^3.3.2", | ||
"prisma": "^5.16.1", | ||
"tsx": "^4.16.2", | ||
|
@@ -61,5 +67,8 @@ | |
"engines": { | ||
"node": "20.15.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
"packageManager": "[email protected]", | ||
"resolutions": { | ||
"esbuild": "0.21.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.