Skip to content

Commit dd2af74

Browse files
committed
Refactor reusable workspace workflow to improve disk space management and streamline container operations
Signed-off-by: Max Waterhout <[email protected]>
1 parent 2a21df0 commit dd2af74

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

.github/workflows/reusable-workspace.yml

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,48 @@ jobs:
1818
- name: checkout
1919
uses: actions/checkout@v4
2020

21-
- name: Clear disk space on host
22-
uses: ./.github/actions/clear-disk-space
23-
2421
build-and-test:
25-
needs: prepare-runner
26-
runs-on: ubuntu-latest
27-
container:
28-
image: ${{ inputs.container-image }}
29-
options: --user root
3022
steps:
3123
- name: checkout
3224
uses: actions/checkout@v4
3325
with:
3426
lfs: true
35-
- name: uv sync
36-
shell: bash -ieo pipefail {0}
27+
- name: Clear disk space
3728
run: |
38-
uv sync
39-
- name: build workspace
40-
shell: bash -ieo pipefail {0}
29+
df -h /
30+
sudo rm -rf /opt/microsoft/msedge
31+
df -h /
32+
33+
- name: Pull image
34+
run: docker pull "${{ inputs.container-image }}"
35+
- name: Create and start container
36+
env:
37+
IMAGE: ${{ inputs.container-image }}
4138
run: |
42-
source /home/rcdt/.bashrc
43-
cd ros2_ws
44-
uv run colcon build --symlink-install
39+
docker create --name "ws" \
40+
-v "$PWD:/ws" -w /ws --user root \
41+
"$IMAGE" bash -lc "sleep infinity"
42+
docker start "ws"
43+
44+
- name: uv sync
45+
run: docker exec ws bash -lc 'uv sync'
46+
47+
- name: build workspace
48+
run: docker exec ws bash -lc 'cd ros2_ws && uv run colcon build --symlink-install'
49+
4550
- name: run ty
46-
shell: bash -ieo pipefail {0}
47-
run: |
48-
cd ros2_ws
49-
source /home/rcdt/.bashrc
50-
uv run ty check --error-on-warning
51+
run: docker exec ws bash -lc 'cd ros2_ws && uv run ty check --error-on-warning'
52+
5153
- name: run tests
52-
shell: bash -ieo pipefail {0}
5354
run: |
54-
source /home/rcdt/.bashrc
55-
cd ros2_ws
56-
source install/setup.bash
57-
echo "GZ_SIM_RESOURCE_PATH: ${GZ_SIM_RESOURCE_PATH}"
58-
uv run pytest -s --ignore=src/rcdt_franka/rcdt_franka/test/integration/test_franka_realsense.py src/
55+
docker exec ws bash -lc '
56+
cd ros2_ws &&
57+
source install/setup.bash &&
58+
echo "GZ_SIM_RESOURCE_PATH: ${GZ_SIM_RESOURCE_PATH}" &&
59+
uv run pytest -s --ignore=src/rcdt_franka/rcdt_franka/test/integration/test_franka_realsense.py src/
60+
'
5961
62+
- name: Cleanup container
63+
if: always()
64+
run: docker rm -f ws || true
6065
# Ignore src/rcdt_franka/rcdt_franka/test/integration/test_franka_realsense.py due to gpu limitation in CICD.

0 commit comments

Comments
 (0)