forked from termux/termux-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
86 lines (76 loc) · 3.1 KB
/
.cirrus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
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"
else
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"
fi
# Determine changes in repository and build modified packages.
build_script: |
if grep -qiP '^\s*%ci:reset-backlog\s*$' <(git log --format="%B" -n 1 "$CIRRUS_CHANGE_IN_REPO"); then
# If commit message contains line '%ci:reset-backlog', builds will be done
# only for current commit.
unset CIRRUS_LAST_GREEN_CHANGE
unset CIRRUS_BASE_SHA
fi
MODIFIED_PACKAGES=$(./scripts/build/ci/determine_git_changes.sh)
for package in $MODIFIED_PACKAGES; do
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
if [ -d ./debs ]; then
# Upload packages to cache.
tar zcf "debs-${TERMUX_ARCH}.tar.gz" debs
curl -s --upload-file "debs-${TERMUX_ARCH}.tar.gz" "http://$CIRRUS_HTTP_CACHE_HOST/debs-${TERMUX_ARCH}-${CIRRUS_CHANGE_IN_REPO}"
fi
# Also make them downloadable from the UI.
output_artifacts:
path: "./debs/*.deb"
# Publish packages to Bintray.
publish_task:
only_if: $CIRRUS_BRANCH == 'master'
timeout_in: 60m
depends_on:
- build
environment:
BINTRAY_USERNAME: xeffyr
BINTRAY_API_KEY: ENCRYPTED[c056d345d7a15f90b818dd9382129c27ce4ce2b802831ec890786414fc214c4203714c353a8fef3a6b9b1b1d68e4685e]
BINTRAY_GPG_SUBJECT: termux
BINTRAY_GPG_PASSPHRASE: ENCRYPTED[854c09c78b3318a30d3c9094b1010dfebd4c71ad9173b64479eaafaa7e941b050afaa936ad635af3709382492828316f]
# Publish.
upload_to_bintray_script: |
if grep -qiP '^\s*%ci:reset-backlog\s*$' <(git log --format="%B" -n 1 "$CIRRUS_CHANGE_IN_REPO"); then
unset CIRRUS_LAST_GREEN_CHANGE
unset CIRRUS_BASE_SHA
fi
MODIFIED_PACKAGES=$(./scripts/build/ci/determine_git_changes.sh)
if [ -n "$MODIFIED_PACKAGES" ]; then
for arch in aarch64 arm i686 x86_64; do
curl -s -o "/tmp/debs-${arch}.tar.gz" "http://$CIRRUS_HTTP_CACHE_HOST/debs-${arch}-${CIRRUS_CHANGE_IN_REPO}"
tar xvf "/tmp/debs-${arch}.tar.gz"
rm -f "/tmp/debs-${arch}.tar.gz"
done
./scripts/package_uploader.sh $MODIFIED_PACKAGES
fi