Skip to content

Commit

Permalink
Merge pull request #95 from ostis-ai/feature/component_manager
Browse files Browse the repository at this point in the history
Add sc-component manager
  • Loading branch information
MksmOrlov authored Feb 5, 2024
2 parents b953fc1 + d1502f6 commit 333cdea
Show file tree
Hide file tree
Showing 22 changed files with 330 additions and 53 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/install_with_component_manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
branches: [ develop, main, release/** ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
name: Install with component manager on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-latest]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Update
if: startswith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
- name: Restore build caches
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Installing platform
env:
TERM: linux
run: |
cd scripts
./set_vars.sh
./install_platform_with_component_manager.sh
./run_sc_component_manager.sh
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "docs/scn"]
path = docs/scn
url = https://github.com/ostis-ai/scn-latex-plugin
[submodule "ims.ostis.kb"]
path = ims.ostis.kb
url = https://github.com/ostis-ai/ims.ostis.kb
branch = main
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ To learn more about the platform, check out our [documentation](https://github.c
</details>
- Natively (using sc-component-manager)
```sh
git clone https://github.com/ostis-ai/ostis-web-platform
cd ostis-web-platform/scripts
./install_platform_with_component_manager.sh
./run_sc_component_manager.sh
```
- Natively
Note: Currently, only Linux (Ubuntu-20.04, Ubuntu-22.04) and macOS are supported by this installation method. If you're going to use it, it might take a while to download dependencies and compile the components. Use it only if you know what you're doing!
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Add sc-component-manager

## [0.9.0-Unlock] - 22.01.2024

### Changes
Expand Down
1 change: 0 additions & 1 deletion ims.ostis.kb
Submodule ims.ostis.kb deleted from b4fd1e
46 changes: 46 additions & 0 deletions kb/ostis-web-platform-components-specification.scs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ostis_web_platform_repository
<- concept_repository;
-> rrel_components_specifications: ..components_addresses;;

..components_addresses
<- sc_node_tuple;
-> knowledge_base_ims_specification
(*
<- concept_reusable_component_specification;;
=> nrel_alternative_addresses:
...
(*
<- sc_node_tuple;;
<- singletone;;
-> rrel_1:
...
(*
-> [https://github.com/ostis-ai/ims.ostis.kb]
(*
<- concept_github_url;;
*);;
*);;
*);;
*);
-> sc_web_specification
(*
<- concept_reusable_component_specification;;
=> nrel_alternative_addresses:
...
(*
<- sc_node_tuple;;
<- singletone;;
-> rrel_1:
...
(*
-> [https://github.com/ostis-ai/sc-web]
(*
<- concept_github_url;;
*);;
*);;
*);;
*);;

concept_need_to_install_components
-> knowledge_base_ims;
-> sc_web;;
5 changes: 5 additions & 0 deletions ostis-web-platform.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ log_level = Info
log_file = sc-machine/scripts/sc_builder.log

input_path = repo.path

[sc-component-manager]
knowledge_base_components_path = kb
problem_solver_components_path = problem-solver
interface_components_path = interface
7 changes: 5 additions & 2 deletions repo.path
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# common
ims.ostis.kb
# ostis-web-platform
kb

# component manager
sc-component-manager/kb
12 changes: 12 additions & 0 deletions scripts/build_sc_component_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail

if [ -z "${SC_COMPONENT_MANAGER_PATH}" ];
then
source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/../sc-component-manager/scripts/set_vars.sh
fi

# Need to define this variables to execute build_sc_component_manager.sh
export ROOT_CMAKE_PATH="${SC_COMPONENT_MANAGER_PATH}"
export BUILD_PATH="${SC_COMPONENT_MANAGER_PATH}/build"
"${SC_COMPONENT_MANAGER_PATH}/scripts/build_sc_component_manager.sh" "$@"
2 changes: 2 additions & 0 deletions scripts/build_sc_machine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ then
source "$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"/set_vars.sh
fi

export ROOT_CMAKE_PATH="${SC_MACHINE_PATH}"
export BUILD_PATH="${SC_MACHINE_PATH}/build"
"${SC_MACHINE_PATH}/scripts/build_sc_machine.sh" "$@"
54 changes: 54 additions & 0 deletions scripts/clone_update_submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

clone_update_submodule()
{
UPDATE=false
while [[ $# -gt 0 ]]; do
case "$1" in
--repo)
shift 1
REPO="$1"
;;
--path)
shift 1
SUBMODULE_PATH="$1"
;;
--branch)
shift 1
BRANCH="$1"
;;
--update)
shift 1
UPDATE=true
;;
--commit)
shift 1
COMMIT="$1"
;;
esac
shift 1
done

if [ -z "$SUBMODULE_PATH" ];
then
printf "Empty paths are dangerous in use. Use another path instead for submodules installation or update.\n"
exit 1
fi
if [[ ! -d "$SUBMODULE_PATH" || "$UPDATE" ]]; then
if "$UPDATE";
then
printf "Remove submodule %s (%s) %s \n" "$REPO" "$BRANCH" "$SUBMODULE_PATH"
rm -rf "$SUBMODULE_PATH"
git pull
fi

printf "Clone submodule %s (%s) into %s\n" "$REPO" "$BRANCH" "$SUBMODULE_PATH"
git clone "$REPO" --branch "$BRANCH" --single-branch "$SUBMODULE_PATH" --recursive
if [ -n "$COMMIT" ];
then
cd "$SUBMODULE_PATH" && git checkout "$COMMIT"
fi
else
printf "You can update %s manually. Use this script with \"update\" parameter.\n" "$SUBMODULE_PATH"
fi
}
4 changes: 2 additions & 2 deletions scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ while [ "$1" != "" ]; do
shift 1 # remove the current value for `$1` and use the next
done

"${SC_MACHINE_PATH}/scripts/install_dependencies.sh" "${args[@]}"
"${SC_WEB_PATH}/scripts/install_dependencies.sh"
"${PLATFORM_PATH}/scripts/install_sc_machine_dependencies.sh" "${args[@]}"
"${PLATFORM_PATH}/scripts/install_sc_web_dependencies.sh" "${args[@]}"

stage "Dependencies installed successfully"
15 changes: 15 additions & 0 deletions scripts/install_ims_kb_submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
source "${CURRENT_DIR}/clone_update_submodule.sh"

if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_REPO}" || -z "${SC_MACHINE_BRANCH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

cd "${PLATFORM_PATH}"

clone_update_submodule --repo "${IMS_KB_REPO}" --path "${IMS_KB_PATH}" --branch "${IMS_KB_BRANCH}" --commit "${IMS_KB_COMMIT}" "$@"
21 changes: 21 additions & 0 deletions scripts/install_platform_with_component_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"

if [ -z "${SC_MACHINE_PATH}" ];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

stage "Install ostis-web-platform"

"${PLATFORM_PATH}/scripts/install_sc_machine_submodule.sh"
"${PLATFORM_PATH}/scripts/install_sc_machine_dependencies.sh" --dev
"${PLATFORM_PATH}/scripts/install_sc_component_manager_submodule.sh"
"${PLATFORM_PATH}/scripts/build_sc_machine.sh"
"${PLATFORM_PATH}/scripts/build_sc_component_manager.sh"
"${PLATFORM_PATH}/scripts/build_kb.sh"

stage "OSTIS-web-platform installed successfully"
15 changes: 15 additions & 0 deletions scripts/install_sc_component_manager_submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
source "${CURRENT_DIR}/clone_update_submodule.sh"

if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_REPO}" || -z "${SC_MACHINE_BRANCH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

cd "${PLATFORM_PATH}"

clone_update_submodule --repo "${SC_COMPONENT_MANAGER_REPO}" --path "${SC_COMPONENT_MANAGER_PATH}" --branch "${SC_COMPONENT_MANAGER_BRANCH}" --commit "${SC_COMPONENT_MANAGER_COMMIT}" "$@"
16 changes: 16 additions & 0 deletions scripts/install_sc_machine_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"

if [ -z "${SC_MACHINE_PATH}" ];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

stage "Install sc-machine dependencies"

"${SC_MACHINE_PATH}/scripts/install_dependencies.sh" "$@"

stage "Dependencies of sc-machine installed successfully"
15 changes: 15 additions & 0 deletions scripts/install_sc_machine_submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
source "${CURRENT_DIR}/clone_update_submodule.sh"

if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_REPO}" || -z "${SC_MACHINE_BRANCH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

cd "${PLATFORM_PATH}"

clone_update_submodule --repo "${SC_MACHINE_REPO}" --path "${SC_MACHINE_PATH}" --branch "${SC_MACHINE_BRANCH}" --commit "${SC_MACHINE_COMMIT}" "$@"
16 changes: 16 additions & 0 deletions scripts/install_sc_web_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"

if [ -z "${SC_WEB_PATH}" ];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

stage "Install sc-web dependencies"

"${SC_WEB_PATH}/scripts/install_dependencies.sh" "$@"

stage "Dependencies of sc-web installed successfully"
15 changes: 15 additions & 0 deletions scripts/install_sc_web_submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail

CURRENT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
source "${CURRENT_DIR}/formats.sh"
source "${CURRENT_DIR}/clone_update_submodule.sh"

if [[ -z "${PLATFORM_PATH}" || -z "${SC_MACHINE_REPO}" || -z "${SC_MACHINE_BRANCH}" ]];
then
source "${CURRENT_DIR}/set_vars.sh"
fi

cd "${PLATFORM_PATH}"

clone_update_submodule --repo "${SC_WEB_REPO}" --path "${SC_WEB_PATH}" --branch "${SC_WEB_BRANCH}" --commit "${SC_WEB_COMMIT}" "$@"
Loading

0 comments on commit 333cdea

Please sign in to comment.