1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-15 03:43:53 +02:00

CI: enhance package detection logic

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
(cherry picked from commit a2b08b5cbf)
This commit is contained in:
Ilya Lipnitskiy 2021-02-23 21:06:21 -08:00 committed by Josef Schlehofer
parent 5b0c55ecb4
commit b9ff010dca
No known key found for this signature in database
GPG Key ID: B950216FE4329F4C

View File

@ -34,10 +34,18 @@ jobs:
- name: Determine changed packages
run: |
# only detect packages with changed Makefiles
PACKAGES="$(git diff --diff-filter=d --name-only origin/master \
| grep -E 'Makefile$|test.sh$' | grep -Ev '/files/|/src/' \
| awk -F/ '{ print $(NF-1) }' | tr '\n' ' ')"
# only detect packages with changes
PKG_ROOTS=$(find . -name Makefile | grep -v ".*/src/Makefile" | sed -e 's@./\(.*\)/Makefile@\1/@')
CHANGES=$(git diff --diff-filter=d --name-only origin/master)
for ROOT in $PKG_ROOTS; do
for CHANGE in $CHANGES; do
if [[ "$CHANGE" == "$ROOT"* ]]; then
PACKAGES+=$(echo "$ROOT" | sed -e 's@.*/\(.*\)/@\1 @')
break
fi
done
done
# fallback to test packages if nothing explicitly changes this is
# should run if other mechanics in packages.git changed