Remove benchmark mode, remove tslint comments, add Docker in CI

This commit is contained in:
Noel Bundick 2020-08-11 22:48:32 +00:00
Родитель 3634f45360
Коммит 2ecf45fa8d
15 изменённых файлов: 17 добавлений и 48 удалений

2
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -23,3 +23,5 @@ jobs:
- run: npm install
- run: npm run test
- run: docker-compose up --exit-code-from cli

Просмотреть файл

@ -91,7 +91,6 @@ we can use the `demo` command to populate the server with sample data, including
=== Sample benchmark ===
name: benchmark1
author: author1
mode: mode1
stages:
- name: candidate
kind: candidate
@ -183,7 +182,6 @@ stages:
path: /reference
name: benchmark1
author: author1
mode: mode1
createdAt: 2020-07-27T22:32:28.865Z
updatedAt: 2020-07-27T22:32:43.284Z

14
docker-compose.yml Normal file
Просмотреть файл

@ -0,0 +1,14 @@
version: '3.8'
services:
laboratory:
build:
context: .
target: server
cli:
build:
context: .
target: cli
command: /bin/sh -c 'sds-cli connect http://laboratory:3000 && sds-cli demo'
depends_on:
- laboratory

Просмотреть файл

@ -12,7 +12,6 @@ import {
const benchmark1: IBenchmark = {
name: 'benchmark1',
author: 'author1',
mode: 'mode1',
stages: [
{
// Candidate

Просмотреть файл

@ -49,8 +49,6 @@ export function ParseQueueConfiguration(): QueueConfiguration {
.required(mode !== QueueMode.InMemory)
.asUrlString();
// tsc ensures exhaustiveness checking, but tslint thinks it's an error
// tslint:disable:switch-default
switch (mode) {
case QueueMode.Azure:
return {

Просмотреть файл

@ -21,9 +21,6 @@ export interface AzureSqlDatabaseConfiguration extends DatabaseConfiguration {
export function GetSequelizeOptions(
config: DatabaseConfiguration
): SequelizeOptions {
// tsc ensures that all elements of the discriminated union are covered: https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
// The following is safe but tslint doesn't understand, so we suppress the rule: https://github.com/palantir/tslint/issues/2104
// tslint:disable:switch-default
switch (config.mode) {
case DatabaseMode.AzureSql:
// eslint-disable-next-line no-case-declarations

Просмотреть файл

@ -2,7 +2,6 @@ import { either } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import { DateTime } from 'luxon';
// tslint:disable-next-line:variable-name
const DateType = new t.Type<Date, string, unknown>(
'Date',
(u): u is Date => u instanceof Date,
@ -32,7 +31,6 @@ const createEnum = <E>(e: any, name: string): t.Type<E> => {
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const ClientConnectionInfoType = t.union([
t.type({
type: t.literal('aad'),
@ -52,7 +50,6 @@ export type IClientConnectionInfo = t.TypeOf<typeof ClientConnectionInfoType>;
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const EntityBaseType = t.intersection([
t.type({
name: t.string,
@ -76,13 +73,11 @@ export enum BenchmarkStageKind {
CONTAINER = 'container',
}
// tslint:disable-next-line:variable-name
const BenchmarkStageKindType = createEnum<BenchmarkStageKind>(
BenchmarkStageKind,
'BenchmarkStageKind'
);
// tslint:disable-next-line:variable-name
const PipelineStageVolumeMountType = t.type({
volume: t.string,
path: t.string,
@ -90,7 +85,6 @@ const PipelineStageVolumeMountType = t.type({
type PipelineStageVolumeMount = t.TypeOf<typeof PipelineStageVolumeMountType>;
// TODO: make 'image' required when kind == 'container'
// tslint:disable-next-line:variable-name
const PipelineStageType = t.intersection([
t.type({
name: t.string,
@ -103,17 +97,14 @@ const PipelineStageType = t.intersection([
]);
export type PipelineStage = t.TypeOf<typeof PipelineStageType>;
// tslint:disable-next-line:variable-name
export const BenchmarkType = t.intersection([
EntityBaseType,
t.interface({
mode: t.string,
stages: t.array(PipelineStageType),
}),
]);
export type IBenchmark = t.TypeOf<typeof BenchmarkType>;
// tslint:disable-next-line:variable-name
export const BenchmarkArrayType = t.array(BenchmarkType);
///////////////////////////////////////////////////////////////////////////////
@ -122,7 +113,6 @@ export const BenchmarkArrayType = t.array(BenchmarkType);
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const CandidateType = t.intersection([
EntityBaseType,
t.interface({
@ -132,7 +122,6 @@ export const CandidateType = t.intersection([
]);
export type ICandidate = t.TypeOf<typeof CandidateType>;
// tslint:disable-next-line:variable-name
export const CandidateArrayType = t.array(CandidateType);
///////////////////////////////////////////////////////////////////////////////
@ -141,7 +130,6 @@ export const CandidateArrayType = t.array(CandidateType);
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
const SuiteVolumeType = t.type({
name: t.string,
type: t.string,
@ -149,7 +137,6 @@ const SuiteVolumeType = t.type({
});
export type SuiteVolume = t.TypeOf<typeof SuiteVolumeType>;
// tslint:disable-next-line:variable-name
export const SuiteType = t.intersection([
EntityBaseType,
t.interface({
@ -159,7 +146,6 @@ export const SuiteType = t.intersection([
]);
export type ISuite = t.TypeOf<typeof SuiteType>;
// tslint:disable-next-line:variable-name
export const SuiteArrayType = t.array(SuiteType);
///////////////////////////////////////////////////////////////////////////////
@ -175,10 +161,8 @@ export enum RunStatus {
FAILED = 'failed',
}
// tslint:disable-next-line:variable-name
const RunStatusType = createEnum<RunStatus>(RunStatus, 'RunStatus');
// tslint:disable-next-line:variable-name
export const RunType = t.intersection([
EntityBaseType,
t.interface({
@ -190,7 +174,6 @@ export const RunType = t.intersection([
]);
export type IRun = t.TypeOf<typeof RunType>;
// tslint:disable-next-line:variable-name
export const RunArrayType = t.array(RunType);
///////////////////////////////////////////////////////////////////////////////
@ -199,7 +182,6 @@ export const RunArrayType = t.array(RunType);
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const RunRequestType = t.type({
candidate: t.string,
suite: t.string,
@ -212,7 +194,6 @@ export type IRunRequest = t.TypeOf<typeof RunRequestType>;
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const UpdateRunStatusType = t.type({
status: RunStatusType,
});
@ -224,7 +205,6 @@ export type IUpdateRunStatus = t.TypeOf<typeof UpdateRunStatusType>;
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const MeasuresType = t.UnknownRecord;
export type Measures = t.TypeOf<typeof MeasuresType>;
@ -234,7 +214,6 @@ export type Measures = t.TypeOf<typeof MeasuresType>;
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const ReportRunResultsType = t.type({
measures: MeasuresType,
});
@ -246,7 +225,6 @@ export type IReportRunResults = t.TypeOf<typeof ReportRunResultsType>;
//
///////////////////////////////////////////////////////////////////////////////
// tslint:disable-next-line:variable-name
export const ResultType = t.intersection([
EntityBaseType,
t.type({
@ -258,7 +236,6 @@ export const ResultType = t.intersection([
]);
export type IResult = t.TypeOf<typeof ResultType>;
// tslint:disable-next-line:variable-name
export const ResultArrayType = t.array(ResultType);
///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -15,9 +15,6 @@ export class Benchmark extends Model<Benchmark> implements IBenchmark {
@Column(DataType.STRING)
author!: string;
@Column(DataType.STRING)
mode!: string;
// TODO: REVIEW: magic number 1024
@Column(jsonColumn<PipelineStage[]>('stages', 1024))
stages!: PipelineStage[];

Просмотреть файл

@ -47,9 +47,6 @@ export interface QueueConfiguration {
* @param endpoint The location of the queue.
*/
export function GetQueue<T>(config: QueueConfiguration): IQueue<T> {
// tsc ensures that all elements of the discriminated union are covered: https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
// The following is safe but tslint doesn't understand, so we suppress the rule: https://github.com/palantir/tslint/issues/2104
// tslint:disable:switch-default
switch (config.mode) {
case QueueMode.InMemory:
return new InMemoryQueue<T>();

Просмотреть файл

@ -25,7 +25,6 @@ export const timestamps = {
export const benchmark1: IBenchmark = {
name: 'benchmark1',
author: 'author1',
mode: 'mode1',
stages: [
{
// Candidate
@ -57,7 +56,6 @@ export const benchmark1: IBenchmark = {
export const benchmark2: IBenchmark = {
name: 'benchmark2',
author: 'author2',
mode: 'mode1',
stages: [
{
// Candidate
@ -89,7 +87,6 @@ export const benchmark2: IBenchmark = {
export const benchmark3: IBenchmark = {
name: 'benchmark3',
author: 'author3',
mode: 'mode1',
stages: [
{
// Candidate

Просмотреть файл

@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"experimentalDecorators": true,
"outDir": "dist",
"rootDir": "src",
},

Просмотреть файл

@ -275,14 +275,11 @@ components:
allOf:
- $ref: "#/components/schemas/IEntityBase"
properties:
mode:
type: string
stages:
type: array
items:
$ref: "#/components/schemas/PipelineStage"
required:
- mode
- stages
ISuite:
type: object

Просмотреть файл

@ -29,7 +29,6 @@ export interface AADConfiguration extends AuthConfiguration {
scopes: string[];
}
// tslint:disable-next-line:variable-name
export const NoAuthConfiguration = {
mode: AuthMode.None,
};
@ -56,8 +55,6 @@ export function ParseDatabaseConfiguration(): DatabaseConfiguration {
.required(mode !== DatabaseMode.InMemory)
.asString();
// tsc ensures exhaustiveness checking, but tslint thinks it's an error
// tslint:disable:switch-default
switch (mode) {
case DatabaseMode.AzureSql:
return {

Просмотреть файл

@ -1,6 +1,5 @@
name: benchmark1
author: author1
mode: mode1
stages:
- name: candidate
kind: candidate

Просмотреть файл

@ -10,7 +10,6 @@ Content-Type: application/json
{
"name": "benchmark1",
"author": "admin",
"mode": "default",
"stages": [
{
"name": "candidate",