| 1 | name: CI Termux |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | push: |
| 6 | branches: |
| 7 | - master |
| 8 | paths-ignore: |
| 9 | - '**.md' |
| 10 | - '**.yml' |
| 11 | - '!**/termux_ci.yml' |
| 12 | - 'cmd/tools/**' |
| 13 | - '!cmd/tools/builders/**.v' |
| 14 | pull_request: |
| 15 | paths-ignore: |
| 16 | - '**.md' |
| 17 | - '**.yml' |
| 18 | - '!**/termux_ci.yml' |
| 19 | - 'cmd/tools/**' |
| 20 | - '!cmd/tools/builders/**.v' |
| 21 | |
| 22 | jobs: |
| 23 | termux-build: |
| 24 | runs-on: ubuntu-latest |
| 25 | timeout-minutes: 30 |
| 26 | steps: |
| 27 | - uses: actions/checkout@v6 |
| 28 | - name: Build and test in Termux |
| 29 | run: | |
| 30 | set -o xtrace |
| 31 | echo "$PWD" |
| 32 | whoami |
| 33 | touch outside_docker.txt |
| 34 | git log -n4 |
| 35 | echo "running docker ..." |
| 36 | docker run --rm --mount type=bind,source=/home/runner/work/v/v,destination=/src -w /src termux/termux-docker:latest bash -c ' |
| 37 | set -o xtrace |
| 38 | echo "running inside docker" |
| 39 | whoami |
| 40 | cp -r /src ~/vproject; cd ~/vproject |
| 41 | touch inside_docker.txt |
| 42 | ls -la |
| 43 | echo "previous TERMUX_VERSION: $TERMUX_VERSION" |
| 44 | export TERMUX_VERSION=0.118.3 |
| 45 | echo "explicit TERMUX_VERSION: $TERMUX_VERSION" |
| 46 | bash .github/workflows/retry.sh pkg update -y |
| 47 | bash .github/workflows/retry.sh pkg install -y clang libexecinfo libgc libgc-static make git |
| 48 | git log -n4 |
| 49 | VFLAGS="-cc cc" make |
| 50 | ./v symlink |
| 51 | export PATH="$HOME/.local/bin:/usr/local/bin:$PATH" |
| 52 | v run examples/hello_world.v |
| 53 | v run examples/primes.v |
| 54 | v -e "import os; dump( os.user_os() )" |
| 55 | ' |
| 56 | |
| 57 | termux-build-arm64-tcc: |
| 58 | # Diagnostic job for vlang/v#27207: reproduces the Termux/AArch64 tcc |
| 59 | # bootstrap failure on a real arm64 runner so we can collect logs without |
| 60 | # local hardware. Allowed to fail until the upstream tcc AArch64 bug is |
| 61 | # resolved. |
| 62 | runs-on: ubuntu-24.04-arm |
| 63 | continue-on-error: true |
| 64 | timeout-minutes: 45 |
| 65 | steps: |
| 66 | - uses: actions/checkout@v6 |
| 67 | - name: Build in Termux (arm64, default tcc) |
| 68 | run: | |
| 69 | set -o xtrace |
| 70 | uname -a |
| 71 | docker run --rm --platform=linux/arm64 --mount type=bind,source=/home/runner/work/v/v,destination=/src -w /src termux/termux-docker:aarch64 bash -c ' |
| 72 | set -o xtrace |
| 73 | uname -a |
| 74 | cp -r /src ~/vproject; cd ~/vproject |
| 75 | export TERMUX_VERSION=0.118.3 |
| 76 | bash .github/workflows/retry.sh pkg update -y |
| 77 | bash .github/workflows/retry.sh pkg install -y clang libexecinfo libgc libgc-static make git gdb file |
| 78 | git log -n4 |
| 79 | ulimit -c unlimited || true |
| 80 | # Explicit `-cc tcc` is required: on Linux arm64 the Makefile |
| 81 | # otherwise injects `-cc "$(CC)"` (see GNUmakefile:149-155) and |
| 82 | # the bundled tcc path would never run — defeating the purpose |
| 83 | # of this diagnostic job for #27207. Capture every invocation |
| 84 | # via -showcc and the full build output to build.log. |
| 85 | set +e |
| 86 | VFLAGS="-cc tcc -showcc -stats" make 2>&1 | tee build.log |
| 87 | rc=${PIPESTATUS[0]} |
| 88 | set -e |
| 89 | echo "make exit code: $rc" |
| 90 | # Always copy the log back to the bind-mounted dir so the runner |
| 91 | # step that uploads the artifact can find it. |
| 92 | cp build.log /src/build.log || true |
| 93 | if [ "$rc" -ne 0 ] || [ ! -x ./v ]; then |
| 94 | echo "===== bootstrap failed; collecting diagnostics =====" |
| 95 | echo "--- tcc binary ---" |
| 96 | ls -la thirdparty/tcc/ 2>/dev/null || true |
| 97 | for t in thirdparty/tcc/tcc.exe thirdparty/tcc/tcc; do |
| 98 | if [ -x "$t" ]; then "$t" -v || true; fi |
| 99 | done |
| 100 | echo "--- last 120 lines of build.log ---" |
| 101 | tail -n 120 build.log || true |
| 102 | echo "--- v1/v2/v file info ---" |
| 103 | file v1 v2 v 2>/dev/null || true |
| 104 | echo "--- last tcc invocations from build.log ---" |
| 105 | grep -E "tcc(\.exe)? " build.log | tail -n10 || true |
| 106 | echo "--- core files (if any) ---" |
| 107 | ls -la core* 2>/dev/null || true |
| 108 | for c in core core.*; do |
| 109 | if [ -f "$c" ] && [ -x ./v2 ]; then |
| 110 | echo "--- gdb backtrace from $c against v2 ---" |
| 111 | gdb --batch --ex bt --ex "info registers" ./v2 "$c" || true |
| 112 | fi |
| 113 | done |
| 114 | # If make exited 0 but ./v is missing, force a nonzero exit so |
| 115 | # the diagnostic job does not go green without a usable compiler. |
| 116 | if [ "$rc" -eq 0 ]; then rc=1; fi |
| 117 | exit "$rc" |
| 118 | fi |
| 119 | echo "===== bootstrap succeeded =====" |
| 120 | ./v -version |
| 121 | ./v run examples/hello_world.v |
| 122 | ' |
| 123 | - name: Upload build log |
| 124 | if: always() |
| 125 | uses: actions/upload-artifact@v7 |
| 126 | with: |
| 127 | name: termux-arm64-build-log |
| 128 | path: build.log |
| 129 | if-no-files-found: ignore |
| 130 | |