-
Notifications
You must be signed in to change notification settings - Fork 38
executable file
·106 lines (102 loc) · 4.35 KB
/
bazelized_drake_ros.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Bazel Drake-ROS Continuous Integration
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
bazel_build_and_test:
if: "! contains(github.event.pull_request.labels.*.name, 'status: defer ci')"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Free up space
run: .github/runner_free_space.sh
# Caching.
# See comments in drake-blender for more details:
# https://github.com/RobotLocomotion/drake-blender/blob/c4a33f80/.github/workflows/main.yml
- uses: actions/cache/restore@v3
with:
path: "~/.cache/bazel_ci"
# We want this key to change to ensure we store the updated cache.
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
bazel_ci-${{ github.ref }}-
bazel_ci-refs/heads/main-
- name: Check cache
run: du -hs $(readlink -f ~/.cache/bazel_ci) || true
# Setup.
- name: Simplify apt upgrades
run: .github/simplify_apt_and_upgrades.sh
- name: Configure drake_ros Bazel for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: drake_ros
- name: Install ROS tools (like rosdep)
uses: ros-tooling/[email protected]
- name: Update rosdep data
run: rosdep update
- name: Install bazel_ros2_rules dependencies
# TODO(sloretz) make bazel_ros2_rules/setup/install_prereqs.sh
run: |
sudo apt install python3 python3-toposort
sudo rm -rf /var/lib/apt/lists/*
- name: Use GCC 11, until GCC 13 works with drake's clang
run: sudo apt purge gcc-13 libgcc-13-dev g++-13 libstdc++-13-dev gcc-12 libgcc-12-dev g++-12 libstdc++-12-dev && sudo apt install gcc-11 g++-11 && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11
working-directory: drake_ros
- name: Download Drake
run: bazel build @drake//:module_py
working-directory: drake_ros
- name: Install Drake's dependencies
run: yes | sudo ./bazel-drake_ros/external/drake/setup/ubuntu/install_prereqs.sh
working-directory: drake_ros
- name: Install ROS tarball's dependencies
# TODO(sloretz) can't use rosdep here because we need the archive downloaded,
# but can't download the archive with bazel until we have the dependencies installed
# so bazel_ros2_rules can inspect it.
run: |
sudo apt-get install -y libconsole-bridge-dev
sudo rm -rf /var/lib/apt/lists/*
# CI for drake_ros.
- name: Install drake_ros's dependencies
run: yes | sudo ./setup/install_prereqs.sh
working-directory: drake_ros
- name: Build drake_ros
run: export ROS_DISTRO=humble; bazel build //...
working-directory: drake_ros
- name: Test drake_ros
run: export ROS_DISTRO=humble; bazel test //...
working-directory: drake_ros
- name: Clean up drake_ros
run: bazel clean
working-directory: drake_ros
# CI for drake_ros_examples.
- name: Install additional ROS dependencies for drake_ros_examples
run: |
yes | sudo ./setup/install_prereqs.sh
sudo rm -rf /var/lib/apt/lists/*
working-directory: drake_ros_examples
- name: Configure drake_ros_examples Bazel for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: drake_ros_examples
- name: Build drake_ros_examples
run: bazel build //...
working-directory: drake_ros_examples
- name: Test drake_ros_examples
run: bazel test //...
working-directory: drake_ros_examples
- name: Clean up drake_ros_examples
run: bazel clean
working-directory: drake_ros_examples
# Save the updated cache snapshots, so we never do the same work twice.
# By default, actions/cache only saves after a successful workflow, but
# our caches are bags of files where we only ever add new files (not change
# an existing files), so it's always safe to snapshot.
- uses: actions/cache/save@v3
if: always()
with:
path: "~/.cache/bazel_ci"
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}