Skip to content

Commit a515ad5

Browse files
authored
Containerize pixi in CI (#99)
* Containerize pixi ci * Remove sourcing from test steps * Remove the test pixi fix * Minor tweak to docs
1 parent e8f5767 commit a515ad5

File tree

5 files changed

+52
-27
lines changed

5 files changed

+52
-27
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,40 @@ jobs:
7474
steps:
7575
- name: Check out repository
7676
uses: actions/checkout@v6
77-
- name: Cache build directories and sccache
78-
uses: actions/cache@v5
77+
- name: Set up Docker Buildx
78+
uses: docker/setup-buildx-action@v3
79+
- name: Build Docker image
80+
uses: docker/build-push-action@v5
81+
with:
82+
context: .
83+
file: docker/Dockerfile.pixi
84+
push: false
85+
load: true
86+
tags: mujoco_ros2_control_pixi:ci
87+
cache-from: type=gha
88+
cache-to: type=gha,mode=max
89+
- name: Cache sccache
90+
uses: actions/cache@v4
7991
with:
8092
path: |
8193
${{ env.SCCACHE_DIR }}
8294
key: ${{ runner.os }}-sccache-${{ github.head_ref || github.ref_name }}
8395
restore-keys: |
8496
${{ runner.os }}-sccache-main
8597
${{ runner.os }}-sccache-
86-
- uses: prefix-dev/[email protected]
87-
with:
88-
cache: true
89-
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
90-
frozen: true
91-
manifest-path: pixi.toml
92-
- name: Build and test
98+
# Run pixi jobs, and ensure the cache is world readable.
99+
- name: Build and test in container
93100
run: |
94-
pixi run setup-colcon
95-
pixi run build
96-
pixi run test
97-
pixi run test-result
101+
docker run --rm \
102+
-v ${{ github.workspace }}:/workspace \
103+
-v ${{ github.workspace }}/.sccache:/workspace/.sccache \
104+
-w /workspace \
105+
-e SCCACHE_DIR=/workspace/.sccache \
106+
mujoco_ros2_control_pixi:ci \
107+
bash -c "
108+
pixi run setup-colcon && \
109+
pixi run build && \
110+
pixi run test && \
111+
pixi run test-result && \
112+
chmod -R a+rwX /workspace/.sccache
113+
"

docker/Dockerfile.pixi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Provides a raw 24.04 image in which to test the pixi install.
2+
FROM ubuntu:24.04
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
RUN apt-get update && apt-get install -y \
7+
curl \
8+
git \
9+
build-essential \
10+
ca-certificates \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
RUN curl -fsSL https://pixi.sh/install.sh | bash
14+
ENV PATH="/root/.pixi/bin:${PATH}"
15+
16+
WORKDIR /workspace
17+
18+
CMD ["/bin/bash"]

mujoco_ros2_control/docs/DEVELOPMENT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ To run ensure pixi is installed.
1313
Then,
1414

1515
```bash
16+
# Install the environment
17+
pixi install --frozen
18+
1619
# Setup the build environment
1720
pixi run setup-colcon
1821

mujoco_ros2_control_tests/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,28 @@ if(BUILD_TESTING)
1717

1818
find_package(launch_testing_ament_cmake REQUIRED)
1919

20-
# It is unclear why, but ctest in github action runners doesn't seem to correctly inherit
21-
# the PYTHONPATH from `install/setup.bash`. So we provide the exact path to ensure these are
22-
# locatable in CI.
23-
set(test_pythonpath "$ENV{PYTHONPATH}")
24-
file(TO_CMAKE_PATH "${test_pythonpath}" test_pythonpath)
25-
2620
add_launch_test(test/robot_launch_test.py
2721
TIMEOUT 50
28-
APPEND_ENV "PYTHONPATH=${test_pythonpath}"
2922
)
3023

3124
add_launch_test(test/robot_launch_pid_test.py
3225
TIMEOUT 50
33-
APPEND_ENV "PYTHONPATH=${test_pythonpath}"
3426
)
3527

3628
add_launch_test(test/robot_launch_mjcf_generation_test.py
3729
TIMEOUT 50
38-
APPEND_ENV "PYTHONPATH=${test_pythonpath}"
3930
)
4031

4132
add_launch_test(test/robot_launch_mjcf_generation_from_robot_description_test.py
4233
TIMEOUT 50
43-
APPEND_ENV "PYTHONPATH=${test_pythonpath}"
4434
)
4535

4636
add_launch_test(test/robot_launch_transmission_test.py
4737
TIMEOUT 50
48-
APPEND_ENV "PYTHONPATH=${test_pythonpath}"
4938
)
5039

5140
add_launch_test(test/robot_launch_transmission_pid_test.py
5241
TIMEOUT 50
53-
APPEND_ENV "PYTHONPATH=${test_pythonpath}"
5442
)
5543
endif()
5644

pixi.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ build = "colcon build"
3030
clean = "rm -rf build install log"
3131

3232
# Test tasks
33-
test = { cmd = "bash -c 'source install/setup.bash && colcon test'" }
34-
test-result = { cmd = "bash -c 'source install/setup.bash && colcon test-result --verbose'" }
33+
test = "colcon test"
34+
test-result = "colcon test-result --verbose"
3535

3636
[dependencies]
3737
python = ">=3.11,<3.13"

0 commit comments

Comments
 (0)