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
This commit is contained in:
parent
38757ae139
commit
88b466b2c4
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"phabricator.uri": "https://hub.sealcode.org/",
|
"phabricator.uri": "https://hub.sealcode.org/",
|
||||||
"arc.land.onto.default": "dev",
|
"arc.land.onto.default": "hotwire",
|
||||||
"load": ["arcanist-linters", "arc-unit-mocha/src"],
|
"load": ["arcanist-linters", "arc-unit-mocha/src"],
|
||||||
"unit.engine": "MochaEngine",
|
"unit.engine": "MochaEngine",
|
||||||
"unit.mocha.include": ["./lib/**/*.test.js"],
|
"unit.mocha.include": ["./lib/**/*.test.js"],
|
||||||
|
@ -20,6 +20,7 @@ module.exports = {
|
|||||||
/* "jsdoc/require-description": 2, */
|
/* "jsdoc/require-description": 2, */
|
||||||
"no-await-in-loop": 2,
|
"no-await-in-loop": 2,
|
||||||
"with-tsc-error/all": ["warn", {}],
|
"with-tsc-error/all": ["warn", {}],
|
||||||
|
"@typescript-eslint/restrict-template-expressions": 0,
|
||||||
},
|
},
|
||||||
settings: { jsdoc: { mode: "typescript" } },
|
settings: { jsdoc: { mode: "typescript" } },
|
||||||
overrides: [
|
overrides: [
|
||||||
|
@ -3,14 +3,19 @@ services:
|
|||||||
db:
|
db:
|
||||||
image: mongo:4.4-bionic
|
image: mongo:4.4-bionic
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:20723:27017"
|
- "127.0.0.1:2${SEALIOUS_PORT:-0723}:27017"
|
||||||
test:
|
test:
|
||||||
image: sealious-test:latest
|
image: sealious-test:latest
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: test.dockerfile
|
dockerfile: test.dockerfile
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/opt/app/
|
- ./:/opt/sealious/
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8080:8080"
|
- "127.0.0.1:${SEALIOUS_PORT:-8080}:${SEALIOUS_PORT:-8080}"
|
||||||
user: ${UID:-1000}:${GID:-1000}
|
user: ${UID:-1000}:${GID:-1000}
|
||||||
|
mailcatcher:
|
||||||
|
image: schickling/mailcatcher:latest
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:1080:1080"
|
||||||
|
- "127.0.0.1:1025:1025"
|
27
jenkins.start.sh
Executable file
27
jenkins.start.sh
Executable file
@ -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"
|
3
npm.sh
Executable file
3
npm.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
docker-compose run --user="$UID" --rm --service-ports test npm --loglevel warn "$@"
|
15131
package-lock.json
generated
15131
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@
|
|||||||
"stimulus": "^2.0.0"
|
"stimulus": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/koa__router": "^8.0.4",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
"concurrently": "^5.3.0",
|
"concurrently": "^5.3.0",
|
||||||
"eslint": "^7.19.0",
|
"eslint": "^7.19.0",
|
||||||
@ -34,6 +35,9 @@
|
|||||||
"eslint-plugin-prettier": "^3.3.1",
|
"eslint-plugin-prettier": "^3.3.1",
|
||||||
"eslint-plugin-with-tsc-error": "^0.0.7",
|
"eslint-plugin-with-tsc-error": "^0.0.7",
|
||||||
"kill-port": "^1.6.1",
|
"kill-port": "^1.6.1",
|
||||||
|
"mocha": "^8.4.0",
|
||||||
|
"mri": "^1.1.6",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"ts-loader": "^8.0.14",
|
"ts-loader": "^8.0.14",
|
||||||
"typescript": "^4.1.3",
|
"typescript": "^4.1.3",
|
||||||
|
@ -8,13 +8,17 @@ const PORT = process.env.SEALIOUS_PORT
|
|||||||
? parseInt(process.env.SEALIOUS_PORT)
|
? parseInt(process.env.SEALIOUS_PORT)
|
||||||
: 8080;
|
: 8080;
|
||||||
const base_url = process.env.SEALIOUS_BASE_URL || `http://localhost:${PORT}`;
|
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 {
|
export default class TheApp extends App {
|
||||||
config = {
|
config = {
|
||||||
upload_path: locreq.resolve("uploaded_files"),
|
upload_path: locreq.resolve("uploaded_files"),
|
||||||
datastore_mongo: {
|
datastore_mongo: {
|
||||||
host: "localhost",
|
host: MONGO_HOST,
|
||||||
port: 20723,
|
port: MONGO_PORT,
|
||||||
db_name: "sealious-playground",
|
db_name: "sealious-playground",
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
|
@ -13,7 +13,6 @@ router.post(
|
|||||||
.make({
|
.make({
|
||||||
title: ctx.$body.title as string,
|
title: ctx.$body.title as string,
|
||||||
done: false,
|
done: false,
|
||||||
is_active: false,
|
|
||||||
})
|
})
|
||||||
.save(ctx.$context);
|
.save(ctx.$context);
|
||||||
ctx.body = await MainView(ctx.$context);
|
ctx.body = await MainView(ctx.$context);
|
||||||
|
5
src/back/sample.test.ts
Normal file
5
src/back/sample.test.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
describe("sample test", () => {
|
||||||
|
it("always passes", () => {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
});
|
@ -12,7 +12,8 @@
|
|||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": ["./**/*"]
|
"include": ["./**/*"]
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ export function Task(task: CollectionItem<any>) {
|
|||||||
${task.get("done") ? "checked" : ""}
|
${task.get("done") ? "checked" : ""}
|
||||||
/>
|
/>
|
||||||
${task.get("title")}
|
${task.get("title")}
|
||||||
|
|
||||||
<form
|
<form
|
||||||
method="DELETE"
|
method="DELETE"
|
||||||
action="/tasks/${task.id}"
|
action="/tasks/${task.id}"
|
||||||
|
72
test.js
Normal file
72
test.js
Normal file
@ -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…
x
Reference in New Issue
Block a user