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 (1489B)


      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.97.1-slim-trixie@sha256:fc0648ac2962539be80bd424729a20fd80f7b64bfba7e90bbd642aed6c697c5a"
     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     packages=(-p tera_core -p tera_ffi -p tera_bindgen)
     35     cargo check "${packages[@]}" --all-targets --locked
     36     # Isolate test cases so emulated CPU work in other cases cannot consume
     37     # real relay deadlines. Concurrency exercised inside each case is retained.
     38     cargo test "${packages[@]}" --all-targets --locked -- --test-threads=1
     39   '