mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2025-12-22 11:40:18 +00:00
packages.yml: algorithm update
This commit is contained in:
29
.github/workflows/packages.yml
vendored
29
.github/workflows/packages.yml
vendored
@@ -42,32 +42,32 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MANUAL_INPUT_PACKAGES: ${{ github.event.inputs.packages }}
|
MANUAL_INPUT_PACKAGES: ${{ github.event.inputs.packages }}
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
|
|
||||||
BASE_COMMIT=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
|
|
||||||
# We are intentionally not using .commits[0].id and .commits[-1].id as github seems to
|
# We are intentionally not using .commits[0].id and .commits[-1].id as github seems to
|
||||||
# only send 20 commits in the payload for github action runs instead of the 2048 documented
|
# only send 20 commits in the payload for github action runs instead of the 2048 documented
|
||||||
# limit. Perhaps 2048 is the limit just for webhooks, where they haven't documented
|
# limit. Perhaps 2048 is the limit just for webhooks, where they haven't documented
|
||||||
# properly that the limit for github actions is only 20:
|
# properly that the limit for github actions is only 20:
|
||||||
#
|
#
|
||||||
# https://docs.github.com/en/webhooks/webhook-events-and-payloads#push
|
# https://docs.github.com/en/webhooks/webhook-events-and-payloads#push
|
||||||
OLD_COMMIT=$(jq --raw-output .before "$GITHUB_EVENT_PATH")
|
OLD_COMMIT="${{ github.event.before }}"
|
||||||
HEAD_COMMIT=$(jq --raw-output .after "$GITHUB_EVENT_PATH")
|
HEAD_COMMIT="${{ github.event.after }}"
|
||||||
if [ "$BASE_COMMIT" = "null" ]; then
|
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
|
||||||
if ! git log "$OLD_COMMIT" 2> /dev/null; then
|
BASE_REF="${{ github.event.pull_request.base.ref }}"
|
||||||
|
git fetch origin "${BASE_REF:-master}" 2>/dev/null
|
||||||
|
BASE_COMMIT="$(git merge-base "origin/${BASE_REF:-master}" "HEAD")"
|
||||||
|
if [ -z "${{ github.event.pull_request.base.sha }}" ]; then
|
||||||
|
if ! git log "$OLD_COMMIT" > /dev/null; then
|
||||||
if [ "$(git branch --show-current)" = "master" ]; then
|
if [ "$(git branch --show-current)" = "master" ]; then
|
||||||
echo "Force push detected on master branch. Unable to proceed."
|
echo "Force push detected on master branch. Unable to proceed."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "::warning:: Force push detected on non-master branch. Trying to proceed at any cost but may not work as expected."
|
OLD_COMMIT=$(git fetch origin master >&2; git merge-base origin/master $HEAD_COMMIT)
|
||||||
OLD_COMMIT=$(jq --raw-output .commits[0].id "$GITHUB_EVENT_PATH")
|
|
||||||
echo "::warning:: OLD_COMMIT is set to $OLD_COMMIT which may not be correct if you have pushed more than 20 commits."
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Processing commit range: ${OLD_COMMIT}..${HEAD_COMMIT}"
|
echo "Processing commit range: ${OLD_COMMIT}..${HEAD_COMMIT}"
|
||||||
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r "${OLD_COMMIT}" "${HEAD_COMMIT}")
|
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r "${OLD_COMMIT}" "${HEAD_COMMIT}")
|
||||||
else
|
else
|
||||||
# Pull requests.
|
# Pull requests.
|
||||||
echo "Processing pull request #$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH"): ${BASE_COMMIT}..HEAD"
|
echo "Processing pull request #${{ github.event.pull_request.number }}: ${BASE_COMMIT}..HEAD"
|
||||||
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r "${BASE_COMMIT}" "HEAD")
|
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r "${BASE_COMMIT}" "HEAD")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -210,14 +210,13 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Free additional disk space (if needed)
|
- name: Free additional disk space (if needed)
|
||||||
env:
|
if: ${{ steps.build-info.outputs.docker-build == 'false' }}
|
||||||
DOCKER_BUILD: ${{ steps.build-info.outputs.docker-build }}
|
|
||||||
run: |
|
run: |
|
||||||
if [ "$DOCKER_BUILD" == 'false' ]; then
|
|
||||||
./scripts/setup-ubuntu.sh
|
./scripts/setup-ubuntu.sh
|
||||||
|
./scripts/setup-android-sdk.sh
|
||||||
|
rm -f ${HOME}/lib/ndk-*.zip ${HOME}/lib/sdk-*.zip
|
||||||
sudo apt install ninja-build
|
sudo apt install ninja-build
|
||||||
./scripts/free-space.sh
|
./scripts/free-space.sh
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build packages
|
- name: Build packages
|
||||||
env:
|
env:
|
||||||
@@ -235,7 +234,7 @@ jobs:
|
|||||||
|
|
||||||
if [[ "${#packages[@]}" -gt 0 ]]; then
|
if [[ "${#packages[@]}" -gt 0 ]]; then
|
||||||
if [ "$DOCKER_BUILD" == 'false' ]; then
|
if [ "$DOCKER_BUILD" == 'false' ]; then
|
||||||
NDK="$ANDROID_NDK" ANDROID_HOME="$ANDROID_SDK_ROOT" ./build-package.sh --format pacman -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
|
./build-package.sh --format pacman -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
|
||||||
else
|
else
|
||||||
./scripts/run-docker.sh ./build-package.sh --format pacman -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
|
./scripts/run-docker.sh ./build-package.sh --format pacman -I -C -a "${{ matrix.target_arch }}" "${packages[@]}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user