diff --git a/.github/actions/prepare.sh b/.github/actions/prepare.sh index 8e940a041f8..97250593186 100755 --- a/.github/actions/prepare.sh +++ b/.github/actions/prepare.sh @@ -5,9 +5,10 @@ # Evaluate packages to build and referenced source files to download. # # Functions: -# - Evaluate all packages to build depending on files defined in ${GH_FILES}. +# - Build all packages defined by ${USER_SPK_TO_BUILD} and ${GH_SPK_PACKAGES} +# - Evaluate additional packages to build depending on changed folders defined in ${GH_DEPENDENT_PACKAGES}. # - synocli-videodriver is moved to head of packages to build first if triggered by its ffmpeg5-7 -# - python310-311 and ffmpeg5-7 are moved to head of remaining packages to build when triggered by its own or a dependent. +# - python310-313 and ffmpeg5-7 are moved to head of remaining packages to build when triggered by its own or a dependent. # - Referenced native and cross packages of the packages to build are added to the download list. set -o pipefail @@ -18,12 +19,8 @@ echo "::group:: ---- find dependent packages" make setup-synocommunity DEFAULT_TC=$(grep DEFAULT_TC local.mk | cut -f2 -d= | xargs) -# filter for changes made in the spk directories and take unique package name (without spk folder) -SPK_TO_BUILD+=" " -SPK_TO_BUILD+=$(echo "${GH_FILES}" | tr ' ' '\n' | grep -oP "^spk/\K[^\/]*" | sort -u | tr '\n' ' ') - -# filter for changes made in the cross and native directories and take unique package name (including cross or native folder) -DEPENDENT_PACKAGES=$(echo "${GH_FILES}" | tr ' ' '\n' | grep -oP "(cross|native)/[^\/]*" | sort -u | tr '\n' ' ') +# all packages to build from changes or manual definition +SPK_TO_BUILD="${USER_SPK_TO_BUILD} ${GH_SPK_PACKAGES}" # get dependency list # dependencies in this list include the cross or native folder (i.e. native/python cross/glib) @@ -37,7 +34,7 @@ do done # search for dependent spk packages -for package in ${DEPENDENT_PACKAGES} +for package in ${GH_DEPENDENT_PACKAGES} do echo "===> Searching for dependent package: ${package}" packages=$(echo "${DEPENDENCY_LIST}" | grep " ${package} " | grep -o ".*:" | tr ':' ' ' | sort -u | tr '\n' ' ') @@ -86,8 +83,8 @@ do fi done -# for python (310, 311) find all packages that depend on them -for py in python310 python311; do +# for python (310, 311, 313) find all packages that depend on them +for py in python310 python311 python313; do python_dependent_packages=$(find spk/ -maxdepth 2 -mindepth 2 -name "Makefile" -exec grep -Ho "PYTHON_PACKAGE = ${py}" {} \; | grep -Po ".*spk/\K[^/]*" | sort | tr '\n' ' ') # If packages contain a package that depends on python (or is python), then ensure diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f393f7ff44..1fd45e5224d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,26 +97,31 @@ jobs: fetch-depth: 0 persist-credentials: false - - name: Get changed files for pull request + - name: Get changed spk_packages and dependency_folders for pull request if: github.event_name == 'pull_request' - id: getfile_pr + id: getchanges_pr run: | - git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs - echo "files=$(git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs)" >> $GITHUB_OUTPUT + git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | grep -oP "^spk/\K[^\/]*" | sort -u | xargs + echo "spk_packages=$(git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | grep -oP "^spk/\K[^\/]*" | sort -u | xargs)" >> $GITHUB_OUTPUT + git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | grep -oP "(cross|native)/[^\/]*" | sort -u | xargs + echo "dependency_folders=$(git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | grep -oP "(cross|native)/[^\/]*" | sort -u | xargs)" >> $GITHUB_OUTPUT - - name: Get changed files for push + - name: Get changed spk_packages and dependency_folders of last commit for push if: github.event_name == 'push' - id: getfile + id: getchanges_push run: | - git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs - echo "files=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT + git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -oP "^spk/\K[^\/]*" | sort -u | xargs + echo "spk_packages=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -oP "^spk/\K[^\/]*" | sort -u | xargs)" >> $GITHUB_OUTPUT + git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -oP "(cross|native)/[^\/]*" | sort -u | xargs + echo "dependency_folders=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -oP "(cross|native)/[^\/]*" | sort -u | xargs)" >> $GITHUB_OUTPUT - name: Evaluate dependencies id: dependencies run: ./.github/actions/prepare.sh env: - GH_FILES: ${{ steps.getfile.outputs.files }} ${{ steps.getfile_pr.outputs.files }} - SPK_TO_BUILD: ${{ github.event.inputs.package }} + GH_SPK_PACKAGES: ${{ steps.getchanges_push.outputs.spk_packages }} ${{ steps.getchanges_pr.outputs.spk_packages }} + GH_DEPENDENCY_FOLDERS: ${{ steps.getchanges_push.outputs.dependency_folders }} ${{ steps.getchanges_pr.outputs.dependency_folders }} + USER_SPK_TO_BUILD: ${{ github.event.inputs.package }} # Set default values for all builds (manual or automated) - name: Set default values for generate matrix