1515# # limitations under the License.
1616# #
1717
18- name : Packages-TUR-AVD
18+ name : Packages-TUR-Waydroid
1919
2020on :
2121 push :
2222 branches :
2323 - tur-avd
2424 paths :
25- - ' tur-avd /**'
25+ - ' tur-waydroid /**'
2626 pull_request :
2727 paths :
28- - ' tur-avd /**'
28+ - ' tur-waydroid /**'
2929 workflow_dispatch :
3030 inputs :
3131 packages :
3434
3535jobs :
3636 build :
37- runs-on : macos-latest
37+ runs-on : ubuntu-24.04
38+ env :
39+ ANDROID_HOME : " /opt/termux/android-sdk"
40+ NDK : " /opt/termux/android-ndk"
41+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
3842 strategy :
3943 matrix :
40- target_arch :
41- # Disabled for aarch64 due to arm64-v8a emulator cannot start.
42- # - {"TERMUX_ARCH": "aarch64", "EMU_ARCH": "arm64-v8a"}
43- - {"TERMUX_ARCH": "arm", "EMU_ARCH": "armeabi-v7a"}
44- - {"TERMUX_ARCH": "i686", "EMU_ARCH": "x86"}
45- - {"TERMUX_ARCH": "x86_64", "EMU_ARCH": "x86_64"}
44+ target_arch : [i686, x86_64]
45+ # target_arch: [aarch64, arm, i686, x86_64]
4646 fail-fast : false
4747 steps :
48+ - name : Install DKMS and missing modules
49+ run : |
50+ sudo apt update
51+ sudo apt install dkms -y
52+ git clone https://github.com/licy183/anbox-modules -b 6.8.x-ubuntu2404
53+ cd anbox-modules && ./INSTALL.sh
54+ - name : Install wayland
55+ run : |
56+ sudo apt update
57+ sudo apt install xwayland mutter pulseaudio -y
58+ - name : Install waydroid
59+ run : |
60+ sudo apt update
61+ sudo apt install curl ca-certificates -y
62+ curl https://repo.waydro.id | sudo bash
63+ sudo apt update
64+ sudo apt install waydroid -y
65+ sudo waydroid init
66+ - name : Solve network issues for waydroid
67+ run : |
68+ # https://unix.stackexchange.com/a/743946
69+ sudo sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' \
70+ /usr/lib/waydroid/data/scripts/waydroid-net.sh
71+
4872 - name : Clone repository
49- uses : actions/checkout@v3
73+ uses : actions/checkout@v4
5074 with :
5175 fetch-depth : 1000
52- path : ${{ github.workspace }}
53- - name : Install basic tools
54- run : brew install coreutils
76+ submodules : true
77+
5578 - name : Merge repos
5679 run : ./setup-environment.sh
80+
5781 - name : Gather build summary
5882 run : |
5983 if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
@@ -79,16 +103,29 @@ jobs:
79103 fi
80104 mkdir -p ./artifacts ./debs
81105 touch ./debs/.placeholder
82- echo "File changed: ${CHANGED_FILES}"
83106 if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
107+ # Process tag '%ci:no-build' that may be added as line to commit message.
108+ # Forces CI to cancel current build with status 'passed'
109+ if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 "HEAD"); then
110+ tar cf artifacts/debs-${{ matrix.target_arch }}.tar debs
111+ echo "[!] Force exiting as tag '%ci:no-build' was applied to HEAD commit message."
112+ exit 0
113+ fi
114+ # XXX: TUR uses the termux-builder directly and may add custom builder image later.
115+ # Build local Docker image if setup scripts were changed.
116+ # Useful for pull requests submitting changes for both build environment and packages.
117+ # if grep -qP '^scripts/(Dockerfile|setup-android-sdk\.sh|setup-ubuntu\.sh)$' <<< "$CHANGED_FILES"; then
118+ # echo "Detected changes for environment setup scripts. Building custom Docker image now."
119+ # cd ./scripts
120+ # docker build -t termux/package-builder:latest .
121+ # cd ..
122+ # fi
84123 for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
85124 repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
86- echo "Processing on repo: ${repo}"
87125 # Parse changed files and identify new packages and deleted packages.
88126 # Create lists of those packages that will be passed to upload job for
89127 # further processing.
90- for file in $(echo "${CHANGED_FILES}"); do
91- echo "File path: ${file}"
128+ while read -r file; do
92129 if ! [[ $file == ${repo_path}/* ]]; then
93130 # This file does not belong to a package, so ignore it
94131 continue
@@ -114,7 +151,7 @@ jobs:
114151 echo "$pkg" >> ./deleted_${repo}_packages
115152 fi
116153 fi
117- done
154+ done<<<${CHANGED_FILES}
118155 done
119156 else
120157 for pkg in ${{ github.event.inputs.packages }}; do
@@ -141,20 +178,24 @@ jobs:
141178 if [ -f ./built_${repo}_packages.txt ]; then
142179 uniq ./built_${repo}_packages.txt > ./built_${repo}_packages.txt.tmp
143180 mv ./built_${repo}_packages.txt.tmp ./built_${repo}_packages.txt
144- echo "./built_${repo}_packages.txt: "
145- cat ./built_${repo}_packages.txt
146181 fi
147182 if [ -f ./built_${repo}_subpackages.txt ]; then
148183 uniq ./built_${repo}_subpackages.txt > ./built_${repo}_subpackages.txt.tmp
149184 mv ./built_${repo}_subpackages.txt.tmp ./built_${repo}_subpackages.txt
150- echo "./built_${repo}_subpackages.txt: "
151- cat ./built_${repo}_subpackages.txt
152185 fi
153186 if [ -f ./deleted_${repo}_packages.txt ]; then
154187 uniq ./deleted_${repo}_packages.txt > ./deleted_${repo}_packages.txt.tmp
155188 mv ./deleted_${repo}_packages.txt.tmp ./deleted_${repo}_packages.txt
156189 fi
157190 done
191+ - name : Free additional disk space (if necessary)
192+ run : |
193+ if grep -q '^code-server$\|^demo-package2$\$' ./built_tur_packages.txt; then
194+ sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php|aspnetcore)') \
195+ mono-runtime-common monodoc-manual ruby
196+ sudo apt autoremove -yq
197+ sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift
198+ fi
158199 - name : Lint packages
159200 run : |
160201 declare -a package_recipes
@@ -167,39 +208,22 @@ jobs:
167208 if [ ! -z "$package_recipes" ]; then
168209 ./scripts/lint-packages.sh $package_recipes
169210 fi
170-
171- # TODO: Generate AVD Snapshot for caching
172- # - name: Check AVD Cache
173- # uses: actions/cache@v3
174- # id: avd-cache
175- # with:
176- # path: |
177- # ~/.android/avd/*
178- # ~/.android/adb*
179- # key: avd-24-${{ matrix.build_env.MAJOR_VERSION }}
180-
181- # - name: Create AVD and Generate Snapshot for Caching
182- # if: steps.avd-cache.outputs.cache-hit != 'true'
183- # uses: reactivecircus/android-emulator-runner@v2
184- # with:
185- # api-level: 24
186- # force-avd-creation: false
187- # emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
188- # disable-animations: false
189- # script: echo "Generated AVD snapshot for caching."
190-
191211 - name : Build packages
192- 193- with :
194- arch : ${{ matrix.target_arch.EMU_ARCH }}
195- api-level : 24
196- force-avd-creation : false
197- emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
198- disable-animations : true
199- script : env TERMUX_ARCH=${{ matrix.target_arch.TERMUX_ARCH }} ./common-files/action-avd-step-build-packages.sh
212+ run : |
213+ declare -a packages
214+ for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
215+ repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
216+ if [ -f ./built_${repo}_packages.txt ]; then
217+ packages="$packages $(cat ./built_${repo}_packages.txt)"
218+ fi
219+ done
220+ if [ ! -z "$packages" ]; then
221+ PACKAGE_TO_BUILD="$packages" bash -x ./waydroid-build-wrapper.sh
222+ fi
200223 - name : Generate build artifacts
201224 if : always()
202225 run : |
226+ test -d tur/output && mv tur/output/* ./output/
203227 for repo in $(jq --raw-output '.[].name' repo.json); do
204228 # Put package lists into directory with *.deb files so they will be transferred to
205229 # upload job.
@@ -216,28 +240,30 @@ jobs:
216240 done
217241 # Files containing certain symbols (e.g. ":") will cause failure in actions/upload-artifact.
218242 # Archiving *.deb files in a tarball to avoid issues with uploading.
219- tar cf artifacts/debs-${{ matrix.target_arch.TERMUX_ARCH }}-${{ github.sha }}.tar debs
220- rm -rf output
243+ tar cf artifacts/debs-${{ matrix.target_arch }}-${{ github.sha }}.tar debs
221244 - name : Checksums for built *.deb files
222245 if : always()
223246 run : |
224247 find debs -type f -name "*.deb" -exec sha256sum "{}" \; | sort -k2
225248 - name : Store *.deb files
226249 if : always()
227- uses : actions/upload-artifact@v3
250+ uses : actions/upload-artifact@v4
228251 with :
229- name : debs-${{ matrix.target_arch.TERMUX_ARCH }}-${{ github.sha }}
252+ name : debs-${{ matrix.target_arch }}-${{ github.sha }}
230253 path : ./artifacts
254+ include-hidden-files : true
255+ overwrite : true
256+ compression-level : 0
231257
232258 upload :
233259 if : github.event_name != 'pull_request'
234260 needs : build
235261 runs-on : ubuntu-latest
236262 steps :
237263 - name : Clone repository
238- uses : actions/checkout@v3
264+ uses : actions/checkout@v4
239265 - name : Get *.deb files
240- uses : actions/download-artifact@v3
266+ uses : actions/download-artifact@v4
241267 with :
242268 path : ./
243269 - name : Upload to a temporary release
0 commit comments