diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..d82ca71 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @intel/Enterprise-RAG-maintain diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/actions/unit-tests/action.yml b/.github/actions/unit-tests/action.yml new file mode 100644 index 0000000..7644702 --- /dev/null +++ b/.github/actions/unit-tests/action.yml @@ -0,0 +1,24 @@ +name: "Unit tests" + +inputs: + test-name: + description: 'Unit test name' + required: true + +runs: + using: 'composite' + steps: + - name: Trigger unit tests + run: | + echo "Attempting to run unit tests" + cd repo/src + sudo tox -e ${{ inputs.test-name }} + exit_code=$? + echo "Unit tests finished" + exit $exit_code + shell: bash + - name: Clean up virtualenv + run: | + cd repo/src + sudo rm -rf .tox/${{ inputs.test-name }} + shell: bash diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000..478725c --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,19 @@ +# Summary +<!--- Provide a short summary of the issue. Sections below provide guidance on what +factors are considered important to reproduce an issue. --> + +## Version +<!--- Report version and githash --> + +# Environment +<!--- Provide details on CPU and Gaudi you are using. Include versions of OS, Habana SW and K8s. --> + +## Steps to reproduce +<!--- Please check that the issue is reproducible with the latest revision on +main. Include all the steps to reproduce the issue. --> + +## Expected Behavior +<!--- Tell us what should happen --> + +## Current Behavior +<!--- Tell us what happens instead of the expected behavior --> diff --git a/.github/license_template.txt b/.github/license_template.txt new file mode 100644 index 0000000..a041037 --- /dev/null +++ b/.github/license_template.txt @@ -0,0 +1,2 @@ +Copyright (C) 2024 Intel Corporation +SPDX-License-Identifier: Apache-2.0 diff --git a/.github/linters/.hadolint.yaml b/.github/linters/.hadolint.yaml new file mode 100644 index 0000000..f74e0ec --- /dev/null +++ b/.github/linters/.hadolint.yaml @@ -0,0 +1,7 @@ +failure-threshold: error +ignored: + - DL3006 + - DL3007 + - DL3008 + - DL3042 + - DL3013 diff --git a/.github/linters/.ruff.toml b/.github/linters/.ruff.toml new file mode 100644 index 0000000..ef31be4 --- /dev/null +++ b/.github/linters/.ruff.toml @@ -0,0 +1,6 @@ +[lint] +# Skip unused variable rules (`F841`). +ignore = ["E402"] + +[lint.per-file-ignores] +"__init__.py" = ["F401"] diff --git a/.github/linters/.shellcheckrc b/.github/linters/.shellcheckrc new file mode 100644 index 0000000..23fce32 --- /dev/null +++ b/.github/linters/.shellcheckrc @@ -0,0 +1,2 @@ +disable=SC2116 +disable=SC2148 diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 0000000..e31bbf7 --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,34 @@ +--- + +extends: default + +ignore: | + deployment/microservices-connector/helm/templates/*.yaml + telemetry/helm/charts/logs/templates/*.yaml + /workspace/telemetry/helm/charts/logs/templates/*.yaml + +rules: + braces: + level: warning + max-spaces-inside: 1 + brackets: + level: warning + max-spaces-inside: 1 + colons: + level: warning + commas: + level: warning + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + level: warning + hyphens: + level: warning + indentation: + level: warning + indent-sequences: consistent + line-length: + level: warning + allow-non-breakable-inline-mappings: true + truthy: disable diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..03d9143 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,20 @@ +## Description + +The summary of the proposed changes as long as the relevant motivation and context. + +## Issues + +Fixes #(github issue). If there is no such issue, please mark it as `n/a`. + +## Type of change + +List the type of change like below. Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds new functionality) +- [ ] Breaking change (fix or feature that would break existing design and interface) +- [ ] Others (enhancement, documentation, validation, etc.) + +## Tests + +Describe the tests that you ran to verify your changes. diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..488f95e --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,36 @@ +name: Linter + +on: + pull_request: + branches: [ main ] + + push: + branches: [ main ] + +jobs: + lint: + if: ${{ (github.event.repository.visibility == 'public') && (github.repository_owner == 'intel') }} + name: Run linter + runs-on: ubuntu-latest + permissions: + contents: read + statuses: write + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Print YAML Lint Config + run: cat .github/linters/.yaml-lint.yml + - name: Super-Linter + uses: super-linter/super-linter/slim@v6.8.0 + env: + VALIDATE_ALL_CODEBASE: false + VALIDATE_BASH: true + BASH_SEVERITY: error + FILTER_REGEX_EXCLUDE: ".*/templates/.*.yaml" + VALIDATE_YAML: true + VALIDATE_PYTHON_RUFF: true + VALIDATE_DOCKERFILE_HADOLINT: true + GITHUB_TOKEN: ${{ github.token }} + DEFAULT_BRANCH: main diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..ff4c3ac --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,86 @@ +name: Unit tests + +on: + pull_request: + branches: [ main ] + +jobs: + unit-tests: + if: ${{ (github.event.repository.visibility == 'public') && (github.repository_owner == 'intel') }} + name: Unit tests + runs-on: ubuntu-latest + defaults: + run: + shell: bash + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Clean up disk space + run: | + sudo rm -rf \ + /usr/local/lib/android \ + /usr/share/dotnet \ + "$AGENT_TOOLSDIRECTORY" + df -h / + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install test prerequisites + run: sudo apt-get update && sudo apt-get -y install libgl1-mesa-glx tox + - name: Checkout code to folder + uses: actions/checkout@v4 + with: + path: repo + - name: Ingestion unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: ingestion_unit_tests + - name: Prompt registry unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: prompt_registry_unit_tests + - name: Retrievers unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: retrievers_unit_tests + - name: Vectorstores unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: vectorstores_unit_tests + - name: Reranks unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: reranks_unit_tests + - name: Embeddings unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: embeddings_unit_tests + - name: Dataprep unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: dataprep_unit_tests + - name: LLMs unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: llms_unit_tests + - name: Guardrails input unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: llm_guard_input_guardrail_unit_tests + - name: Guardrails output unit tests + if: success() || failure() + uses: ./.github/actions/unit-tests + with: + test-name: llm_guard_output_guardrail_unit_tests