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/D1062master
							parent
							
								
									38757ae139
								
							
						
					
					
						commit
						88b466b2c4
					
				@ -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 "$@"
 | 
				
			||||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					describe("sample test", () => {
 | 
				
			||||||
 | 
						it("always passes", () => {
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@ -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…
					
					
				
		Reference in New Issue