Skip to content

Commit 8bd38d1

Browse files
committed
try smoke tests in the debian package
1 parent feeff97 commit 8bd38d1

File tree

2 files changed

+79
-5
lines changed

2 files changed

+79
-5
lines changed

.github/workflows/debian-packages.yml

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,81 @@ jobs:
7979
with:
8080
name: debian-packages-${{ matrix.ros_distro }}
8181
path: debian_packages/${{ matrix.ros_distro }}/
82-
retention-days: 30
82+
retention-days: 30
83+
84+
smoke-test:
85+
name: Smoke test ROS2 ${{ matrix.ros_distro }}
86+
runs-on: ubuntu-latest
87+
needs: [determine-distros, generate-debian]
88+
container:
89+
image: ros:${{ matrix.ros_distro }}-ros-base-${{ matrix.ubuntu_distro }}
90+
credentials:
91+
username: ${{ secrets.DOCKERHUB_USERNAME }}
92+
password: ${{ secrets.DOCKERHUB_TOKEN }}
93+
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
ros_distro: ${{ fromJson(needs.determine-distros.outputs.distros) }}
98+
include:
99+
- ros_distro: humble
100+
ubuntu_distro: jammy
101+
- ros_distro: iron
102+
ubuntu_distro: jammy
103+
- ros_distro: jazzy
104+
ubuntu_distro: noble
105+
- ros_distro: kilted
106+
ubuntu_distro: noble
107+
- ros_distro: rolling
108+
ubuntu_distro: noble
109+
110+
steps:
111+
- name: Setup environment
112+
run: |
113+
apt-get update -qq
114+
115+
- name: Download Debian packages
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: debian-packages-${{ matrix.ros_distro }}
119+
path: debian_packages/${{ matrix.ros_distro }}/
120+
121+
- name: Install and test packages
122+
run: |
123+
set -eo pipefail
124+
echo "Smoke testing install on ROS2 ${{ matrix.ros_distro }}"
125+
ls -la debian_packages/${{ matrix.ros_distro }}/
126+
127+
# Install the debian packages
128+
apt-get install -y ./debian_packages/${{ matrix.ros_distro }}/ros-${{ matrix.ros_distro }}-greenwave-monitor-interfaces_*.deb ./debian_packages/${{ matrix.ros_distro }}/ros-${{ matrix.ros_distro }}-greenwave-monitor_*.deb ./debian_packages/${{ matrix.ros_distro }}/ros-${{ matrix.ros_distro }}-r2s-gw_*.deb
129+
130+
# Verify packages are installed
131+
dpkg -s ros-${{ matrix.ros_distro }}-r2s-gw ros-${{ matrix.ros_distro }}-greenwave-monitor ros-${{ matrix.ros_distro }}-greenwave-monitor-interfaces
132+
133+
# Install Python dependencies
134+
apt-get install -y python3-pip || true
135+
if [[ "${{ matrix.ros_distro }}" == "jazzy" || \
136+
"${{ matrix.ros_distro }}" == "kilted" || \
137+
"${{ matrix.ros_distro }}" == "rolling" ]]; then
138+
# Download requirements.txt from the repo since we don't have checkout
139+
curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/r2s_gw/requirements.txt > /tmp/requirements.txt
140+
python3 -m pip install -I pygments -r /tmp/requirements.txt --break-system-packages
141+
else
142+
curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/r2s_gw/requirements.txt > /tmp/requirements.txt
143+
python3 -m pip install -r /tmp/requirements.txt
144+
fi
145+
146+
- name: Test r2s_gw execution
147+
run: |
148+
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
149+
timeout 10s bash -lc "script -qfec 'ros2 run r2s_gw r2s_gw' /dev/null <<< \$'q'" || true
150+
151+
- name: Test greenwave_monitor execution
152+
run: |
153+
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
154+
ros2 run greenwave_monitor greenwave_monitor & echo $! > /tmp/gwm.pid
155+
sleep 3
156+
ros2 node list | tee /tmp/nodes.txt
157+
grep -q greenwave_monitor /tmp/nodes.txt
158+
kill -TERM "$(cat /tmp/gwm.pid)" || true
159+
wait "$(cat /tmp/gwm.pid)" || true

.github/workflows/smoke-tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Smoke Tests
22

33
on:
4-
pull_request:
5-
branches: [ main ]
6-
types: [ opened, synchronize, reopened, ready_for_review ]
74
workflow_run:
85
workflows: ["Generate Debian Packages"]
96
types: [completed]
@@ -21,7 +18,7 @@ env:
2118
jobs:
2219
determine-distros:
2320
runs-on: ubuntu-latest
24-
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
21+
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
2522
outputs:
2623
distros: ${{ steps.set-distros.outputs.distros }}
2724
steps:

0 commit comments

Comments
 (0)