mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-03 17:30:22 +00:00
Fix NixOS tests, allow building via tsgo
This commit is contained in:
+2
-1
@@ -29,4 +29,5 @@ schemas_nested/
|
||||
schemas_final/
|
||||
|
||||
temp/
|
||||
!/extra/admin-api/Utilities/Spacebar.AdminApi.TestClient/wwwroot/lib/bootstrap/dist/
|
||||
!/extra/admin-api/Utilities/Spacebar.AdminApi.TestClient/wwwroot/lib/bootstrap/dist/
|
||||
*.qcow2
|
||||
Binary file not shown.
+1
-1
@@ -41,7 +41,7 @@ pkgs.buildNpmPackage {
|
||||
npmDeps = pkgs.importNpmLock { npmRoot = filteredSrc; };
|
||||
npmConfigHook = pkgs.importNpmLock.npmConfigHook;
|
||||
|
||||
npmBuildScript = "build:src";
|
||||
npmBuildScript = "build:src:tsgo";
|
||||
makeCacheWritable = true;
|
||||
nativeBuildInputs = with pkgs; [
|
||||
(pkgs.python3.withPackages (ps: with ps; [ setuptools ]))
|
||||
|
||||
Generated
BIN
Binary file not shown.
@@ -235,6 +235,7 @@ in
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/apply-migrations";
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -24,16 +24,50 @@ in
|
||||
cdnEndpoint = sb.mkEndpoint "cdn.sb.localhost" 3003 false;
|
||||
nginx.enable = true;
|
||||
serverName = "sb.localhost";
|
||||
extraEnvironment = {
|
||||
DATABASE = "postgres://postgres:postgres@127.0.0.1/spacebar";
|
||||
LOG_REQUESTS = "-"; # Log all requests
|
||||
LOG_VALIDATION_ERRORS = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.trace ("Testing with config: " + builtins.toJSON cfg) cfg;
|
||||
services.nginx.enable = true;
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
initdbArgs = [
|
||||
"--encoding=UTF8"
|
||||
"--locale=C.UTF-8"
|
||||
"--data-checksums"
|
||||
"--allow-group-access"
|
||||
];
|
||||
enableTCPIP = true;
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
# TYPE, DATABASE, USER, ADDRESS, METHOD
|
||||
local all all trust
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
host all all 0.0.0.0/0 md5
|
||||
'';
|
||||
initialScript = pkgs.writeText "backend-initScript" ''
|
||||
CREATE ROLE spacebar WITH LOGIN PASSWORD 'spacebar' CREATEDB;
|
||||
CREATE DATABASE spacebar;
|
||||
GRANT ALL PRIVILEGES ON DATABASE spacebar TO spacebar;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("spacebar-apply-migrations")
|
||||
machine.wait_for_unit("spacebar-api")
|
||||
machine.wait_for_unit("spacebar-cdn")
|
||||
machine.wait_for_unit("spacebar-gateway")
|
||||
# machine.succeed("curl -f http://api.sb.localhost/.well-known/spacebar/client")
|
||||
# Wait for unit doesn't mean the service is actually ready to accept connections
|
||||
machine.wait_for_open_port(80)
|
||||
machine.wait_for_open_port(3001)
|
||||
machine.wait_for_open_port(3002)
|
||||
machine.wait_for_open_port(3003)
|
||||
# If well known works, its probably fine(tm)?
|
||||
machine.succeed("curl -f http://api.sb.localhost/.well-known/spacebar/client")
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
# We don't care about CLI scripts:
|
||||
for f in ./node_modules/.bin/*; do
|
||||
rm -f "$(realpath $f)" $f
|
||||
done
|
||||
# sources
|
||||
echo "Removing source files..."
|
||||
find ./node_modules -name '*.ts' -type f -delete
|
||||
@@ -30,17 +34,15 @@ find ./node_modules -name '*.ar-file-list' -type f -delete
|
||||
find ./node_modules -name '*.stamp' -type f -delete
|
||||
find ./node_modules -name '*musl.node' -type f -delete
|
||||
rm -rf ./node_modules/typescript
|
||||
rm -rf ./node_modules/@typescript/native-preview
|
||||
rm -rf ./node_modules/ts-node
|
||||
rm -rf ./node_modules/node-gyp
|
||||
rm -rf ./node_modules/node-gyp-build-optional-packages
|
||||
rm -rf ./node_modules/discord-protos/{discord_protos,scripts}
|
||||
|
||||
# We don't care about CLI scripts:
|
||||
for f in ./node_modules/.bin/*; do
|
||||
rm -vf "$(realpath $f)" $f
|
||||
done
|
||||
# rm -rf ./node_modules/typescript-json-schema
|
||||
rm -rf ./node_modules/node-gyp
|
||||
find ./node_modules -name '@types' -type d -exec rm -rfv {} +
|
||||
find ./node_modules -name '@types' -type d -exec rm -rf {} +
|
||||
|
||||
echo "Removing random common files..."
|
||||
find ./node_modules -name 'test' -type d -exec rm -rf {} +
|
||||
@@ -117,4 +119,5 @@ if false; then
|
||||
fi
|
||||
|
||||
echo "Removing empty directories..."
|
||||
find node_modules -maxdepth 1 -type d -empty -delete
|
||||
find node_modules -maxdepth 1 -type d -empty -delete
|
||||
echo "Trimming complete."
|
||||
Generated
BIN
Binary file not shown.
@@ -11,6 +11,8 @@
|
||||
"start:gateway": "node --enable-source-maps dist/gateway/start.js",
|
||||
"build": "npm run build:src && npm run generate:schema && npm run generate:openapi",
|
||||
"build:src": "tsc -b -v",
|
||||
"build:tsgo": "npm run build:src:tsgo && npm run generate:schema && npm run generate:openapi",
|
||||
"build:src:tsgo": "rm -rf dist/* && tsgo -b -v && mv -v dist/src/* dist/ && rm -rfv dist/src",
|
||||
"watch": "tsc -w -b .",
|
||||
"test": "node scripts/test.js",
|
||||
"lint": "eslint .",
|
||||
@@ -62,6 +64,7 @@
|
||||
"@types/ws": "^8.18.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
||||
"@typescript-eslint/parser": "^8.51.0",
|
||||
"@typescript/native-preview": "^7.0.0-dev.20260119.1",
|
||||
"eslint": "^9.39.2",
|
||||
"globals": "^16.5.0",
|
||||
"husky": "^9.1.7",
|
||||
|
||||
@@ -11,5 +11,7 @@ process.env.DB_LOGGING = "true";
|
||||
import { closeDatabase, initDatabase } from "@spacebar/util";
|
||||
|
||||
initDatabase().then(() => {
|
||||
closeDatabase().then((r) => {});
|
||||
closeDatabase().then((r) => {
|
||||
console.log("Successfully applied migrations!");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user