Skip to content

chore(workflow): remove MuJoCo instllation and rebuilding crate, base… #255

chore(workflow): remove MuJoCo instllation and rebuilding crate, base…

chore(workflow): remove MuJoCo instllation and rebuilding crate, base… #255

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: ['main', 'v*']
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: ['stable', 'nightly']
arch: ['x86_64', 'aarch64']
steps:
- uses: actions/checkout@v5
- run: |
rustup update
rustup default ${{ matrix.toolchain }}
rustup target add ${{ matrix.arch }}-unknown-linux-gnu
rustup component add rustfmt ### required for the build script to work ###
[ "${{ matrix.arch }}" = 'aarch64' ] && sudo apt update && sudo apt install -y g++-aarch64-linux-gnu || :
- name: build fails without mujoco
env:
CARGO_BUILD_TARGET: ${{ matrix.arch }}-unknown-linux-gnu
run: |
if cargo build; then
echo 'cargo build **unexpectedly** succeeded without mujoco.'
exit 1
else
echo 'cargo build failed as expected without mujoco.'
fi
- name: install mujoco
run: |
mkdir -p $HOME/.mujoco
cd $HOME/.mujoco
wget https://github.com/google-deepmind/mujoco/releases/download/3.3.2/mujoco-3.3.2-linux-${{ matrix.arch }}.tar.gz
tar -xzf mujoco-3.3.2-linux-${{ matrix.arch }}.tar.gz
- name: build succeeds with MUJOCO_LIB
env:
CARGO_BUILD_TARGET: ${{ matrix.arch }}-unknown-linux-gnu
run: |
export MUJOCO_LIB="$HOME/.mujoco/mujoco-3.3.2/lib"
cargo clean ### clean up the build cache to assure the build script is re-run ###
cargo build
cargo build --features bindgen
git diff --exit-code ./src/bindgen.rs || (echo "bindgen.rs changed after build with bindgen feature."; exit 1)
- name: build succeeds using system mujoco without MUJOCO_LIB
env:
CARGO_BUILD_TARGET: ${{ matrix.arch }}-unknown-linux-gnu
run: |
sudo cp $HOME/.mujoco/mujoco-3.3.2/lib/libmujoco.so /usr/local/lib/
sudo ldconfig
cargo clean ### clean up the build cache to assure the build script is re-run ###
cargo build
cargo build --features bindgen
git diff --exit-code ./src/bindgen.rs || (echo "bindgen.rs changed after build with bindgen feature."; exit 1)
test:
strategy:
matrix:
toolchain: ['stable', 'nightly']
os: ['ubuntu-24.04', 'ubuntu-24.04-arm']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: setup Rust
run: |
rustup update
rustup default ${{ matrix.toolchain }}
rustup component add rustfmt ### required for the build script to work ###
- name: setup MuJoCo
run: |
if [ "${{ matrix.os }}" = 'ubuntu-24.04' ]; then
MUJOCO_FILENAME='mujoco-3.3.2-linux-x86_64.tar.gz'
elif [ "${{ matrix.os }}" = 'ubuntu-24.04-arm' ]; then
MUJOCO_FILENAME='mujoco-3.3.2-linux-aarch64.tar.gz'
fi
mkdir -p $HOME/.mujoco && cd $HOME/.mujoco
wget https://github.com/google-deepmind/mujoco/releases/download/3.3.2/$MUJOCO_FILENAME
tar -xzf $MUJOCO_FILENAME
### Set `MUJOCO_LIB` and `LD_LIBRARY_PATH` for the test jobs ###
echo "MUJOCO_LIB=$HOME/.mujoco/mujoco-3.3.2/lib" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/.mujoco/mujoco-3.3.2/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: setup additional dependencies for examples
run: |
git clone https://github.com/glfw/glfw.git
mkdir -p glfw/build && cd glfw/build
sudo apt update && sudo apt install -y cmake build-essential libwayland-dev libxkbcommon-x11-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
cmake .. && make && sudo make install
- name: run tests
run: |
cargo test --lib
cargo test --doc
cargo test --tests
cargo test --benches
cargo test --examples