2019-05-01 18:22:12 +02:00
|
|
|
container:
|
|
|
|
image: termux/package-builder:latest
|
|
|
|
cpu: 8
|
|
|
|
memory: 16
|
|
|
|
|
|
|
|
# Build packages.
|
|
|
|
build_task:
|
|
|
|
# 2 hours is a maximal timeout for free use.
|
|
|
|
timeout_in: 120m
|
|
|
|
|
|
|
|
environment:
|
|
|
|
matrix:
|
|
|
|
TERMUX_ARCH: aarch64
|
|
|
|
TERMUX_ARCH: arm
|
|
|
|
TERMUX_ARCH: i686
|
|
|
|
TERMUX_ARCH: x86_64
|
|
|
|
|
|
|
|
# Do not use built-in git client provided by Cirrus as it
|
|
|
|
# causes problems when determining changed files.
|
|
|
|
clone_script: |
|
|
|
|
if [[ -z "$CIRRUS_PR" ]]; then
|
2019-05-02 13:59:28 +02:00
|
|
|
git clone --recursive --branch="$CIRRUS_BRANCH" "https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git" "$CIRRUS_WORKING_DIR"
|
|
|
|
git reset --hard "$CIRRUS_CHANGE_IN_REPO"
|
2019-05-01 18:22:12 +02:00
|
|
|
else
|
2019-05-02 13:59:28 +02:00
|
|
|
git clone --recursive "https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git" "$CIRRUS_WORKING_DIR"
|
|
|
|
git fetch origin "pull/$CIRRUS_PR/head:pull/$CIRRUS_PR"
|
|
|
|
git reset --hard "$CIRRUS_CHANGE_IN_REPO"
|
2019-05-01 18:22:12 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Determine changes in repository and build modified packages.
|
|
|
|
build_script: |
|
2019-05-06 14:49:59 +02:00
|
|
|
if grep -qiP '^\s*%ci:reset-backlog\s*$' <(git log --format="%B" -n 1 "$CIRRUS_CHANGE_IN_REPO"); then
|
2019-05-06 15:14:54 +02:00
|
|
|
# If commit message contains line '%ci:reset-backlog', builds will be done
|
|
|
|
# only for current commit.
|
|
|
|
unset CIRRUS_LAST_GREEN_CHANGE
|
2019-05-06 15:18:27 +02:00
|
|
|
unset CIRRUS_BASE_SHA
|
2019-05-06 14:24:49 +02:00
|
|
|
fi
|
2019-05-06 15:14:54 +02:00
|
|
|
MODIFIED_PACKAGES=$(./scripts/build/ci/determine_git_changes.sh)
|
2019-05-06 14:24:49 +02:00
|
|
|
for package in $MODIFIED_PACKAGES; do
|
2019-05-01 18:22:12 +02:00
|
|
|
if [ -n "$CIRRUS_PR" ]; then
|
|
|
|
# Perform full builds for PR.
|
|
|
|
./build-package.sh -a "$TERMUX_ARCH" "$package"
|
|
|
|
else
|
|
|
|
./build-package.sh -I -a "$TERMUX_ARCH" "$package"
|
|
|
|
fi
|
|
|
|
done
|
2019-05-02 13:59:28 +02:00
|
|
|
if [ -d ./debs ]; then
|
2019-05-02 23:47:26 +02:00
|
|
|
# Upload packages to cache.
|
|
|
|
tar zcf "debs-${TERMUX_ARCH}.tar.gz" debs
|
2019-05-06 14:56:40 +02:00
|
|
|
curl -s --upload-file "debs-${TERMUX_ARCH}.tar.gz" "http://$CIRRUS_HTTP_CACHE_HOST/debs-${TERMUX_ARCH}-${CIRRUS_CHANGE_IN_REPO}"
|
2019-05-02 13:59:28 +02:00
|
|
|
fi
|
2019-05-01 18:22:12 +02:00
|
|
|
|
|
|
|
# Also make them downloadable from the UI.
|
2019-05-02 23:47:26 +02:00
|
|
|
output_artifacts:
|
2019-05-01 18:22:12 +02:00
|
|
|
path: "./debs/*.deb"
|
|
|
|
|
|
|
|
# Publish packages to Bintray.
|
|
|
|
publish_task:
|
|
|
|
only_if: $CIRRUS_BRANCH == 'master'
|
|
|
|
|
2019-05-06 14:24:49 +02:00
|
|
|
timeout_in: 60m
|
2019-05-01 18:22:12 +02:00
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- build
|
|
|
|
|
|
|
|
environment:
|
|
|
|
BINTRAY_USERNAME: ENCRYPTED[5f767b4b9d6437b98e81c7a9c510363be8c71458efe17b73692898f5bd2720b359a962677b68930e298febf440bea75b]
|
|
|
|
BINTRAY_API_KEY: ENCRYPTED[c056d345d7a15f90b818dd9382129c27ce4ce2b802831ec890786414fc214c4203714c353a8fef3a6b9b1b1d68e4685e]
|
|
|
|
BINTRAY_GPG_SUBJECT: ENCRYPTED[adefd71182b37f4cfe2ef734bb400f5d273c562d45536edce46fd63d260a0c0717df7e73f2bb492afb4f5c0ef6d0460d]
|
|
|
|
BINTRAY_GPG_PASSPHRASE: ENCRYPTED[854c09c78b3318a30d3c9094b1010dfebd4c71ad9173b64479eaafaa7e941b050afaa936ad635af3709382492828316f]
|
|
|
|
|
|
|
|
# Publish.
|
|
|
|
upload_to_bintray_script: |
|
2019-05-06 14:49:59 +02:00
|
|
|
if grep -qiP '^\s*%ci:reset-backlog\s*$' <(git log --format="%B" -n 1 "$CIRRUS_CHANGE_IN_REPO"); then
|
2019-05-06 15:14:54 +02:00
|
|
|
unset CIRRUS_LAST_GREEN_CHANGE
|
2019-05-06 15:18:27 +02:00
|
|
|
unset CIRRUS_BASE_SHA
|
2019-05-06 14:33:50 +02:00
|
|
|
fi
|
2019-05-06 15:14:54 +02:00
|
|
|
MODIFIED_PACKAGES=$(./scripts/build/ci/determine_git_changes.sh)
|
2019-05-01 18:22:12 +02:00
|
|
|
if [ -n "$MODIFIED_PACKAGES" ]; then
|
2019-05-06 14:24:49 +02:00
|
|
|
for arch in aarch64 arm i686 x86_64; do
|
2019-05-06 14:56:40 +02:00
|
|
|
curl -s -o "/tmp/debs-${arch}.tar.gz" "http://$CIRRUS_HTTP_CACHE_HOST/debs-${arch}-${CIRRUS_CHANGE_IN_REPO}"
|
2019-05-06 14:24:49 +02:00
|
|
|
tar xvf "/tmp/debs-${arch}.tar.gz"
|
|
|
|
rm -f "/tmp/debs-${arch}.tar.gz"
|
|
|
|
done
|
2019-05-01 18:22:12 +02:00
|
|
|
./scripts/package_uploader.sh $MODIFIED_PACKAGES
|
|
|
|
fi
|