diff --git a/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml b/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml new file mode 100644 index 000000000..ededdba43 --- /dev/null +++ b/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml @@ -0,0 +1,109 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Compose file and dockerfile path checking + +on: + pull_request: + branches: [main] + types: [opened, reopened, ready_for_review, synchronize] + +jobs: + check-dockerfile-paths-in-README: + runs-on: ubuntu-latest + steps: + - name: Clean Up Working Directory + run: sudo rm -rf ${{github.workspace}}/* + + - name: Checkout Repo GenAIExamples + uses: actions/checkout@v4 + + - name: Clone Repo GenAIComps + run: | + cd .. + git clone https://github.com/opea-project/GenAIComps.git + + - name: Check for Missing Dockerfile Paths in GenAIComps + run: | + cd ${{github.workspace}} + miss="FALSE" + while IFS=: read -r file line content; do + dockerfile_path=$(echo "$content" | awk -F '-f ' '{print $2}' | awk '{print $1}') + if [[ ! -f "../GenAIComps/${dockerfile_path}" ]]; then + miss="TRUE" + echo "Missing Dockerfile: GenAIComps/${dockerfile_path} (Referenced in GenAIExamples/${file}:${line})" + fi + done < <(grep -Ern 'docker build .* -f comps/.+/Dockerfile' --include='*.md' .) + + + if [[ "$miss" == "TRUE" ]]; then + exit 1 + fi + + shell: bash + + check-Dockerfile-in-build-yamls: + runs-on: ubuntu-latest + steps: + - name: Clean Up Working Directory + run: sudo rm -rf ${{github.workspace}}/* + + - name: Checkout Repo GenAIExamples + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check Dockerfile path included in image build yaml + if: always() + run: | + set -e + shopt -s globstar + no_add="FALSE" + cd ${{github.workspace}} + Dockerfiles=$(realpath $(find ./ -name '*Dockerfile*')) + if [ -n "$Dockerfiles" ]; then + for dockerfile in $Dockerfiles; do + service=$(echo "$dockerfile" | awk -F '/GenAIExamples/' '{print $2}' | awk -F '/' '{print $2}') + cd ${{github.workspace}}/$service/docker_image_build + all_paths=$(realpath $(awk ' /context:/ { context = $2 } /dockerfile:/ { dockerfile = $2; combined = context "/" dockerfile; gsub(/\/+/, "/", combined); if (index(context, ".") > 0) {print combined}}' build.yaml) 2> /dev/null || true ) + if ! echo "$all_paths" | grep -q "$dockerfile"; then + echo "AR: Update $dockerfile to GenAIExamples/$service/docker_image_build/build.yaml. The yaml is used for release images build." + no_add="TRUE" + fi + done + fi + + if [[ "$no_add" == "TRUE" ]]; then + exit 1 + fi + + check-image-and-service-names-in-build-yaml: + runs-on: ubuntu-latest + steps: + - name: Clean Up Working Directory + run: sudo rm -rf ${{github.workspace}}/* + + - name: Checkout Repo GenAIExamples + uses: actions/checkout@v4 + + - name: Check name agreement in build.yaml + run: | + pip install ruamel.yaml + cd ${{github.workspace}} + consistency="TRUE" + build_yamls=$(find . -name 'build.yaml') + for build_yaml in $build_yamls; do + message=$(python3 .github/workflows/scripts/check-name-agreement.py "$build_yaml") + if [[ "$message" != *"consistent"* ]]; then + consistency="FALSE" + echo "Inconsistent service name and image name found in file $build_yaml." + echo "$message" + fi + done + + if [[ "$consistency" == "FALSE" ]]; then + echo "Please ensure that the service and image names are consistent in build.yaml, otherwise we cannot guarantee that your image will be published correctly." + exit 1 + fi + + shell: bash diff --git a/.github/workflows/pr-path-detection.yml b/.github/workflows/pr-link-path-scan.yml similarity index 83% rename from .github/workflows/pr-path-detection.yml rename to .github/workflows/pr-link-path-scan.yml index c314bd614..77bf0d293 100644 --- a/.github/workflows/pr-path-detection.yml +++ b/.github/workflows/pr-link-path-scan.yml @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -name: Check Paths and Hyperlinks +name: Check hyperlinks and relative path validity on: pull_request: @@ -9,39 +9,6 @@ on: types: [opened, reopened, ready_for_review, synchronize] jobs: - check-dockerfile-paths: - runs-on: ubuntu-latest - steps: - - name: Clean Up Working Directory - run: sudo rm -rf ${{github.workspace}}/* - - - name: Checkout Repo GenAIExamples - uses: actions/checkout@v4 - - - name: Clone Repo GenAIComps - run: | - cd .. - git clone https://github.com/opea-project/GenAIComps.git - - - name: Check for Missing Dockerfile Paths in GenAIComps - run: | - cd ${{github.workspace}} - miss="FALSE" - while IFS=: read -r file line content; do - dockerfile_path=$(echo "$content" | awk -F '-f ' '{print $2}' | awk '{print $1}') - if [[ ! -f "../GenAIComps/${dockerfile_path}" ]]; then - miss="TRUE" - echo "Missing Dockerfile: GenAIComps/${dockerfile_path} (Referenced in GenAIExamples/${file}:${line})" - fi - done < <(grep -Ern 'docker build .* -f comps/.+/Dockerfile' --include='*.md' .) - - - if [[ "$miss" == "TRUE" ]]; then - exit 1 - fi - - shell: bash - check-the-validity-of-hyperlinks-in-README: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/scripts/check-name-agreement.py b/.github/workflows/scripts/check-name-agreement.py new file mode 100644 index 000000000..d588a81d9 --- /dev/null +++ b/.github/workflows/scripts/check-name-agreement.py @@ -0,0 +1,46 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import argparse + +from ruamel.yaml import YAML + + +def parse_yaml_file(file_path): + yaml = YAML() + with open(file_path, "r") as file: + data = yaml.load(file) + return data + + +def check_service_image_consistency(data): + inconsistencies = [] + for service_name, service_details in data.get("services", {}).items(): + image_name = service_details.get("image", "") + # Extract the image name part after the last '/' + image_name_part = image_name.split("/")[-1].split(":")[0] + # Check if the service name is a substring of the image name part + if service_name not in image_name_part: + # Get the line number of the service name + line_number = service_details.lc.line + 1 + inconsistencies.append((service_name, image_name, line_number)) + return inconsistencies + + +def main(): + parser = argparse.ArgumentParser(description="Check service name and image name consistency in a YAML file.") + parser.add_argument("file_path", type=str, help="The path to the YAML file.") + args = parser.parse_args() + + data = parse_yaml_file(args.file_path) + + inconsistencies = check_service_image_consistency(data) + if inconsistencies: + for service_name, image_name, line_number in inconsistencies: + print(f"Service name: {service_name}, Image name: {image_name}, Line number: {line_number}") + else: + print("All consistent") + + +if __name__ == "__main__": + main() diff --git a/AudioQnA/docker_image_build/build.yaml b/AudioQnA/docker_image_build/build.yaml index 98ec0ccaa..d030d78d0 100644 --- a/AudioQnA/docker_image_build/build.yaml +++ b/AudioQnA/docker_image_build/build.yaml @@ -11,6 +11,18 @@ services: context: ../ dockerfile: ./Dockerfile image: ${REGISTRY:-opea}/audioqna:${TAG:-latest} + audioqna-ui: + build: + context: ../ui + dockerfile: ./docker/Dockerfile + extends: audioqna + image: ${REGISTRY:-opea}/audioqna-ui:${TAG:-latest} + audioqna-multilang: + build: + context: ../ + dockerfile: ./Dockerfile.multilang + extends: audioqna + image: ${REGISTRY:-opea}/audioqna-multilang:${TAG:-latest} whisper-gaudi: build: context: GenAIComps diff --git a/GraphRAG/docker_image_build/build.yaml b/GraphRAG/docker_image_build/build.yaml index 16f6da848..b6ecb5153 100644 --- a/GraphRAG/docker_image_build/build.yaml +++ b/GraphRAG/docker_image_build/build.yaml @@ -47,3 +47,12 @@ services: context: ../ui dockerfile: ./docker/Dockerfile image: ${REGISTRY:-opea}/graphrag-ui:${TAG:-latest} + graphrag-react-ui: + build: + args: + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + no_proxy: ${no_proxy} + context: ../ui + dockerfile: ./docker/Dockerfile.react + image: ${REGISTRY:-opea}/graphrag-react-ui:${TAG:-latest} diff --git a/Text2Image/docker_image_build/build.yaml b/Text2Image/docker_image_build/build.yaml index 9dcca90aa..30691ce0b 100644 --- a/Text2Image/docker_image_build/build.yaml +++ b/Text2Image/docker_image_build/build.yaml @@ -11,3 +11,8 @@ services: context: GenAIComps dockerfile: comps/text2image/Dockerfile image: ${REGISTRY:-opea}/text2image:${TAG:-latest} + text2image-ui: + build: + context: ../ui + dockerfile: ./docker/Dockerfile + image: ${REGISTRY:-opea}/text2image-ui:${TAG:-latest} diff --git a/Text2Image/ui/svelte/package.json b/Text2Image/ui/svelte/package.json index 158764a9b..e2a39a2c4 100644 --- a/Text2Image/ui/svelte/package.json +++ b/Text2Image/ui/svelte/package.json @@ -13,10 +13,9 @@ }, "devDependencies": { "@fortawesome/free-solid-svg-icons": "6.2.0", - "@playwright/test": "^1.48.0", + "@playwright/test": "^1.33.0", "@sveltejs/adapter-auto": "1.0.0-next.75", - "@sveltejs/adapter-static": "^3.0.0", - "@sveltejs/kit": "^2.0.0", + "@sveltejs/kit": "^1.30.4", "@tailwindcss/typography": "0.5.7", "@types/debug": "4.1.7", "@types/node": "^20.12.13", @@ -29,20 +28,21 @@ "eslint": "^8.16.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-neverthrow": "1.1.4", + "eslint-plugin-svelte3": "^4.0.0", "postcss": "^8.4.31", "postcss-load-config": "^4.0.1", "postcss-preset-env": "^8.3.2", "prettier": "^2.8.8", "prettier-plugin-svelte": "^2.7.0", "prettier-plugin-tailwindcss": "^0.3.0", - "svelte": "^4.0.0", - "svelte-check": "^3.0.0", + "svelte": "^3.59.1", + "svelte-check": "^2.7.1", "svelte-fa": "3.0.3", - "svelte-preprocess": "^6.0.2", + "svelte-preprocess": "^4.10.7", "tailwindcss": "^3.1.5", "tslib": "^2.3.1", - "typescript": "^5.0.0", - "vite": "^5.0.0" + "typescript": "^4.7.4", + "vite": "^4.5.2" }, "type": "module", "dependencies": {