1515# # limitations under the License.
1616# #
1717
18- name : Packages-TUR-AVD
18+ name : Packages-TUR-Waydroid
1919
2020on :
2121 push :
2222 branches :
23- - tur-avd
23+ - master
24+ - dev
25+ - ' dev/**'
2426 paths :
25- - ' tur-avd /**'
27+ - ' tur-waydroid /**'
2628 pull_request :
2729 paths :
28- - ' tur-avd /**'
30+ - ' tur-waydroid /**'
2931 workflow_dispatch :
3032 inputs :
3133 packages :
3436
3537jobs :
3638 build :
37- runs-on : macos-latest
39+ runs-on : ubuntu-24.04
40+ env :
41+ ANDROID_HOME : " /opt/termux/android-sdk"
42+ NDK : " /opt/termux/android-ndk"
43+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
3844 strategy :
3945 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"}
46+ target_arch : [i686, x86_64]
47+ # target_arch: [aarch64, arm, i686, x86_64]
4648 fail-fast : false
4749 steps :
50+ - name : Install DKMS and missing modules
51+ run : |
52+ sudo apt update
53+ sudo apt install dkms -y
54+ git clone https://github.com/licy183/anbox-modules -b 6.8.x-ubuntu2404
55+ cd anbox-modules && ./INSTALL.sh
56+ - name : Install wayland
57+ run : |
58+ sudo apt update
59+ sudo apt install xwayland mutter pulseaudio -y
60+ - name : Install waydroid
61+ run : |
62+ sudo apt update
63+ sudo apt install curl ca-certificates -y
64+ curl https://repo.waydro.id | sudo bash
65+ sudo apt update
66+ sudo apt install waydroid -y
67+ sudo waydroid init
68+ - name : Solve network issues for waydroid
69+ run : |
70+ # https://unix.stackexchange.com/a/743946
71+ sudo sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' \
72+ /usr/lib/waydroid/data/scripts/waydroid-net.sh
73+
4874 - name : Clone repository
49- uses : actions/checkout@v3
75+ uses : actions/checkout@v4
5076 with :
5177 fetch-depth : 1000
52- path : ${{ github.workspace }}
53- - name : Install basic tools
54- run : brew install coreutils
78+ submodules : true
79+
5580 - name : Merge repos
5681 run : ./setup-environment.sh
82+
5783 - name : Gather build summary
5884 run : |
5985 if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
@@ -79,16 +105,29 @@ jobs:
79105 fi
80106 mkdir -p ./artifacts ./debs
81107 touch ./debs/.placeholder
82- echo "File changed: ${CHANGED_FILES}"
83108 if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
109+ # Process tag '%ci:no-build' that may be added as line to commit message.
110+ # Forces CI to cancel current build with status 'passed'
111+ if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 "HEAD"); then
112+ tar cf artifacts/debs-${{ matrix.target_arch }}.tar debs
113+ echo "[!] Force exiting as tag '%ci:no-build' was applied to HEAD commit message."
114+ exit 0
115+ fi
116+ # XXX: TUR uses the termux-builder directly and may add custom builder image later.
117+ # Build local Docker image if setup scripts were changed.
118+ # Useful for pull requests submitting changes for both build environment and packages.
119+ # if grep -qP '^scripts/(Dockerfile|setup-android-sdk\.sh|setup-ubuntu\.sh)$' <<< "$CHANGED_FILES"; then
120+ # echo "Detected changes for environment setup scripts. Building custom Docker image now."
121+ # cd ./scripts
122+ # docker build -t termux/package-builder:latest .
123+ # cd ..
124+ # fi
84125 for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
85126 repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
86- echo "Processing on repo: ${repo}"
87127 # Parse changed files and identify new packages and deleted packages.
88128 # Create lists of those packages that will be passed to upload job for
89129 # further processing.
90- for file in $(echo "${CHANGED_FILES}"); do
91- echo "File path: ${file}"
130+ while read -r file; do
92131 if ! [[ $file == ${repo_path}/* ]]; then
93132 # This file does not belong to a package, so ignore it
94133 continue
@@ -114,7 +153,7 @@ jobs:
114153 echo "$pkg" >> ./deleted_${repo}_packages
115154 fi
116155 fi
117- done
156+ done<<<${CHANGED_FILES}
118157 done
119158 else
120159 for pkg in ${{ github.event.inputs.packages }}; do
@@ -141,20 +180,24 @@ jobs:
141180 if [ -f ./built_${repo}_packages.txt ]; then
142181 uniq ./built_${repo}_packages.txt > ./built_${repo}_packages.txt.tmp
143182 mv ./built_${repo}_packages.txt.tmp ./built_${repo}_packages.txt
144- echo "./built_${repo}_packages.txt: "
145- cat ./built_${repo}_packages.txt
146183 fi
147184 if [ -f ./built_${repo}_subpackages.txt ]; then
148185 uniq ./built_${repo}_subpackages.txt > ./built_${repo}_subpackages.txt.tmp
149186 mv ./built_${repo}_subpackages.txt.tmp ./built_${repo}_subpackages.txt
150- echo "./built_${repo}_subpackages.txt: "
151- cat ./built_${repo}_subpackages.txt
152187 fi
153188 if [ -f ./deleted_${repo}_packages.txt ]; then
154189 uniq ./deleted_${repo}_packages.txt > ./deleted_${repo}_packages.txt.tmp
155190 mv ./deleted_${repo}_packages.txt.tmp ./deleted_${repo}_packages.txt
156191 fi
157192 done
193+ - name : Free additional disk space (if necessary)
194+ run : |
195+ if grep -q '^code-server$\|^demo-package2$\$' ./built_tur_packages.txt; then
196+ sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php|aspnetcore)') \
197+ mono-runtime-common monodoc-manual ruby
198+ sudo apt autoremove -yq
199+ sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift
200+ fi
158201 - name : Lint packages
159202 run : |
160203 declare -a package_recipes
@@ -167,39 +210,22 @@ jobs:
167210 if [ ! -z "$package_recipes" ]; then
168211 ./scripts/lint-packages.sh $package_recipes
169212 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-
191213 - 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
214+ run : |
215+ declare -a packages
216+ for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
217+ repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
218+ if [ -f ./built_${repo}_packages.txt ]; then
219+ packages="$packages $(cat ./built_${repo}_packages.txt)"
220+ fi
221+ done
222+ if [ ! -z "$packages" ]; then
223+ PACKAGE_TO_BUILD="$packages" bash -x ./waydroid-build-wrapper.sh
224+ fi
200225 - name : Generate build artifacts
201226 if : always()
202227 run : |
228+ test -d tur/output && mv tur/output/* ./output/
203229 for repo in $(jq --raw-output '.[].name' repo.json); do
204230 # Put package lists into directory with *.deb files so they will be transferred to
205231 # upload job.
@@ -216,28 +242,30 @@ jobs:
216242 done
217243 # Files containing certain symbols (e.g. ":") will cause failure in actions/upload-artifact.
218244 # 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
245+ tar cf artifacts/debs-${{ matrix.target_arch }}-${{ github.sha }}.tar debs
221246 - name : Checksums for built *.deb files
222247 if : always()
223248 run : |
224249 find debs -type f -name "*.deb" -exec sha256sum "{}" \; | sort -k2
225250 - name : Store *.deb files
226251 if : always()
227- uses : actions/upload-artifact@v3
252+ uses : actions/upload-artifact@v4
228253 with :
229- name : debs-${{ matrix.target_arch.TERMUX_ARCH }}-${{ github.sha }}
254+ name : debs-${{ matrix.target_arch }}-${{ github.sha }}
230255 path : ./artifacts
256+ include-hidden-files : true
257+ overwrite : true
258+ compression-level : 0
231259
232260 upload :
233261 if : github.event_name != 'pull_request'
234262 needs : build
235263 runs-on : ubuntu-latest
236264 steps :
237265 - name : Clone repository
238- uses : actions/checkout@v3
266+ uses : actions/checkout@v4
239267 - name : Get *.deb files
240- uses : actions/download-artifact@v3
268+ uses : actions/download-artifact@v4
241269 with :
242270 path : ./
243271 - name : Upload to a temporary release
0 commit comments