Skip to content

Commit

Permalink
Merge pull request #850 from modelix/MODELIX-594-extend-JS-API
Browse files Browse the repository at this point in the history
feat(model-client): extend JS API
  • Loading branch information
Oleksandr Dzhychko authored Jun 27, 2024
2 parents cc31abe + 1b4dc8d commit c0df4d6
Show file tree
Hide file tree
Showing 29 changed files with 4,531 additions and 56 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ updates:
commit-message:
prefix: "build(deps)"
prefix-development: "build(deps)"
- package-ecosystem: "npm"
open-pull-requests-limit: 20
directory: "/model-client-js-test/model-client-connection"
schedule:
interval: "daily"
commit-message:
prefix: "build(deps)"
prefix-development: "build(deps)"
20 changes: 20 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: model-api-gen-gradle-test/ci.sh

test-model-client-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Assemble
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew --build-cache assemble publishToMavenLocal -PciBuild=true
- name: Test Model Client JS API
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: model-client-js-test/ci.sh

test-bulk-model-sync-gradle:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
rev: v3.0.3
hooks:
- id: prettier
files: ^(vue-model-api)|(model-api-gen-gradle-test/vue-integration)/
files: ^(vue-model-api)|(model-api-gen-gradle-test/vue-integration)|(model-client-js-test/model-client-connection)/
- repo: https://github.com/pre-commit/mirrors-eslint
# IMPORTANT: keep versions of hook and additional dependencies in sync with the versions configured in `vue-model-api/package.json`
rev: v8.56.0
Expand Down
4 changes: 4 additions & 0 deletions model-client-js-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/build/
**/dist/
**/node_modules/
**/typescript_src/
16 changes: 16 additions & 0 deletions model-client-js-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import com.github.gradle.node.NodeExtension
import com.github.gradle.node.NodePlugin

plugins {
base
alias(libs.plugins.node) apply false
}

subprojects {
plugins.withType<NodePlugin> {
project.extensions.configure<NodeExtension> {
version.set(libs.versions.node)
download.set(true)
}
}
}
20 changes: 20 additions & 0 deletions model-client-js-test/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -e
(
TEST_DIR="$(dirname "$(readlink -f "$0")")"
cd "$TEST_DIR/../"
if [ "${CI}" != "true" ]; then
trap cleanup INT TERM EXIT
cleanup () {
kill "${MODEL_SERVER_PID}"
exit
}
fi
./gradlew :model-server:run --console=plain --args="-inmemory -port 28103" &
MODEL_SERVER_PID=$!

curl -X GET --retry 30 --retry-connrefused --retry-delay 1 http://localhost:28103/health
cd "$TEST_DIR"
./gradlew build --console=plain --stacktrace
)
2 changes: 2 additions & 0 deletions model-client-js-test/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.parallel=true
kotlin.daemon.jvmargs=-Xmx3g
1 change: 1 addition & 0 deletions model-client-js-test/gradle/wrapper/gradle-wrapper.jar
1 change: 1 addition & 0 deletions model-client-js-test/gradlew
1 change: 1 addition & 0 deletions model-client-js-test/gradlew.bat
2 changes: 2 additions & 0 deletions model-client-js-test/replicated-model-test/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle
build
Empty file.
23 changes: 23 additions & 0 deletions model-client-js-test/replicated-model-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import com.github.gradle.node.npm.task.NpmTask

plugins {
base
alias(libs.plugins.node)
}

val updateDependencies = tasks.register<NpmTask>("updateDependencies") {
args.set(
listOf(
"install",
"../../model-client/build/npmDevPackage/model-client.tgz",
),
)
}

tasks.npmInstall {
dependsOn(updateDependencies)
}

tasks.check {
dependsOn("npm_run_test")
}
5 changes: 5 additions & 0 deletions model-client-js-test/replicated-model-test/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};
Loading

0 comments on commit c0df4d6

Please sign in to comment.