Jenkins scripts

Summary:
Add some jenkins scripts so it's possible to deploy the app easily

Hotfix

Test Plan: tbd

Reviewers: #reviewers

Differential Revision: https://hub.sealcode.org/D1062
master
Kuba Orlik 4 years ago
parent 38757ae139
commit 88b466b2c4

@ -1,6 +1,6 @@
{
"phabricator.uri": "https://hub.sealcode.org/",
"arc.land.onto.default": "dev",
"arc.land.onto.default": "hotwire",
"load": ["arcanist-linters", "arc-unit-mocha/src"],
"unit.engine": "MochaEngine",
"unit.mocha.include": ["./lib/**/*.test.js"],

@ -20,6 +20,7 @@ module.exports = {
/* "jsdoc/require-description": 2, */
"no-await-in-loop": 2,
"with-tsc-error/all": ["warn", {}],
"@typescript-eslint/restrict-template-expressions": 0,
},
settings: { jsdoc: { mode: "typescript" } },
overrides: [

@ -3,14 +3,19 @@ services:
db:
image: mongo:4.4-bionic
ports:
- "127.0.0.1:20723:27017"
- "127.0.0.1:2${SEALIOUS_PORT:-0723}:27017"
test:
image: sealious-test:latest
build:
context: .
dockerfile: test.dockerfile
volumes:
- ./:/opt/app/
- ./:/opt/sealious/
ports:
- "127.0.0.1:8080:8080"
- "127.0.0.1:${SEALIOUS_PORT:-8080}:${SEALIOUS_PORT:-8080}"
user: ${UID:-1000}:${GID:-1000}
mailcatcher:
image: schickling/mailcatcher:latest
ports:
- "127.0.0.1:1080:1080"
- "127.0.0.1:1025:1025"

@ -0,0 +1,27 @@
#!/bin/bash
docker-compose down
set -e
export SEALIOUS_PORT=$1
export SEALIOUS_BASE_URL=$2
docker-compose down
docker-compose up -d db
./npm.sh ci
./npm.sh run build:back;
./npm.sh run build:front;
rm -f log.txt
docker-compose run --user="$UID"\
-e "SEALIOUS_MONGO_PORT=27017" \
-e "SEALIOUS_MONGO_HOST=db" \
-e "SEALIOUS_PORT=$SEALIOUS_PORT" \
-e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \
-p ${SEALIOUS_PORT}:${SEALIOUS_PORT} \
-d \
test \
/bin/sh -c "node . > log.txt" \
&& echo "App started on $SEALIOUS_PORT"

@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker-compose run --user="$UID" --rm --service-ports test npm --loglevel warn "$@"

12879
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -27,6 +27,7 @@
"stimulus": "^2.0.0"
},
"devDependencies": {
"@types/koa__router": "^8.0.4",
"babel-loader": "^8.2.2",
"concurrently": "^5.3.0",
"eslint": "^7.19.0",
@ -34,6 +35,9 @@
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-with-tsc-error": "^0.0.7",
"kill-port": "^1.6.1",
"mocha": "^8.4.0",
"mri": "^1.1.6",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"ts-loader": "^8.0.14",
"typescript": "^4.1.3",

@ -8,13 +8,17 @@ const PORT = process.env.SEALIOUS_PORT
? parseInt(process.env.SEALIOUS_PORT)
: 8080;
const base_url = process.env.SEALIOUS_BASE_URL || `http://localhost:${PORT}`;
const MONGO_PORT = process.env.SEALIOUS_MONGO_PORT
? parseInt(process.env.SEALIOUS_MONGO_PORT)
: 20723;
const MONGO_HOST = process.env.SEALIOUS_MONGO_HOST || "localhost";
export default class TheApp extends App {
config = {
upload_path: locreq.resolve("uploaded_files"),
datastore_mongo: {
host: "localhost",
port: 20723,
host: MONGO_HOST,
port: MONGO_PORT,
db_name: "sealious-playground",
},
email: {

@ -13,7 +13,6 @@ router.post(
.make({
title: ctx.$body.title as string,
done: false,
is_active: false,
})
.save(ctx.$context);
ctx.body = await MainView(ctx.$context);

@ -0,0 +1,5 @@
describe("sample test", () => {
it("always passes", () => {
return true;
});
});

@ -12,7 +12,8 @@
"checkJs": true,
"allowJs": true,
"resolveJsonModule": true,
"sourceMap": true
"sourceMap": true,
"skipLibCheck": true
},
"include": ["./**/*"]
}

@ -13,6 +13,7 @@ export function Task(task: CollectionItem<any>) {
${task.get("done") ? "checked" : ""}
/>
${task.get("title")}
<form
method="DELETE"
action="/tasks/${task.id}"

@ -0,0 +1,72 @@
const mri = require("mri");
const { spawn } = require("child_process");
const argv = process.argv.slice(2);
const args = mri(argv);
const bin_dir = "./node_modules/.bin/";
const mocha = bin_dir + "mocha";
let mocha_options = [
"--recursive",
"--timeout=10000",
"--require",
"source-map-support/register",
];
if (args["test-report"]) {
mocha_options = [
...mocha_options,
// "--require",
// "ts-node/register",
// "--require",
// "./src/http/type-overrides.ts",
"--reporter",
"xunit",
"--reporter-option",
"output=.xunit",
];
}
const mocha_files = ["dist/**/*.test.js"];
let command = [mocha, ...mocha_options, ...mocha_files];
if (args.cover) {
const nyc = [
bin_dir + "nyc",
"-all",
"--exclude",
"src/front",
"--exclude",
"dist",
"--source-map",
"false",
];
if (args["cover-html"]) {
nyc.push("--reporter", "lcov");
} else {
nyc.push("--reporter", "clover");
}
command = [...nyc, ...command];
}
if (args.debug) {
command = ["node", "inspect", ...command];
}
console.log("spawning mocha...", command);
const proc = spawn(command[0], command.slice(1), {
stdio: "inherit",
env: process.env,
});
proc.on("exit", function (code) {
if (args["test-report"]) {
process.exit(0);
} else {
process.exit(code);
}
});
Loading…
Cancel
Save