Skip to content

Commit

Permalink
ci(tests.yml): use -Qa and dep-tree.sh (#5986)
Browse files Browse the repository at this point in the history
Co-authored-by: ook37 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored May 8, 2024
1 parent e3bd989 commit 035aaa6
Showing 1 changed file with 52 additions and 16 deletions.
68 changes: 52 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,19 @@ jobs:
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
export METADIR=/var/lib/pacstall/metadata
PRNUM="$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')"
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ ${changed_file} == *".pacscript" ]]; then
pacscript_file=`basename "${changed_file}"`
package_name="${pacscript_file/.pacscript/ }"
package_dir=`dirname "${changed_file}"`
echo "Running pacstall -I for ${package_name}..."
echo "pacstall -I ${package_name}"
pushd ${package_dir}
pacstall --disable-prompts -I ${pacscript_file} || exit 1
popd
package_name="${pacscript_file/.pacscript/}"
if [[ -f "${METADIR}/${package_name}" ]]; then
echo "Package ${package_name} has already been installed."
else
echo "Running pacstall -Qa for ${package_name}..."
echo "pacstall -Qa ${package_name}#${PRNUM}@github:${GITHUB_REPOSITORY}"
{ echo N | pacstall -Qa ${package_name}#${PRNUM}@github:${GITHUB_REPOSITORY}; } || exit 1
fi
fi
done
shell: sudo -E -u dio bash {0}
Expand All @@ -131,7 +134,22 @@ jobs:
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
for changed_file in $(pacstall -L); do
export METADIR=/var/lib/pacstall/metadata
function array.contains() {
local check
local -n arra="${1:?No array passed to array.contains}"
local input="${2:?No input given to array.contains}"
for check in "${arra[@]}"; do
if [[ ${check} == "${input}" ]]; then
return 0
fi
done
return 1
}
source /usr/share/pacstall/scripts/dep-tree.sh
mapfile -t list < <(pacstall -L)
dep_tree.loop_traits order "${list[@]}"
for changed_file in "${order[@]}"; do
echo "Running pacstall -R for ${changed_file}..."
pacstall --disable-prompts -R ${changed_file} || exit 1
done
Expand Down Expand Up @@ -212,16 +230,19 @@ jobs:
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
export METADIR=/var/lib/pacstall/metadata
PRNUM="$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')"
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [[ ${changed_file} == *".pacscript" ]]; then
pacscript_file=`basename "${changed_file}"`
package_name="${pacscript_file/.pacscript/ }"
package_dir=`dirname "${changed_file}"`
echo "Running pacstall -I for ${package_name}..."
echo "pacstall -Il ${package_name}"
pushd ${package_dir}
pacstall --disable-prompts -I ${pacscript_file} || exit 1
popd
package_name="${pacscript_file/.pacscript/}"
if [[ -f "${METADIR}/${package_name}" ]]; then
echo "Package ${package_name} has already been installed."
else
echo "Running pacstall -Qa for ${package_name}..."
echo "pacstall -Qa ${package_name}#${PRNUM}@github:${GITHUB_REPOSITORY}"
{ echo N | pacstall -Qa ${package_name}#${PRNUM}@github:${GITHUB_REPOSITORY}; } || exit 1
fi
fi
done
shell: sudo -E -u dio bash {0}
Expand All @@ -233,7 +254,22 @@ jobs:
export SUDO_USER=$USER
export DEBIAN_FRONTEND=noninteractive
export GITHUB_ACTIONS=true
for changed_file in $(pacstall -L); do
export METADIR=/var/lib/pacstall/metadata
function array.contains() {
local check
local -n arra="${1:?No array passed to array.contains}"
local input="${2:?No input given to array.contains}"
for check in "${arra[@]}"; do
if [[ ${check} == "${input}" ]]; then
return 0
fi
done
return 1
}
source /usr/share/pacstall/scripts/dep-tree.sh
mapfile -t list < <(pacstall -L)
dep_tree.loop_traits order "${list[@]}"
for changed_file in "${order[@]}"; do
echo "Running pacstall -R for ${changed_file}..."
pacstall --disable-prompts -R ${changed_file} || exit 1
done
Expand Down

0 comments on commit 035aaa6

Please sign in to comment.