-
Notifications
You must be signed in to change notification settings - Fork 55
/
.cirrus.yml
75 lines (71 loc) · 4.08 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
# SPDX-FileCopyrightText: © 2018 Robin Ole Heinemann <robin.ole.heinemann@gmail.com>
# SPDX-FileCopyrightText: © 2019 Jaro Habiger <jarohabiger@googlemail.com>
# SPDX-License-Identifier: GPL-3.0-only
docker_builder:
only_if: $CIRRUS_TAG !=~ "nightly/.*"
env:
TOKEN: ENCRYPTED[cff6f06239aa2434cd631f124cb5dc8b391ff3bd57e8e651e8bf28493751cb9826f0f02aaed47d98d545ed8d5b5f1135]
matrix:
DEVICE: beta
# DEVICE: pynqz2
DEVICE: micro
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
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;
git submodule update --init --recursive
make_script: |
./makefiles/docker-make.sh DEVICE=$DEVICE
# compress the image
FILE=axiom-$DEVICE$([ -z $CIRRUS_PR ] || echo "-pr-$CIRRUS_PR")-$(git describe --always --abbrev=8).img.xz
xz -kT $(nproc) build/axiom-$DEVICE.img
mv build/axiom-$DEVICE.img.xz build/$FILE
environment:
RCLONE_CONFIG: ENCRYPTED[a10afb269a79413205bfe8a943b8cdd85342a91a54a352fe897460c864ab6b78dce9e32bc1b7f1c19fba3f186e7e84fc]
rclone_config_file:
path: rclone.conf
variable_name: RCLONE_CONFIG
image_upload_script: |
if [[ ! -z "$CIRRUS_PR" ]]; then
THE_IMAGE=$(ls build/axiom-*.img.xz)
wget --no-verbose https://downloads.rclone.org/v1.65.0/rclone-v1.65.0-linux-amd64.zip
unzip -j rclone-v1.65.0-linux-amd64.zip "*/rclone"
pushd build
../rclone --config ../rclone.conf copy $(basename $THE_IMAGE) r2:apertus-firmware-pr-builds/
popd
if [ $DEVICE = 'beta' ]; then
IMG_URL=https://pub-2af134bbddf1433f8ea8e2b459aa4c1a.r2.dev/$(basename $THE_IMAGE)
wget --no-verbose https://github.com/cloudposse/github-commenter/releases/download/0.5.0/github-commenter_linux_amd64
chmod a+x github-commenter_linux_amd64
./github-commenter_linux_amd64 -token $TOKEN -owner $CIRRUS_REPO_OWNER -repo $CIRRUS_REPO_NAME -type pr -number $CIRRUS_PR \
-comment "[//]: # (tracking-code: wasDinkDrybatghivSeerz8opDyajMoartEvbagyivwavdapGa)
Download a build of the latest (untested) commit at $IMG_URL" \
-delete-comment-regex "wasDinkDrybatghivSeerz8opDyajMoartEvbagyivwavdapGa"
fi
fi
test_script: |
./makefiles/docker-make.sh DEVICE=$DEVICE -o build/axiom-$DEVICE.img -o build/boot.fs/.install_stamp test
github_release_script: |
if [ $CIRRUS_BRANCH = 'main' ]; then
FILE=axiom-$DEVICE$([ -z $CIRRUS_PR ] || echo "-pr-$CIRRUS_PR")-$(git describe --always --abbrev=8).img.xz
# get the github-release tool
wget --no-verbose https://github.com/github-release/github-release/releases/download/v0.10.0/linux-amd64-github-release.bz2
bzip2 -d linux-amd64-github-release.bz2
chmod a+x linux-amd64-github-release
# create the release and upload the compressed image
./linux-amd64-github-release release -u $CIRRUS_REPO_OWNER -r $CIRRUS_REPO_NAME -t "nightly/$(git describe --always --abbrev=8)" -s $TOKEN -n "Unstable Development Snapshot $(./linux-amd64-github-release info -u $CIRRUS_REPO_OWNER -r $CIRRUS_REPO_NAME | grep "Build on" | wc -l)" -c $CIRRUS_CHANGE_IN_REPO --pre-release -d " \
A development snapshot of the axiom firmware.
Build on $(date) for commit $(git describe --always --abbrev=8).
\`\`\`diff
- Warning! The nightly images are not veryfied by a human and might damage your camera permanently.
- Only continue, if you know, what you are doing!
\`\`\`
" || true
./linux-amd64-github-release upload -u $CIRRUS_REPO_OWNER -r $CIRRUS_REPO_NAME -t "nightly/$(git describe --always --abbrev=8)" -s $TOKEN -n "$FILE" -f build/$FILE
else
echo "not creating a github release, because this is not a build for the main branch"
fi