Skip to content

Commit efa45ec

Browse files
committed
build termux gitlab-ci
1 parent 3ede464 commit efa45ec

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/build-termux.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build for Termux
2+
3+
# https://github.com/robertkirkman/termux-on-gha/blob/master/.github/workflows/build-and-test.yml
4+
# https://github.com/termux/termux-docker/issues/64
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- build-termux
11+
- build-termux-orig-deps
12+
13+
jobs:
14+
working:
15+
strategy:
16+
matrix:
17+
include:
18+
- runner: ubuntu-24.04-arm
19+
architecture: aarch64
20+
runs-on: ${{ matrix.runner }}
21+
# prepare writable volume prefix mount for actions/upload-artifact,
22+
# based on the higher-profile workaround for 32-bit GNU/Linux containers explained here
23+
# https://github.com/actions/upload-artifact/issues/616#issuecomment-2350667347
24+
container:
25+
image: termux/termux-docker:${{ matrix.architecture }}
26+
volumes:
27+
- /tmp/node20:/__e/node20
28+
29+
# approximate environment variables for actions that can't be forced to use entrypoint.sh
30+
env:
31+
TERMUX_MAIN_PACKAGE_FORMAT: debian
32+
ANDROID_ROOT: /system
33+
ANDROID_DATA: /data
34+
PREFIX: /data/data/com.termux/files/usr
35+
HOME: /data/data/com.termux/files/home
36+
PATH: /data/data/com.termux/files/usr/bin
37+
TMPDIR: /data/data/com.termux/files/usr/tmp
38+
LANG: en_US.UTF-8
39+
TZ: UTC
40+
steps:
41+
- name: set pkg command to use the packages-cf.termux.dev mirror
42+
run: ln -sf ${PREFIX}/etc/termux/mirrors/default ${PREFIX}/etc/termux/chosen_mirrors
43+
- name: upgrade all packages to prepare for installing nodejs
44+
run: /entrypoint.sh bash -c "yes | pkg upgrade -y"
45+
# actions/checkout will "think" that termux's tar binary isn't executable if it doesn't have
46+
# executable bit actually set for all users, since even though that permissions restriction
47+
# doesn't actually apply to the root user (at least on Android), GitHub Actions' internal
48+
# source code doesn't "care" and would refuse to run the binary anyway.
49+
# relevant internal source code of GitHub Actions:
50+
# https://github.com/actions/toolkit/blob/930c89072712a3aac52d74b23338f00bb0cfcb24/packages/io/src/io-util.ts#L167-L177
51+
- name: fix executable bit for all binaries in $PREFIX/bin for all users
52+
run: chmod -R o+x ${PREFIX}/bin
53+
- name: install bionic-libc nodejs to force compatibility with actions/checkout and actions/upload-artifact
54+
run: |
55+
/entrypoint.sh pkg install -y nodejs-lts
56+
ln -sf ${PREFIX}/bin /__e/node20/bin
57+
- uses: actions/checkout@v4.2.2
58+
- name: fix permissions of repository after actions/checkout, which ran as root user, while entrypoint.sh activates system user (1000)
59+
run: chown -R 1000:1000 .
60+
- name: setup
61+
run: |
62+
# pkg/pip need to be prefixed with /entrypoint.sh because GHA overrode
63+
# the entrypoint.
64+
/entrypoint.sh pkg install -y rust
65+
/entrypoint.sh pkg install -y protobuf
66+
/entrypoint.sh pkg install -y tar gzip
67+
- name: build
68+
run: |
69+
/entrypoint.sh cargo check
70+
/entrypoint.sh cargo build --release
71+
cd target/release
72+
zip -r goose-termux.zip goose goosed mcp-server generate_schema
73+
74+
- name: Upload CLI artifact
75+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # pin@v4
76+
with:
77+
name: goose-${{ matrix.architecture }}-termux
78+
path: target/release/goose-termux.zip
79+
80+
# build:
81+
# runs-on: ubuntu-latest # Or another suitable runner
82+
# container: termux/termux-docker:latest # Use the termux-docker image
83+
# steps:
84+
# - name: Checkout code
85+
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
86+
# with:
87+
# ref: ${{ inputs.ref }}
88+
# fetch-depth: 0
89+
# - name: Build with Cargo for Termux
90+
# run: |
91+
# pkg install -y build-essential cargo
92+
# echo "123"
93+
# cargo build --release

0 commit comments

Comments
 (0)