Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Digital Twin Runner utility #110

Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .git-hooks/pre-commit
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
13 changes: 12 additions & 1 deletion .git-hooks/pre-push
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
54 changes: 54 additions & 0 deletions .github/workflows/runner.yml
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# NPM registry configuration
.yarnrc
.npmrc

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down Expand Up @@ -139,6 +143,7 @@ site/
*.sublime-workspace

# IDE - VSCode
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
2 changes: 1 addition & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
playwright/.auth/
playwright/.auth/
6 changes: 6 additions & 0 deletions servers/execution/runner/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
api/
build/
dist/
node_modules/
script/
src/types.ts
53 changes: 53 additions & 0 deletions servers/execution/runner/.eslintrc
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"]
}
]
}
7 changes: 7 additions & 0 deletions servers/execution/runner/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src
test
jest.config.json
tsconfig.json
.eslintignore
.eslintrc
.env
4 changes: 4 additions & 0 deletions servers/execution/runner/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
Loading