Skip to content

Commit 7d0d365

Browse files
committed
ci
1 parent 75bd16c commit 7d0d365

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

‎.github/workflows/release-cli-rs.yml‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
include:
28-
# The Linux builds need the runner's glibc, 2.35, or newer.
29-
- { runner: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
30-
- { runner: ubuntu-22.04-arm, target: aarch64-unknown-linux-gnu }
28+
# Zig links Linux against glibc 2.17, OpenTUI's floor. zig_sha is the archive's, from ziglang.org.
29+
- runner: ubuntu-24.04
30+
target: x86_64-unknown-linux-gnu
31+
zig: x86_64-linux-gnu.2.17
32+
zig_sha: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a
33+
- runner: ubuntu-24.04-arm
34+
target: aarch64-unknown-linux-gnu
35+
zig: aarch64-linux-gnu.2.17
36+
zig_sha: a1546d5646eb184437918d6635ca6b762a0e889eac09cef720ee7a1ed3fe7795
3137
- { runner: macos-15-intel, target: x86_64-apple-darwin }
3238
- { runner: macos-15, target: aarch64-apple-darwin }
3339
- { runner: windows-2025, target: x86_64-pc-windows-msvc, exe: .exe }
@@ -56,14 +62,40 @@ jobs:
5662
version=0.0.0-$GITHUB_SHA
5763
if [[ $GITHUB_REF == refs/tags/cli-rs-v* ]]; then version=${GITHUB_REF_NAME#cli-rs-v}; fi
5864
echo "OPENCODE_VERSION=$version" >> "$GITHUB_ENV"
65+
# Zig 0.17.1 as the C and C++ compiler and the linker. The wrapper drops flags zig rejects: cc's --target, and
66+
# rustc's Cortex-A53 erratum fix on aarch64.
67+
- if: matrix.zig
68+
working-directory: ${{ runner.temp }}
69+
run: |
70+
file=zig-$(uname -m)-linux-0.17.1
71+
curl -fsSL --retry 3 -o zig.tar.xz "https://ziglang.org/download/0.17.1/$file.tar.xz"
72+
echo "${{ matrix.zig_sha }} zig.tar.xz" | sha256sum -c
73+
tar -xJf zig.tar.xz
74+
for tool in cc c++; do
75+
cat > "zig-$tool" <<EOF
76+
#!/bin/sh
77+
for a; do shift; case \$a in --target=*|-Wl,--fix-cortex-a53-843419) ;; *) set -- "\$@" "\$a" ;; esac; done
78+
exec "$PWD/$file/zig" $tool -target ${{ matrix.zig }} "\$@"
79+
EOF
80+
chmod +x "zig-$tool"
81+
done
82+
triple=$(tr a-z- A-Z_ <<< "${{ matrix.target }}")
83+
{ echo "CARGO_TARGET_${triple}_LINKER=$PWD/zig-cc"; echo "CC_${triple,,}=$PWD/zig-cc"
84+
echo "CXX_${triple,,}=$PWD/zig-c++"; echo "CXXSTDLIB_${triple,,}=c++"; } >> "$GITHUB_ENV"
5985
# rustup reads rust-toolchain.toml; `bun run cargo` first fetches OpenTUI's native library from its release.
6086
- run: rustup toolchain install
6187
- run: bun run cargo build --locked --profile dist --bin opencode-native
88+
- name: Check glibc 2.17 and no libstdc++
89+
if: matrix.zig
90+
run: "! readelf -dV target/dist/opencode-native | grep -E 'GLIBC_2\\.(1[89]|[2-9][0-9])|libstdc\\+\\+'"
6291
- name: Package
6392
run: |
6493
name=opencode-native-$OPENCODE_VERSION-${{ matrix.target }}
6594
mkdir -p "dist/$name"
6695
cp "target/dist/opencode-native${{ matrix.exe }}" "dist/$name/"
96+
# Our licence, and OpenTUI's licences (FFmpeg's among them) from its native release zip.
97+
cp ../../LICENSE "dist/$name/"
98+
cp -r .opentui/*/host/licenses "dist/$name/"
6799
tar -C dist -czf "dist/$name.tar.gz" "$name"
68100
ls -l "dist/$name" "dist/$name.tar.gz"
69101
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

0 commit comments

Comments
 (0)