Skip to content

Commit 0611707

Browse files
authored
Add hyperlinks picture paths validation. (#800)
Signed-off-by: ZePan110 <ze.pan@intel.com> Signed-off-by: chensuyue <suyue.chen@intel.com>
1 parent b6cce35 commit 0611707

File tree

5 files changed

+145
-56
lines changed

5 files changed

+145
-56
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Check Paths and Hyperlinks
5+
6+
on:
7+
pull_request:
8+
branches: [main]
9+
types: [opened, reopened, ready_for_review, synchronize]
10+
11+
jobs:
12+
check-dockerfile-paths:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Clean Up Working Directory
16+
run: sudo rm -rf ${{github.workspace}}/*
17+
18+
- name: Checkout Repo GenAIExamples
19+
uses: actions/checkout@v4
20+
21+
- name: Clone Repo GenAIComps
22+
run: |
23+
cd ..
24+
git clone https://github.com/opea-project/GenAIComps.git
25+
26+
- name: Check for Missing Dockerfile Paths in GenAIComps
27+
run: |
28+
cd ${{github.workspace}}
29+
miss="FALSE"
30+
while IFS=: read -r file line content; do
31+
dockerfile_path=$(echo "$content" | awk -F '-f ' '{print $2}' | awk '{print $1}')
32+
if [[ ! -f "../GenAIComps/${dockerfile_path}" ]]; then
33+
miss="TRUE"
34+
echo "Missing Dockerfile: GenAIComps/${dockerfile_path} (Referenced in GenAIExamples/${file}:${line})"
35+
fi
36+
done < <(grep -Ern 'docker build .* -f comps/.+/Dockerfile' --include='*.md' .)
37+
38+
39+
if [[ "$miss" == "TRUE" ]]; then
40+
exit 1
41+
fi
42+
43+
shell: bash
44+
45+
check-the-validity-of-hyperlinks-in-README:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Clean Up Working Directory
49+
run: sudo rm -rf ${{github.workspace}}/*
50+
51+
- name: Checkout Repo GenAIExamples
52+
uses: actions/checkout@v4
53+
54+
- name: Check the Validity of Hyperlinks
55+
run: |
56+
cd ${{github.workspace}}
57+
fail="FALSE"
58+
url_lines=$(grep -Eo '\]\(http[s]?://[^)]+\)' --include='*.md' -r .)
59+
if [ -n "$url_lines" ]; then
60+
for url_line in $url_lines; do
61+
url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//')
62+
path=$(echo "$url_line"|cut -d':' -f1 | cut -d'/' -f2-)
63+
response=$(curl -L -s -o /dev/null -w "%{http_code}" "$url")
64+
if [ "$response" -ne 200 ]; then
65+
echo "**********Validation failed, try again**********"
66+
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
67+
if [ "$response_retry" -eq 200 ]; then
68+
echo "*****Retry successfully*****"
69+
else
70+
echo "Invalid link from ${{github.workspace}}/$path: $url"
71+
fail="TRUE"
72+
fi
73+
fi
74+
done
75+
fi
76+
77+
if [[ "$fail" == "TRUE" ]]; then
78+
exit 1
79+
else
80+
echo "All hyperlinks are valid."
81+
fi
82+
shell: bash
83+
84+
check-the-validity-of-relative-path:
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Clean up Working Directory
88+
run: sudo rm -rf ${{github.workspace}}/*
89+
90+
- name: Checkout Repo GenAIExamples
91+
uses: actions/checkout@v4
92+
93+
- name: Checking Relative Path Validity
94+
run: |
95+
cd ${{github.workspace}}
96+
fail="FALSE"
97+
link_head="https://github.com/opea-project/GenAIExamples/blob/main/"
98+
png_lines=$(grep -Eo '\]\([^)]+\)' -r -I .|grep -Ev 'http')
99+
if [ -n "$png_lines" ]; then
100+
for png_line in $png_lines; do
101+
refer_path=$(echo "$png_line"|cut -d':' -f1 | cut -d'/' -f2-)
102+
png_path=$(echo "$png_line"|cut -d '(' -f2 | cut -d ')' -f1)
103+
if [[ "${png_path:0:1}" == "/" ]]; then
104+
check_path=${{github.workspace}}$png_path
105+
else
106+
check_path=${{github.workspace}}/$(dirname "$refer_path")/$png_path
107+
fi
108+
real_path=$(realpath $check_path)
109+
if [ $? -ne 0 ]; then
110+
echo "Path $png_path in file ${{github.workspace}}/$refer_path does not exist"
111+
fail="TRUE"
112+
else
113+
url=$link_head$(echo "$real_path" | sed 's|.*/GenAIExamples/||')
114+
response=$(curl -I -L -s -o /dev/null -w "%{http_code}" "$url")
115+
if [ "$response" -ne 200 ]; then
116+
echo "**********Validation failed, try again**********"
117+
response_retry=$(curl -s -o /dev/null -w "%{http_code}" "$url")
118+
if [ "$response_retry" -eq 200 ]; then
119+
echo "*****Retry successfully*****"
120+
else
121+
echo "Invalid link from $check_path: $url"
122+
fail="TRUE"
123+
fi
124+
fi
125+
fi
126+
done
127+
fi
128+
129+
if [[ "$fail" == "TRUE" ]]; then
130+
exit 1
131+
else
132+
echo "All hyperlinks are valid."
133+
fi
134+
shell: bash

.github/workflows/pr-path_detection.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

ProductivitySuite/docker_compose/intel/cpu/xeon/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build Mega Service of Productivity Suite on Xeon
22

3-
This document outlines the deployment process for OPEA Productivity Suite utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server and [GenAIExamples](https://github.com/opea-project/GenAIExamppes.git) solutions. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. We will publish the Docker images to Docker Hub soon, it will simplify the deployment process for this service.
3+
This document outlines the deployment process for OPEA Productivity Suite utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server and [GenAIExamples](https://github.com/opea-project/GenAIExamples.git) solutions. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. We will publish the Docker images to Docker Hub soon, it will simplify the deployment process for this service.
44

55
## 🚀 Build Docker Images
66

Translation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Translation architecture shows below:
66

77
![architecture](./assets/img/translation_architecture.png)
88

9-
This Translation use case performs Language Translation Inference on Intel Gaudi2 or Intel Xeon Scalable Processors. The Intel Gaudi2 accelerator supports both training and inference for deep learning models in particular for LLMs. Visit [Habana AI products](https://habana.ai/products) for more details.
9+
This Translation use case performs Language Translation Inference on Intel Gaudi2 or Intel Xeon Scalable Processors. The Intel Gaudi2 accelerator supports both training and inference for deep learning models in particular for LLMs. Visit [Habana AI products](https://habana.ai/products/) for more details.
1010

1111
## Deploy Translation Service
1212

0 commit comments

Comments
 (0)