build termux #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build for Termux | |
| # https://github.com/robertkirkman/termux-on-gha/blob/master/.github/workflows/build-and-test.yml | |
| # https://github.com/termux/termux-docker/issues/64 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - build-termux | |
| jobs: | |
| working: | |
| strategy: | |
| matrix: | |
| include: | |
| - runner: ubuntu-24.04-arm | |
| architecture: aarch64 | |
| runs-on: ${{ matrix.runner }} | |
| # prepare writable volume prefix mount for actions/upload-artifact, | |
| # based on the higher-profile workaround for 32-bit GNU/Linux containers explained here | |
| # https://github.com/actions/upload-artifact/issues/616#issuecomment-2350667347 | |
| container: | |
| image: termux/termux-docker:${{ matrix.architecture }} | |
| volumes: | |
| - /tmp/node20:/__e/node20 | |
| # approximate environment variables for actions that can't be forced to use entrypoint.sh | |
| env: | |
| TERMUX_MAIN_PACKAGE_FORMAT: debian | |
| ANDROID_ROOT: /system | |
| ANDROID_DATA: /data | |
| PREFIX: /data/data/com.termux/files/usr | |
| HOME: /data/data/com.termux/files/home | |
| PATH: /data/data/com.termux/files/usr/bin | |
| TMPDIR: /data/data/com.termux/files/usr/tmp | |
| LANG: en_US.UTF-8 | |
| TZ: UTC | |
| steps: | |
| - name: set pkg command to use the packages-cf.termux.dev mirror | |
| run: ln -sf ${PREFIX}/etc/termux/mirrors/default ${PREFIX}/etc/termux/chosen_mirrors | |
| - name: upgrade all packages to prepare for installing nodejs | |
| run: /entrypoint.sh bash -c "yes | pkg upgrade -y" | |
| # actions/checkout will "think" that termux's tar binary isn't executable if it doesn't have | |
| # executable bit actually set for all users, since even though that permissions restriction | |
| # doesn't actually apply to the root user (at least on Android), GitHub Actions' internal | |
| # source code doesn't "care" and would refuse to run the binary anyway. | |
| # relevant internal source code of GitHub Actions: | |
| # https://github.com/actions/toolkit/blob/930c89072712a3aac52d74b23338f00bb0cfcb24/packages/io/src/io-util.ts#L167-L177 | |
| - name: fix executable bit for all binaries in $PREFIX/bin for all users | |
| run: chmod -R o+x ${PREFIX}/bin | |
| - name: install bionic-libc nodejs to force compatibility with actions/checkout and actions/upload-artifact | |
| run: | | |
| /entrypoint.sh pkg install -y nodejs-lts | |
| ln -sf ${PREFIX}/bin /__e/node20/bin | |
| - uses: actions/checkout@v4.2.2 | |
| - name: fix permissions of repository after actions/checkout, which ran as root user, while entrypoint.sh activates system user (1000) | |
| run: chown -R 1000:1000 . | |
| - name: setup | |
| run: | | |
| # pkg/pip need to be prefixed with /entrypoint.sh because GHA overrode | |
| # the entrypoint. | |
| /entrypoint.sh pkg install -y rust | |
| /entrypoint.sh pkg install -y protobuf | |
| /entrypoint.sh pkg install -y tar gzip | |
| - name: build | |
| run: | | |
| /entrypoint.sh cargo check | |
| /entrypoint.sh cargo build --release | |
| # Create the zip archive with all binaries and DLLs | |
| tar zcf goose-termux.tar.gz -C target/release/ goose goosed mcp-server generate_schema | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # pin@v4 | |
| with: | |
| name: goose-${{ matrix.architecture }}-termux | |
| path: goose-termux.tar.gz | |
| # build: | |
| # runs-on: ubuntu-latest # Or another suitable runner | |
| # container: termux/termux-docker:latest # Use the termux-docker image | |
| # steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4 | |
| # with: | |
| # ref: ${{ inputs.ref }} | |
| # fetch-depth: 0 | |
| # - name: Build with Cargo for Termux | |
| # run: | | |
| # pkg install -y build-essential cargo | |
| # echo "123" | |
| # cargo build --release |