try gitlab workflows after migration #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Smoke Tests | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| types: [ opened, synchronize, reopened, ready_for_review ] | |
| workflow_run: | |
| workflows: ["Generate Debian Packages"] | |
| types: [completed] | |
| workflow_dispatch: # Manual trigger | |
| inputs: | |
| ros_distros: | |
| description: 'ROS distributions to test (comma-separated: humble,iron,jazzy,kilted,rolling)' | |
| required: false | |
| default: 'humble,jazzy' | |
| env: | |
| ROS_LOCALHOST_ONLY: 1 | |
| ROS_AUTOMATIC_DISCOVERY_RANGE: LOCALHOST | |
| jobs: | |
| determine-distros: | |
| runs-on: ubuntu-latest | |
| if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' | |
| outputs: | |
| distros: ${{ steps.set-distros.outputs.distros }} | |
| steps: | |
| - name: Determine ROS distributions to test | |
| id: set-distros | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| DISTROS="${{ github.event.inputs.ros_distros || 'humble,jazzy' }}" | |
| else | |
| # Use same distributions as the completed workflow or PR default | |
| DISTROS="humble,iron,jazzy,kilted,rolling" | |
| fi | |
| echo "Testing distributions: $DISTROS" | |
| JSON_ARRAY=$(echo "$DISTROS" | jq -R -c 'split(",") | map(select(length > 0))') | |
| echo "distros=$JSON_ARRAY" >> $GITHUB_OUTPUT | |
| smoke-test: | |
| name: Smoke test ROS2 ${{ matrix.ros_distro }} | |
| runs-on: ubuntu-latest | |
| needs: [determine-distros] | |
| container: | |
| image: ros:${{ matrix.ros_distro }}-ros-base-${{ matrix.ubuntu_distro }} | |
| credentials: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ros_distro: ${{ fromJson(needs.determine-distros.outputs.distros) }} | |
| include: | |
| - ros_distro: humble | |
| ubuntu_distro: jammy | |
| - ros_distro: iron | |
| ubuntu_distro: jammy | |
| - ros_distro: jazzy | |
| ubuntu_distro: noble | |
| - ros_distro: kilted | |
| ubuntu_distro: noble | |
| - ros_distro: rolling | |
| ubuntu_distro: noble | |
| steps: | |
| - name: Setup environment | |
| run: | | |
| apt-get update -qq | |
| - name: Download Debian packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: debian-packages-${{ matrix.ros_distro }} | |
| path: debian_packages/${{ matrix.ros_distro }}/ | |
| - name: Install and test packages | |
| run: | | |
| set -eo pipefail | |
| echo "Smoke testing install on ROS2 ${{ matrix.ros_distro }}" | |
| ls -la debian_packages/${{ matrix.ros_distro }}/ | |
| # Install the debian packages | |
| 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 | |
| # Verify packages are installed | |
| dpkg -s ros-${{ matrix.ros_distro }}-r2s-gw ros-${{ matrix.ros_distro }}-greenwave-monitor ros-${{ matrix.ros_distro }}-greenwave-monitor-interfaces | |
| # Install Python dependencies | |
| apt-get install -y python3-pip || true | |
| if [[ "${{ matrix.ros_distro }}" == "jazzy" || \ | |
| "${{ matrix.ros_distro }}" == "kilted" || \ | |
| "${{ matrix.ros_distro }}" == "rolling" ]]; then | |
| # Download requirements.txt from the repo since we don't have checkout | |
| curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/r2s_gw/requirements.txt > /tmp/requirements.txt | |
| python3 -m pip install -I pygments -r /tmp/requirements.txt --break-system-packages | |
| else | |
| curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/r2s_gw/requirements.txt > /tmp/requirements.txt | |
| python3 -m pip install -r /tmp/requirements.txt | |
| fi | |
| - name: Test r2s_gw execution | |
| run: | | |
| source /opt/ros/${{ matrix.ros_distro }}/setup.bash | |
| timeout 10s bash -lc "script -qfec 'ros2 run r2s_gw r2s_gw' /dev/null <<< \$'q'" || true | |
| - name: Test greenwave_monitor execution | |
| run: | | |
| source /opt/ros/${{ matrix.ros_distro }}/setup.bash | |
| ros2 run greenwave_monitor greenwave_monitor & echo $! > /tmp/gwm.pid | |
| sleep 3 | |
| ros2 node list | tee /tmp/nodes.txt | |
| grep -q greenwave_monitor /tmp/nodes.txt | |
| kill -TERM "$(cat /tmp/gwm.pid)" || true | |
| wait "$(cat /tmp/gwm.pid)" || true |