diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a6ad02..6a0feb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,6 +98,8 @@ jobs: ${{ runner.OS }}- - name: Install Packages run: npm ci + - name: Install morello-examples + run: npm run examples:update - name: Build OpenAPI run: npm run build:tsoa - name: Setup dependencies diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a446c6c..485f162 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -103,6 +103,8 @@ jobs: ${{ runner.OS }}- - name: Install Packages run: npm ci + - name: Install morello-examples + run: npm run examples:update - name: Build OpenAPI run: npm run build:tsoa - name: Setup dependencies diff --git a/README.md b/README.md index 7e05906..e3fb243 100644 --- a/README.md +++ b/README.md @@ -23,20 +23,30 @@ Alternatively create a `./config/local.json` file to override the values of `def ## Binaries -Binaries to be executed by the API are located in the [bin](./bin/) directory, however the API is primarily designed to be used as a docker image. [Dockerfile](./Dockerfile) replaces the contents of `bin` with the latest binaries from [`morello-examples`](https://github.com/digicatapult/morello-examples), a separately maintained list of examples designed to illustrate how certain common software defects can be protected against by running on a Cheri-enabled platform. +Binaries to be executed by the API should by default be located in the [bin](./bin/) directory. If using the Docker image built from this repository the latest binaries are included at image build time from the latest release of [https://github.com/digicatapult/morello-examples](https://github.com/digicatapult/morello-examples). When developing locally you can either download the latest binaries from that repository or there are a couple of helper npm scripts to help you manage them. To update to the latest release you can run: -Some simple binaries are included in this repository for local testing. Binaries can also be added manually to the `bin` directory. Each binary will need its filename added to the [`Executables`](./types/models/scenario.ts) type to appear as an option on the API route. +```sh +npm run examples:update +``` + +And to perform a purge of currently installed binaries do: + +```sh +npm run examples:clean +``` ## Getting started ```sh - # start dependencies +# start dependencies docker compose up -d - # install packages +# install packages npm i - # generate swagger and route files for Open API +# download latest binaries +npm run examples:update +# generate swagger and route files for Open API npm run build - # start service in dev mode. In order to start in full - npm start" +# start service in dev mode. In order to start in full - npm start" npm run dev ``` diff --git a/package-lock.json b/package-lock.json index 0b7a08b..9e9f894 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@digicatapult/morello-api", - "version": "0.6.8", + "version": "0.6.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@digicatapult/morello-api", - "version": "0.6.8", + "version": "0.6.9", "license": "Apache-2.0", "dependencies": { "body-parser": "^1.20.0", diff --git a/package.json b/package.json index 6f9edd7..ca1d3f5 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,14 @@ { "name": "@digicatapult/morello-api", - "version": "0.6.8", + "version": "0.6.9", "description": "An interface for executing binaries on it's self and morello host.", "main": "src/index.ts", "scripts": { "lint": "eslint .", "build:tsoa": "tsoa spec-and-routes", "build": "tsoa spec-and-routes && tsc", + "examples:update": "cd bin && wget https://github.com/digicatapult/morello-examples/releases/download/latest/morello-examples.tar.gz && tar -xvf morello-examples.tar.gz && rm morello-examples.tar.gz", + "examples:clean": "rm -rf bin/* bin/.version", "start": "node build/index.js", "depcheck": "depcheck", "dev": "concurrently \"npx tsc --watch\" \"nodemon -q build/index.js | pino-colada\"",