|
70 | 70 | name: 3code-termux-arm64 |
71 | 71 | path: 3code-termux-arm64.tar.gz |
72 | 72 |
|
| 73 | + smoke: |
| 74 | + # Run the cross-built binary inside an emulated Termux (qemu-aarch64 |
| 75 | + # + bionic, provided by termux/termux-docker). The x86 runner can't |
| 76 | + # execute the binary natively, so this container is the only way to |
| 77 | + # catch startup failures (dlopen paths, tmpdir, TLS) without a phone. |
| 78 | + needs: build |
| 79 | + runs-on: ubuntu-22.04 |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + - uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + name: 3code-termux-arm64 |
| 85 | + |
| 86 | + - name: Smoke test in emulated Termux |
| 87 | + run: | |
| 88 | + set -e |
| 89 | + tar xzf 3code-termux-arm64.tar.gz |
| 90 | + # The image's Termux tree is owned by uid/gid 1000 (system); run |
| 91 | + # the container as that user so pkg and $HOME behave. |
| 92 | + CID=$(docker create -t --platform linux/arm64 --user 1000:1000 \ |
| 93 | + termux/termux-docker:latest sleep 900) |
| 94 | + docker start $CID >/dev/null |
| 95 | + trap 'docker rm -f $CID >/dev/null 2>&1 || true' EXIT |
| 96 | + docker exec $CID mkdir -p /data/data/com.termux/files/usr/tmp |
| 97 | + docker cp 3code-termux-arm64/3code $CID:/data/data/com.termux/files/usr/tmp/3code |
| 98 | + docker exec -t -e THREECODE_ALLOW_ROOT=1 $CID \ |
| 99 | + /data/data/com.termux/files/usr/tmp/3code --version |
| 100 | + # --help exits 2 (ExitUsage) by design; assert it runs at all. |
| 101 | + docker exec -t -e THREECODE_ALLOW_ROOT=1 $CID sh -c \ |
| 102 | + '/data/data/com.termux/files/usr/tmp/3code --help > /dev/null; \ |
| 103 | + test $? -eq 2' |
| 104 | + # TLS init is the fragile part on Termux: the openssl wrapper |
| 105 | + # dlopens libssl.so.3/libcrypto.so.3 at module init, and it only |
| 106 | + # works when DT_RUNPATH (asserted in the build job) points at the |
| 107 | + # Termux lib dir. A bare --version doesn't touch TLS; this tiny |
| 108 | + # program does a verified handshake the same way api.nim does. |
| 109 | + docker cp tests/android_tlscheck.nim $CID:/data/data/com.termux/files/usr/tmp/ |
| 110 | + docker exec -t $CID sh -lc \ |
| 111 | + 'command -v nim >/dev/null || pkg install -y nim >/dev/null 2>&1; \ |
| 112 | + nim c -r -d:ssl /data/data/com.termux/files/usr/tmp/android_tlscheck.nim' \ |
| 113 | + | grep -q 'tls handshake ok' |
| 114 | +
|
73 | 115 | - name: Upload artifact to 3code.capocasa.dev |
74 | 116 | if: github.ref == 'refs/heads/main' |
75 | 117 | run: | |
|
0 commit comments