ethercat-linux/vendor/ethercrab/.circleci/config.yml

280 lines
8.6 KiB
YAML
Raw Normal View History

target_steps_linux: &target_steps_linux
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
# - image: cimg/rust:1.85
- image: cimg/base:2025.11
steps:
- checkout
- restore_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
# cimg/rust at time of writing STILL uses Ubuntu 22.04 which doesn't have `libxdp-dev`, so I'm
# manually building the Rust image on top of `cimg/base`. Command is from here:
# https://github.com/CircleCI-Public/cimg-rust/blob/0401fb8e667e051f00d605987d66c799f4b62fc1/1.87/Dockerfile
- run: |
echo "${PATH}"
[[ $(uname -m) == "x86_64" ]] && ARCH="x86_64" || ARCH="aarch64" && \
curl -O https://static.rust-lang.org/rustup/dist/${ARCH}-unknown-linux-gnu/rustup-init && \
chmod +x rustup-init && \
./rustup-init -y
echo 'export PATH=/home/circleci/.cargo/bin:"$PATH"' >> "$BASH_ENV"
# For docs gen
- run: rustup target add x86_64-unknown-linux-gnu || true
# For XDP
- run:
sudo apt update && sudo apt install -qq clang llvm-dev libxdp-dev musl-tools musl musl-dev
build-essential linux-libc-dev
- run: |
binaries=( "cargo-deadlinks" "cargo-readme" "just" )
for binary in "${binaries[@]}"
do
echo "Checking for $binary"
if ! type "$binary" > /dev/null; then
echo "--> $binary is not installed. Installing..."
cargo install "$binary" --target x86_64-unknown-linux-gnu --locked
else
echo "--> $binary already installed"
fi
done
- run: rustup target add $TARGET || true
- run: cargo fmt --all -- --check
- run: just check-readmes
- run: cargo test --target $TARGET --workspace
- run: cargo bench --workspace --no-run --target $TARGET
- run: cargo build --target $TARGET --examples --release
- run: cargo build --target $TARGET --no-default-features
- run: cargo build --target $TARGET --features xdp
- run: cargo deadlinks --ignore-fragments
- save_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
- /home/circleci/.cargo/registry
- /home/circleci/.cargo/bin
target_steps_linux_musl: &target_steps_linux_musl
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
# - image: cimg/rust:1.85
- image: cimg/rust:1.91
steps:
- checkout
- restore_cache:
key: v1-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: rustup target add $TARGET || true
- run: cargo test --target $TARGET --workspace
- run: cargo bench --workspace --no-run --target $TARGET
- run: cargo build --target $TARGET --examples --release
- run: cargo build --target $TARGET --no-default-features
- save_cache:
key: v1-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
- /home/circleci/.cargo/registry
- /home/circleci/.cargo/bin
miri_steps: &miri_steps
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
- image: cimg/rust:1.85
steps:
- checkout
- run: sudo apt update && sudo apt install -y libpcap-dev
# MIRI really hates cached `heapless` for some reason
# - restore_cache:
# key: v15-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
# Arbitrary nightly version - just the latest at time of writing. This should match that in the
# Justfile
- run:
rustup toolchain add nightly-2025-03-29 --target aarch64-unknown-linux-gnu --component
miri,rust-src
- run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ~/.local/bin
- run:
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to
~/.local/bin
- run: just miri-nextest
# - save_cache:
# key: v15-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
# paths:
# - ./target
target_steps_no_std: &target_steps_no_std
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
- image: cimg/rust:1.85
steps:
- checkout
- restore_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: rustup target add $TARGET || true
- run: cargo build --target $TARGET --no-default-features --release
- run: cargo build --target $TARGET --no-default-features --release --features defmt
- save_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
target_steps_linux_no_io_uring: &target_steps_linux_no_io_uring
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
- image: cimg/rust:1.85
steps:
- checkout
- restore_cache:
key: v1-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: rustup target add armv7-unknown-linux-gnueabi
- run: |
cargo build --target armv7-unknown-linux-gnueabi --no-default-features --release --features std
- save_cache:
key: v1-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
target_steps_embassy: &target_steps_embassy
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
- image: cimg/rust:1.85
steps:
- checkout
- restore_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: |
cd examples/embassy-stm32
cargo build --release
- save_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
- /home/circleci/.cargo/registry
basic_steps: &basic_steps
resource_class: large
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
- image: cimg/rust:1.85
steps:
- checkout
- restore_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: rustup target add $TARGET
- run: cargo test
- run: cargo check --target $TARGET --release --examples
- save_cache:
key: v8-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
- /home/circleci/.cargo/registry
version: 2
jobs:
target-x86_64-unknown-linux-gnu:
resource_class: large
environment:
- TARGET: "x86_64-unknown-linux-gnu"
<<: *target_steps_linux
target-x86_64-unknown-linux-musl:
resource_class: large
environment:
- TARGET: "x86_64-unknown-linux-musl"
<<: *target_steps_linux_musl
miri:
resource_class: large
<<: *miri_steps
windows-cross:
environment:
- TARGET: "x86_64-pc-windows-gnu"
resource_class: large
docker:
# NOTE: Exact version is overridden in `rust-toolchain.toml`
- image: cimg/rust:1.85
steps:
- checkout
- restore_cache:
key: v4-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
- run: rustup target add $TARGET
# For Windows
- run: sudo apt update && sudo apt install -y mingw-w64
# FIXME: change to "build" when possible. Currently fails with a link error about "-lPacket"
# for libpcap on Windows. A bit of a dead end here: https://github.com/libpnet/libpnet/issues/479
- run: cargo check --target $TARGET --release --examples
- save_cache:
key: v4-ethercrab-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.toml" }}
paths:
- ./target
- /home/circleci/.cargo/registry
macos-cross:
environment:
- TARGET: "x86_64-apple-darwin"
<<: *basic_steps
macos-arm-cross:
environment:
- TARGET: "aarch64-apple-darwin"
<<: *basic_steps
freebsd:
environment:
- TARGET: "x86_64-unknown-freebsd"
<<: *basic_steps
netbsd:
environment:
- TARGET: "x86_64-unknown-netbsd"
<<: *basic_steps
target-thumbv7m-none-eabi:
resource_class: large
environment:
- TARGET: "thumbv7m-none-eabi"
<<: *target_steps_no_std
target-embassy:
resource_class: large
<<: *target_steps_embassy
target-linux-32bit:
resource_class: large
<<: *target_steps_linux_no_io_uring
build_jobs: &build_jobs
jobs:
- target-x86_64-unknown-linux-gnu
- target-x86_64-unknown-linux-musl
- target-linux-32bit
- miri
- windows-cross
- macos-cross
- macos-arm-cross
- freebsd
- netbsd
- target-thumbv7m-none-eabi
- target-embassy
workflows:
version: 2
build_all:
<<: *build_jobs