45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
# Copyright (C) 2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
name: Check for missing Dockerfile paths in repo comps
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
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
|