Skip to content

Build static binaries (PRoot) #28

Build static binaries (PRoot)

Build static binaries (PRoot) #28

name: Build static binaries (PRoot)
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 0'
jobs:
build-binaries:
name: Compile static termux packages
runs-on: ubuntu-latest
steps:
- name: Checkout project code
uses: actions/checkout@v5
- name: Grant execute permission to builder script
run: chmod +x tools/proot-builder/build_static.sh
- name: Run Compilation (this will take awhile)
run: |
./tools/proot-builder/build_static.sh --rebuild-all \
--build-dir ${{ github.workspace }}/termux-build \
--out-dir ${{ github.workspace }}/termux-artifacts
- name: Save artifacts to GitHub panel
uses: actions/upload-artifact@v6
with:
name: termux-ninja-binaries
path: ${{ github.workspace }}/termux-artifacts/
# Gate: run the binary contract/smoke tests on the freshly built bundle.
# arm64-v8a runs natively on the ARM runner (faithful proot launch); the
# 32-bit arch is emulated via QEMU (proot is version-only there). A failure
# here blocks the publish job below, so a broken rebuild is never released.
smoke-test:
name: Smoke/contract test (ADFA-4465)
needs: build-binaries
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout project code
uses: actions/checkout@v5
- name: Download freshly built binaries
uses: actions/download-artifact@v7
with:
name: termux-ninja-binaries
path: ${{ github.workspace }}/artifacts
- name: Tools for the proot launch + emulation fallback
run: |
sudo apt-get update -qq
sudo apt-get install -y binutils qemu-user-static binfmt-support
chmod +x tools/proot-builder/smoke-native-binaries.sh
- name: Register binfmt (QEMU) for foreign-arch binaries
uses: docker/setup-qemu-action@v4
- name: Contract test — arm64-v8a (native)
run: ./tools/proot-builder/smoke-native-binaries.sh --jnilibs "${{ github.workspace }}/artifacts" --arch arm64-v8a
- name: Contract test — armeabi-v7a (emulated)
run: ./tools/proot-builder/smoke-native-binaries.sh --jnilibs "${{ github.workspace }}/artifacts" --arch armeabi-v7a
publish:
name: Publish rolling release
needs: [build-binaries, smoke-test]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download built binaries
uses: actions/download-artifact@v7
with:
name: termux-ninja-binaries
path: ${{ github.workspace }}/termux-artifacts
- name: Zip binaries for release distribution
run: |
cd ${{ github.workspace }}/termux-artifacts
zip -r ../termux-binaries-latest.zip .
- name: Generate dynamic tag (date & time)
run: echo "TAG_NAME=binaries-$(date +'%Y-%m-%d_%H-%M')" >> $GITHUB_ENV
- name: Publish rolling release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.TAG_NAME }}
name: "Static binaries [${{ env.TAG_NAME }}]"
body: "Automated rolling build of static PRoot and utilities. Passed the native-binary contract/smoke gate (ADFA-4465)."
files: ${{ github.workspace }}/termux-binaries-latest.zip
prerelease: true
- name: Cleanup old binaries releases (keep last 6)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Replaces dev-drprasad/delete-older-releases (Node 20). Keep the 6 newest
# binaries-* releases; delete older ones (release + its tag) via gh CLI.
gh release list --repo "$GITHUB_REPOSITORY" --limit 200 \
--json tagName,createdAt --jq 'sort_by(.createdAt) | reverse | .[].tagName' \
| grep '^binaries-' \
| tail -n +7 \
| while read -r tag; do
echo "Deleting old release + tag: $tag"
gh release delete "$tag" --repo "$GITHUB_REPOSITORY" --cleanup-tag --yes
done