Skip to content

Commit

Permalink
Fix build (#20)
Browse files Browse the repository at this point in the history
* Exclude tests from build output to fix build. Also move types into src to avoid generation of scenario.js on build which could end up out of sync

* Add build to test workflow

* Add further excludes in case we add non-test .ts files as helpers to the test directories
  • Loading branch information
mattdean-digicatapult committed Sep 5, 2022
1 parent 70aa97e commit 172cb20
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ jobs:
- name: Lint
run: npm run lint

build:
name: Run build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: 16.x
- name: Cache Node.js modules
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install Packages
run: npm ci
- name: Lint
run: npm run build

dependency-check:
name: Run dependency check
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/scenario/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Controller, Get, Query, Path, Route, Response } from 'tsoa'
import config from 'config'
import { exec } from 'child_process'
import { IScenario, HostResponse, Executables } from '../../../types'
import { IScenario, HostResponse, Executables } from '../../types'
import Logger from '../../utils/Logger'
import * as paramUtil from '../../utils/params'
import * as execUtil from '../../utils/executables'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion types/models/scenario.ts → src/types/models/scenario.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExecException } from 'child_process'
import Logger from '../../src/utils/Logger'
import Logger from '../../utils/Logger'

export type Executables =
| 'out-of-bounds-access-aarch64'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Response as ExResponse, Request as ExRequest, NextFunction } from 'expr
import { ValidateError } from 'tsoa'

import logger from './Logger'
import { Executables } from '../../types'
import { Executables } from '../types'

export interface ValidateErrorJSON {
message: 'Validation failed'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/executables.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs/promises'

import logger from './Logger'
import { Executables } from '../../types'
import { Executables } from '../types'

const validExecutables: Executables[] = [
'out-of-bounds-access-aarch64',
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
"pino": ["node_modules/pino"],
"types": ["types"]
}
}
},
"exclude": [
"**/*.test.ts",
"integration",
"**/__test__"
]
}
2 changes: 0 additions & 2 deletions types/models/scenario.js

This file was deleted.

0 comments on commit 172cb20

Please sign in to comment.