From 1080888b60360c1c15072088b42ea0a19cd00b8f Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Nov 2024 12:47:32 +0200 Subject: [PATCH] Added pipeline (#436) * Added pipeline * Changed the path to the files --- .github/workflows/ci-integration-tests.yml | 45 +++++++++++++ .github/workflows/siemj.conf | 73 ++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 .github/workflows/ci-integration-tests.yml create mode 100644 .github/workflows/siemj.conf diff --git a/.github/workflows/ci-integration-tests.yml b/.github/workflows/ci-integration-tests.yml new file mode 100644 index 00000000..fe820a23 --- /dev/null +++ b/.github/workflows/ci-integration-tests.yml @@ -0,0 +1,45 @@ +name: Integration tests + +on: + push: + paths: + - 'common/**' + - 'packages/**' + pull_request: + branches: + - master + paths: + - 'common/**' + - 'packages/**' + +jobs: + integration_tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Update package list and install dependencies + run: | + sudo apt-get update + sudo apt-get install -y wget tar + + - name: Download xp-kbt archive + run: | + KBT_VERSION="27.0.78" + KBT_URL="https://github.com/vxcontrol/xp-kbt/releases/download/${KBT_VERSION}/kbt.${KBT_VERSION}-linux.tar.gz" + wget $KBT_URL -O /home/runner/xp-kbt.tar.gz + + - name: Extract xp-kbt archive + run: | + mkdir -p /home/runner/xp-kbt + tar -xzvf /home/runner/xp-kbt.tar.gz -C /home/runner/xp-kbt + + - name: Create required directories + run: | + mkdir -p /home/runner/temp/eXtractionAndProcessing/output/packages + + - name: Run tests + run: | + /home/runner/xp-kbt/extra-tools/siemj/siemj -c .github/workflows/siemj.conf main \ No newline at end of file diff --git a/.github/workflows/siemj.conf b/.github/workflows/siemj.conf new file mode 100644 index 00000000..418b7631 --- /dev/null +++ b/.github/workflows/siemj.conf @@ -0,0 +1,73 @@ +[DEFAULT] +# Базовый путь к SDK и инструментам +xp_kbt_base=/home/runner/xp-kbt +ptsiem_sdk=${xp_kbt_base}/xp-sdk +build_tools=${xp_kbt_base}/build-tools +taxonomy=${xp_kbt_base}/knowledgebase/contracts/taxonomy/taxonomy.json + +# Общие пути для рабочего пространства +GITHUB_WORKSPACE=/home/runner/work/open-xp-rules/open-xp-rules +output_folder=/home/runner/temp/eXtractionAndProcessing/output/packages +temp=/home/runner/xp-kbt/temp/eXtractionAndProcessing/output + +# Графы +[make-nfgraph] +type=BUILD_RULES +rcc_lang=n +rules_src=${GITHUB_WORKSPACE}/packages +xp_appendix=${xp_kbt_base}/knowledgebase/contracts/xp_appendix/appendix.xp +out=${output_folder}/formulas_graph.json + +[make-argraph] +type=BUILD_RULES +rcc_lang=a +rules_src=${GITHUB_WORKSPACE}/packages +out=${output_folder}/aggfilters.json + +[make-tables-schema] +type=BUILD_TABLES_SCHEMA +table_list_schema_src=${GITHUB_WORKSPACE}/packages +contract=${xp_kbt_base}/knowledgebase/contracts/tabular_lists/tables_contract.yaml +out=${output_folder} + +[make-tables-db] +type=BUILD_TABLES_DATABASE +table_list_filltype=All +table_list_schema=${output_folder}/schema.json +table_list_defaults=${output_folder}/correlation_defaults.json +out=${output_folder}/fpta_db.db + +[make-ergraph] +type=BUILD_RULES +rcc_lang=e +rules_src=${GITHUB_WORKSPACE}/packages +rfilters_src=${GITHUB_WORKSPACE}/common/rules_filters +table_list_schema=${output_folder}/schema.json +out=${output_folder}/enrules_graph.json + +[make-crgraph] +type=BUILD_RULES +rcc_lang=c +rules_src=${GITHUB_WORKSPACE}/packages +rfilters_src=${GITHUB_WORKSPACE}/common/rules_filters +table_list_schema=${output_folder}/schema.json +out=${output_folder}/corrules_graph.json + +# Тестирование правил +[rules-tests] +type=TEST_RULES +cr_timeout=250 +keep_temp_files=no +without_sdk_logs=yes +formulas=${output_folder}/formulas_graph.json +enrules=${output_folder}/enrules_graph.json +corrules=${output_folder}/corrules_graph.json +aggrules=${output_folder}/aggfilters.json +table_list_defaults=${output_folder}/correlation_defaults.json +rules_src=${GITHUB_WORKSPACE}/packages +temp=/home/runner/xp-kbt/temp/eXtractionAndProcessing/output + +# Основной сценарий +[main] +type=SCENARIO +scenario=make-nfgraph make-argraph make-tables-schema make-tables-db make-ergraph make-crgraph rules-tests \ No newline at end of file