field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | README | LICENSE

linux-shared-rust.sh (1581B)


      1 #!/usr/bin/env bash
      2 set -euo pipefail
      3 
      4 if [[ -z "${EXT_BUILD_RUN_ACTIVE:-}" || -z "${EXT_BUILD_PROJECT_DIR:-}" ]]; then
      5   echo "linux-shared-rust: run through cargo extbuild run --" >&2
      6   exit 1
      7 fi
      8 
      9 readonly SOURCE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
     10 readonly RUNNER_IMAGE="docker.io/library/rust:1.99.0-slim-trixie@sha256:2752b332db73fdbb7dc576f06c82ed1f312005784ef913d7e04a28f5f55dc581"
     11 readonly RUNNER_ROOT="$EXT_BUILD_PROJECT_DIR/linux-x86_64"
     12 readonly RUNNER_CARGO_HOME="$RUNNER_ROOT/cargo-home"
     13 readonly RUNNER_TARGET="$RUNNER_ROOT/target"
     14 
     15 command -v docker >/dev/null || {
     16   echo "linux-shared-rust: docker is unavailable" >&2
     17   exit 1
     18 }
     19 mkdir -p "$RUNNER_CARGO_HOME" "$RUNNER_TARGET"
     20 
     21 docker run --rm --init --platform linux/amd64 \
     22   --user "$(id -u):$(id -g)" \
     23   --volume "$SOURCE_ROOT:/workspace:ro" \
     24   --volume "$RUNNER_CARGO_HOME:/cargo-home" \
     25   --volume "$RUNNER_TARGET:/target" \
     26   --workdir /workspace \
     27   --env CARGO_HOME=/cargo-home \
     28   --env CARGO_TARGET_DIR=/target \
     29   "$RUNNER_IMAGE" \
     30   /bin/bash -c '
     31     set -euo pipefail
     32     [[ "$(uname -s)" == "Linux" ]]
     33     [[ "$(uname -m)" == "x86_64" ]]
     34     # Bound compiler and linker fan-out independently of runtime test concurrency.
     35     packages=(--jobs 1 -p tera_core -p tera_ffi -p tera_bindgen)
     36     cargo check "${packages[@]}" --all-targets --locked
     37     # Isolate test cases so emulated CPU work in other cases cannot consume
     38     # real relay deadlines. Concurrency exercised inside each case is retained.
     39     cargo test "${packages[@]}" --all-targets --locked -- --test-threads=1
     40   '