diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f68f06..22f4597 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,3 +23,5 @@ jobs: - run: npm install - run: npm run test + + - run: docker-compose up --exit-code-from cli diff --git a/README.md b/README.md index 3639b5e..8a76df6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4595e02 --- /dev/null +++ b/docker-compose.yml @@ -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 diff --git a/packages/cli/src/demo.ts b/packages/cli/src/demo.ts index 2d947dd..45b43e0 100644 --- a/packages/cli/src/demo.ts +++ b/packages/cli/src/demo.ts @@ -12,7 +12,6 @@ import { const benchmark1: IBenchmark = { name: 'benchmark1', author: 'author1', - mode: 'mode1', stages: [ { // Candidate diff --git a/packages/sds/src/configuration.ts b/packages/sds/src/configuration.ts index 10b9af1..8715973 100644 --- a/packages/sds/src/configuration.ts +++ b/packages/sds/src/configuration.ts @@ -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 { diff --git a/packages/sds/src/database.ts b/packages/sds/src/database.ts index 53cf33c..6fa3888 100644 --- a/packages/sds/src/database.ts +++ b/packages/sds/src/database.ts @@ -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 diff --git a/packages/sds/src/laboratory/logic/interfaces.ts b/packages/sds/src/laboratory/logic/interfaces.ts index b478b8d..14cc55e 100644 --- a/packages/sds/src/laboratory/logic/interfaces.ts +++ b/packages/sds/src/laboratory/logic/interfaces.ts @@ -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', (u): u is Date => u instanceof Date, @@ -32,7 +31,6 @@ const createEnum = (e: any, name: string): t.Type => { // /////////////////////////////////////////////////////////////////////////////// -// 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; // /////////////////////////////////////////////////////////////////////////////// -// 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' ); -// 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; // 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; -// 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; -// 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; -// 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; -// 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; -// 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'); -// 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; -// 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; // /////////////////////////////////////////////////////////////////////////////// -// tslint:disable-next-line:variable-name export const UpdateRunStatusType = t.type({ status: RunStatusType, }); @@ -224,7 +205,6 @@ export type IUpdateRunStatus = t.TypeOf; // /////////////////////////////////////////////////////////////////////////////// -// tslint:disable-next-line:variable-name export const MeasuresType = t.UnknownRecord; export type Measures = t.TypeOf; @@ -234,7 +214,6 @@ export type Measures = t.TypeOf; // /////////////////////////////////////////////////////////////////////////////// -// tslint:disable-next-line:variable-name export const ReportRunResultsType = t.type({ measures: MeasuresType, }); @@ -246,7 +225,6 @@ export type IReportRunResults = t.TypeOf; // /////////////////////////////////////////////////////////////////////////////// -// 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; -// tslint:disable-next-line:variable-name export const ResultArrayType = t.array(ResultType); /////////////////////////////////////////////////////////////////////////////// diff --git a/packages/sds/src/laboratory/logic/sequelize_laboratory/models/benchmark.ts b/packages/sds/src/laboratory/logic/sequelize_laboratory/models/benchmark.ts index f55354d..e5eeba5 100644 --- a/packages/sds/src/laboratory/logic/sequelize_laboratory/models/benchmark.ts +++ b/packages/sds/src/laboratory/logic/sequelize_laboratory/models/benchmark.ts @@ -15,9 +15,6 @@ export class Benchmark extends Model implements IBenchmark { @Column(DataType.STRING) author!: string; - @Column(DataType.STRING) - mode!: string; - // TODO: REVIEW: magic number 1024 @Column(jsonColumn('stages', 1024)) stages!: PipelineStage[]; diff --git a/packages/sds/src/queue/index.ts b/packages/sds/src/queue/index.ts index f7cb36e..4dfdff9 100644 --- a/packages/sds/src/queue/index.ts +++ b/packages/sds/src/queue/index.ts @@ -47,9 +47,6 @@ export interface QueueConfiguration { * @param endpoint The location of the queue. */ export function GetQueue(config: QueueConfiguration): IQueue { - // 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(); diff --git a/packages/sds/test/laboratory/data.ts b/packages/sds/test/laboratory/data.ts index f4aa088..dc49ecc 100644 --- a/packages/sds/test/laboratory/data.ts +++ b/packages/sds/test/laboratory/data.ts @@ -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 diff --git a/packages/sds/tsconfig.build.json b/packages/sds/tsconfig.build.json index 248a214..e679b23 100644 --- a/packages/sds/tsconfig.build.json +++ b/packages/sds/tsconfig.build.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { + "experimentalDecorators": true, "outDir": "dist", "rootDir": "src", }, diff --git a/packages/server/openapi.yml b/packages/server/openapi.yml index 4d6c264..278222d 100644 --- a/packages/server/openapi.yml +++ b/packages/server/openapi.yml @@ -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 diff --git a/packages/server/src/configuration.ts b/packages/server/src/configuration.ts index 681d640..beffd37 100644 --- a/packages/server/src/configuration.ts +++ b/packages/server/src/configuration.ts @@ -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 { diff --git a/sample-data/benchmark1.yaml b/sample-data/benchmark1.yaml index 45140d0..a6131b8 100644 --- a/sample-data/benchmark1.yaml +++ b/sample-data/benchmark1.yaml @@ -1,6 +1,5 @@ name: benchmark1 author: author1 -mode: mode1 stages: - name: candidate kind: candidate diff --git a/scripts/laboratory.rest b/scripts/laboratory.rest index ddd2e06..960eee1 100644 --- a/scripts/laboratory.rest +++ b/scripts/laboratory.rest @@ -10,7 +10,6 @@ Content-Type: application/json { "name": "benchmark1", "author": "admin", - "mode": "default", "stages": [ { "name": "candidate",