-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Digital Twin Runner utility (#110)
- Adds a runner to manage digital twins. One instance of runner manages one digital twin. - Adds Lifecycle manager to support digital twin lifecycle phases. The lifecycle manager invokes a phase upon request and runs the same asynchronously.⚠️ At the moment, only Linux system commands have been tested. - Creates npm package of the runner. Also the README contains instructions on setting up private npm repository for development purposes. - 🥂 Adds OpenAPI specification for DT Runner - Updates git-hooks to check against runner as well. --------- Co-authored-by: nichlaes <[email protected]>
- Loading branch information
1 parent
f4ef67f
commit 6e6b9f5
Showing
37 changed files
with
7,469 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
#!/usr/bin/env sh | ||
|
||
TOP_DIR="$(pwd)" | ||
export TOP_DIR | ||
|
||
if git diff --cached --name-only | grep "^client/" >/dev/null; then | ||
cd client || exit | ||
yarn install | ||
yarn format && yarn syntax | ||
else | ||
printf "No changes in the client directory. Skipping pre-commit hook." | ||
printf "No changes in the client directory. Skipping pre-commit hook.\n\n" | ||
fi | ||
|
||
cd "$TOP_DIR" || exit | ||
if git diff --cached --name-only | grep "^servers/execution/runner/" >/dev/null; then | ||
cd "servers/execution/runner" || exit | ||
yarn install | ||
yarn format && yarn syntax | ||
else | ||
printf "No changes in the servers/execution/runner directory. Skipping pre-commit hook.\n\n" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | ||
TOP_DIR="$(pwd)" | ||
export TOP_DIR | ||
|
||
if git diff --name-only origin/"$BRANCH_NAME"...HEAD | grep "^client/" >/dev/null; then | ||
cd client || exit | ||
yarn install | ||
yarn jest . --coverage=false | ||
else | ||
echo "No changes in the client directory. Skipping pre-push hook." | ||
printf "No changes in the client directory. Skipping pre-push hook.\n\n" | ||
fi | ||
|
||
cd "$TOP_DIR" || exit | ||
if git diff --name-only origin/"$BRANCH_NAME"...HEAD | grep "^servers/execution/runner/" >/dev/null; then | ||
cd "servers/execution/runner" || exit | ||
yarn install | ||
yarn test:nocov | ||
else | ||
printf "No changes in the servers/execution/runner/ directory. Skipping pre-push hook.\n\n" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Digital twin runner | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'servers/execution/**' | ||
pull_request: | ||
paths: | ||
- 'servers/execution/**' | ||
workflow_dispatch: | ||
paths: | ||
- 'servers/execution/**' | ||
|
||
jobs: | ||
test-runner: | ||
name: Test digital twin runner | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
cache-dependency-path: "**/yarn.lock" | ||
|
||
- name: Run linting checks on runner | ||
run: | | ||
cd servers/execution/runner | ||
yarn install | ||
yarn syntax | ||
- name: Build the runner | ||
if: success() || failure() | ||
run: | | ||
cd servers/execution/runner | ||
yarn install | ||
yarn build | ||
- name: Run tests | ||
if: success() || failure() | ||
run: | | ||
cd servers/execution/runner | ||
yarn install | ||
yarn test | ||
- name: Upload test coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: servers/execution/runner/coverage/clover.xml | ||
flags: dt-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
playwright/.auth/ | ||
playwright/.auth/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
api/ | ||
build/ | ||
dist/ | ||
node_modules/ | ||
script/ | ||
src/types.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"env": { | ||
"jest": true, | ||
//"jest/globals": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"airbnb-base", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js"] | ||
} | ||
} | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"requireConfigFile": false, | ||
"ecmaVersion": 2022, | ||
"sourceType": "module" // Allows for the use of imports | ||
}, | ||
"plugins": ["jest", "@typescript-eslint", "import"], | ||
"rules": { | ||
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }], | ||
"no-console": "error", | ||
"import/first": "error", | ||
"linebreak-style": 0, // disable linter linebreak rule, to allow for both unix and windows developement | ||
"import/no-unresolved": "off", // Whatever IDE will pass an error if if the module is not found, so no reason for this.. | ||
"import/extensions": "off", // That includes the production build.. We use linter for code checking / clean code optimization.. | ||
"no-use-before-define": "off" | ||
}, | ||
"root": true, | ||
|
||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"requireConfigFile": false, | ||
"project": ["./tsconfig.json"] | ||
}, | ||
"plugins": ["@typescript-eslint"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
src | ||
test | ||
jest.config.json | ||
tsconfig.json | ||
.eslintignore | ||
.eslintrc | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
Oops, something went wrong.