-
Notifications
You must be signed in to change notification settings - Fork 413
173 lines (170 loc) · 6.7 KB
/
main.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Build ROMs Using Crave
on:
workflow_dispatch:
inputs:
BASE_PROJECT:
description: 'Select Base Project'
required: true
default: 'lineage-20'
type: choice
options:
- 'lineage-20'
- 'crdroid-10'
- 'arrow-13'
- 'derp-13'
BUILD_DIFFERENT_ROM:
description: 'Replace with Repo Init Command'
required: false
default: 'echo "Build Starting!"'
REMOVALS:
description: 'Folders to Remove Before Syncing'
default: '.repo/local_manifests'
LOCAL_MANIFEST:
description: 'Local Manifest URL'
required: true
default: 'https://github.com/sounddrill31/local_manifests'
LOCAL_MANIFEST_BRANCH:
description: 'Local Manifest Branch'
required: true
default: 'lineage-oxygen'
DEVICE_NAME:
description: 'DEVICE_NAME'
required: true
default: 'oxygen'
MAKEFILE_NAME:
description: 'MAKEFILE_NAME'
required: true
default: 'lineage_oxygen'
BUILD_COMMAND:
description: 'BUILD_COMMAND'
required: true
default: 'mka bacon'
BUILD_TYPE:
description: 'Build Type'
required: true
default: 'userdebug'
type: choice
options:
- 'eng'
- 'userdebug'
- 'user'
CLEAN_BUILD:
description: 'Build Clean?'
default: 'false'
jobs:
test:
name: Build using foss.crave.io
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: rm -rf *
- name: Check-out to repository
uses: actions/checkout@v4
- name: Create workspace
run: mkdir ${{ github.event.inputs.DEVICE_NAME }}
continue-on-error: true
- name: Enter Workspace
run: cd ${{ github.event.inputs.DEVICE_NAME }}
continue-on-error: true
- name: Install gh command
run: curl -sS https://webi.sh/gh | sh
- name: Install repo
run: |
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
sudo ln -sf ~/bin/repo /usr/bin/repo
- name: Test Local Manifests
run: |
if [ '${{ github.event.inputs.BUILD_DIFFERENT_ROM }}' == 'echo "Build Starting!"' ]; then
case "${{ github.event.inputs.BASE_PROJECT }}" in
"ArrowOS 13.1")
repo init -u https://github.com/ArrowOS/android_manifest.git -b arrow-13.1 --depth=1
;;
"DerpFest 13.0")
repo init -u https://github.com/DerpFest-AOSP/manifest.git -b 13 --depth=1
;;
"crDroid 14.0")
repo init -u https://github.com/crdroidandroid/android.git -b 14.0 --git-lfs --depth=1
;;
"LineageOS 20.0")
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --git-lfs --depth=1
;;
esac
else
${{ github.event.inputs.BUILD_DIFFERENT_ROM }}
git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{ github.event.inputs.LOCAL_MANIFEST_BRANCH }} .repo/local_manifests && \
timeout 2m repo sync --force-sync || { exit_code=$?; [ $exit_code -eq 124 ] || (echo "Error: Process failed with exit code $exit_code"; exit $exit_code); }
fi
timeout-minutes: 10
- name: Initialize repo
run: |
git config --global user.name "sounddrill31"
git config --global user.email "sounddrill31@gmail.com"
if [ "${{ github.event.inputs.BASE_PROJECT }}" == "arrow-13" ]; then
repo init -u https://github.com/ArrowOS/android_manifest.git -b arrow-13.1
fi
if [ "${{ github.event.inputs.BASE_PROJECT }}" == "derp-13" ]; then
repo init -u https://github.com/DerpFest-AOSP/manifest.git -b 13
fi
if [ "${{ github.event.inputs.BASE_PROJECT }}" == "crdroid-10" ]; then
repo init -u https://github.com/crdroidandroid/android.git -b 14.0 --git-lfs
fi
if [ "${{ github.event.inputs.BASE_PROJECT }}" == "lineage-20" ]; then
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --git-lfs
fi
id: pwd
- name: Set Up Crave
run: |
rm -rf crave
curl -s https://raw.githubusercontent.com/accupara/crave/master/get_crave.sh | bash -s --
envsubst < crave.conf.sample >> crave.conf
rm -rf crave.conf.sample
env:
CRAVE_USERNAME: ${{ secrets.CRAVE_USERNAME }}
CRAVE_TOKEN: ${{ secrets.CRAVE_TOKEN }}
- name: Crave Run
run: |
if [ "${{ github.event.inputs.CLEAN_BUILD }}" == "true" ]; then
export CLEAN="--clean"
else
export CLEAN=""
fi
./crave run $CLEAN --no-patch -- "rm -rf ${{ github.event.inputs.REMOVALS }} && \
# Clone local_manifests repository
${{ github.event.inputs.BUILD_DIFFERENT_ROM }} ; \
git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{ github.event.inputs.LOCAL_MANIFEST_BRANCH }} .repo/local_manifests && \
# Sync the repositories
repo sync -c -j$(nproc --all) --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync && \
# Set up build environment
export BUILD_HOSTNAME=crave ; \
export BUILD_USERNAME=sounddrill31 ; \
source build/envsetup.sh && \
# Lunch configuration
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-${{ github.event.inputs.BUILD_TYPE }} && \
# Build the ROM
make clean && \
${{ github.event.inputs.BUILD_COMMAND }}"
- name: Execute if the job is cancelled
if: ${{ cancelled() }}
run: ./crave stop --all
- name: Pull Compiled files
run: |
./crave pull out/target/product/*/*.zip
./crave pull out/target/product/*/*.img
- name: Upload to Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ github.event.inputs.DEVICE_NAME }}/recovery.img
${{ github.event.inputs.DEVICE_NAME }}/boot.img
${{ github.event.inputs.DEVICE_NAME }}/vendor_boot.img
${{ github.event.inputs.DEVICE_NAME }}/vendor.img
${{ github.event.inputs.DEVICE_NAME }}/system.img
${{ github.event.inputs.DEVICE_NAME }}/*.zip
name: ${{ github.event.inputs.MAKEFILE_NAME }}-${{ github.run_id }}
tag_name: ${{ github.run_id }}
body: |
Target: ${{ github.event.inputs.MAKEFILE_NAME }}-${{ github.event.inputs.BUILD_TYPE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}