forked from ROM-builders/temporary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
146 lines (124 loc) · 5.42 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
env:
CIRRUS_CLONE_DEPTH: 1
BUILD_HOSTNAME: "cirrus-ci.org"
bot_api: "ENCRYPTED[b16032643ad0994cda4822c9d477956f434278d0f786f8e131b585aa4f8510a11f3cd9f6a66a63568d2cba1c4dde25b4]"
task:
name: Test
skip: $CIRRUS_BRANCH == 'main'
only_if: $CIRRUS_REPO_OWNER == 'ROM-builders'
timeout_in: 30m
container:
image: apon77/aosp:cirrus
cpu: .7
memory: 2G
env_script:
- env
show_script:
- cat $CIRRUS_WORKING_DIR/build_rom.sh
notify_script:
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- device=$(grep unch $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d ' ' -f 2 | cut -d _ -f 2 | cut -d - -f 1)
- your_telegram_id=@ROM_builders_junk
- show=$(cat $CIRRUS_WORKING_DIR/build_rom.sh)
- curl -s "https://api.telegram.org/bot${bot_api}/sendmessage" -d "text=<code>$device-$rom_name</code> Started
https://cirrus-ci.com/build/$CIRRUS_BUILD_ID
$show" -d "chat_id=${your_telegram_id}" -d "parse_mode=HTML"
test_script:
- set -e
- curl -Ls https://github.com/ROM-builders/temporary/raw/main/test.sh | bash
task:
name: Build
skip: $CIRRUS_BRANCH == 'main'
only_if: $CIRRUS_REPO_OWNER == 'ROM-builders'
depends_on:
- Test
timeout_in: 4h
persistent_worker:
isolation:
container:
image: apon77/aosp:cirrus
cpu: 24
memory: 60G
volumes:
- /home/cirrus/roms:/home/cirrus/roms
- /home/cirrus/ccache:/home/cirrus/ccache
- /home/cirrus/.config:/home/cirrus/.config
show_script:
- cat $CIRRUS_WORKING_DIR/build_rom.sh
sync_script:
- set -exv
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
# - same_rom=$(ps aux|grep /home/cirrus/roms/$rom_name|wc -l)
# - if [[ $same_rom -gt 1 ]]; then echo Please wait until same rom other running build is finished; exit 1; fi
- mkdir -p ~/roms/$rom_name
- cd ~/roms/$rom_name
- ls same_rom_running && exit 1 || true
- touch same_rom_running
- rm -rf .repo/local_manifests
- command=$(head $CIRRUS_WORKING_DIR/build_rom.sh -n $(expr $(grep 'build/envsetup.sh' $CIRRUS_WORKING_DIR/build_rom.sh -n | cut -f1 -d:) - 1))
- only_sync=$(grep 'repo sync' $CIRRUS_WORKING_DIR/build_rom.sh)
- bash -c "$command" || (repo forall -c 'git checkout .' && bash -c "$only_sync") || (find -name shallow.lock -delete && find -name index.lock -delete && bash -c "$only_sync")
build_script:
- set -exv
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- device=$(grep unch $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d ' ' -f 2 | cut -d _ -f 2 | cut -d - -f 1)
- cd ~/roms/$rom_name
- export CCACHE_DIR=~/ccache/$rom_name/$device
- export CCACHE_EXEC=$(which ccache)
- export USE_CCACHE=1
- ccache -M 10G
- ccache -z
- rm -rf device/*/*/vendorsetup.sh
- command=$(tail $CIRRUS_WORKING_DIR/build_rom.sh -n +$(expr $(grep 'build/envsetup.sh' $CIRRUS_WORKING_DIR/build_rom.sh -n | cut -f1 -d:) - 1)| head -n -1 | grep -v 'rclone copy')
- bash -c "$command"
always:
same_rom_script:
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- cd ~/roms/$rom_name
- rm same_rom_running
ccache_stats_script:
- set -exv
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- device=$(grep unch $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d ' ' -f 2 | cut -d _ -f 2 | cut -d - -f 1)
- export CCACHE_DIR=~/ccache/$rom_name/$device
- ccache -s
upload_script:
- set -exv
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- device=$(grep unch $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d ' ' -f 2 | cut -d _ -f 2 | cut -d - -f 1)
- cd ~/roms/$rom_name
- engzip=$(ls out/target/product/$device/*-eng*.zip || true)
- otazip=$(ls out/target/product/$device/*-ota-*.zip | grep -v "hentai" || true)
- awaken=$(ls out/target/product/$device/Project-Awaken*.zip || true)
- octavi=$(ls out/target/product/$device/OctaviOS-R*.zip || true)
- p404=$(ls out/target/product/$device/?.*zip || true)
- rm -rf $engzip $otazip $awaken $octavi $p404
- dlink=$(basename out/target/product/$device/*.zip)
- command=$(grep 'rclone copy' $CIRRUS_WORKING_DIR/build_rom.sh)
- bash -c "$command"
- echo "Download link https://roms.cirrus-ci.workers.dev/0:/$device/$dlink"
remove_script:
- set -exv
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- device=$(grep unch $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d ' ' -f 2 | cut -d _ -f 2 | cut -d - -f 1)
- cd ~/roms/$rom_name
- rm -rf out/target/product/$device
task:
name: Post Build
skip: $CIRRUS_BRANCH == 'main'
only_if: $CIRRUS_REPO_OWNER == 'ROM-builders'
skip_notifications: true
depends_on:
- Build
timeout_in: 30m
container:
image: apon77/aosp:cirrus
cpu: .7
memory: 2G
post_build_script:
- set -e
- rom_name=$(grep init $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d / -f 4)
- device=$(grep unch $CIRRUS_WORKING_DIR/build_rom.sh -m 1 | cut -d ' ' -f 2 | cut -d _ -f 2 | cut -d - -f 1)
- your_telegram_id=@ROM_builders_channel
- curl -s "https://api.telegram.org/bot${bot_api}/sendmessage" -d "text=<code>$device-$rom_name</code> Succeed
https://cirrus-ci.com/build/$CIRRUS_BUILD_ID" -d "chat_id=${your_telegram_id}" -d "parse_mode=HTML"