diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 3b3ed619..07924f76 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -3,13 +3,16 @@ name: Build and Test on: push: branches: - - 'ros2' + - 'main' pull_request: branches: - - 'ros2/*' - - 'ros2' + - 'main/*' + - 'main' workflow_dispatch: +env: + ROS_WORKSPACE_PATH: colcon_ws/src + jobs: get_ros_distros: runs-on: ubuntu-latest @@ -74,34 +77,44 @@ jobs: image: rostooling/setup-ros-docker:${{ matrix.docker_image }} steps: - name: Setup Directories - run: mkdir -p ros_ws/src + run: mkdir -p $ROS_WORKSPACE_PATH - name: checkout uses: actions/checkout@v4 with: - path: ros_ws/src - - name: Build and Test ROS 2 - id: build_and_test_step - uses: ros-tooling/action-ros-ci@master + path: $ROS_WORKSPACE_PATH/usb_cam + - name: build + shell: bash + run: | + source /opt/ros/${{ matrix.ros_distro }}/setup.bash + cd $ROS_WORKSPACE_PATH + colcon build --packages-select usb_cam + - name: unit tests + shell: bash + run: | + source /opt/ros/${{ matrix.ros_distro }}/setup.bash + cd $ROS_WORKSPACE_PATH + colcon test --packages-select usb_cam + # Compile again, this time enabling integration tests + - name: Build integration tests + shell: bash + run: | + source /opt/ros/${{ matrix.ros_distro }}/setup.bash + cd $ROS_WORKSPACE_PATH + colcon build --packages-select usb_cam --cmake-args -DSANITIZE=1 -DINTEGRATION_TESTS=1 + - name: Run integration tests + uses: antmicro/renode-linux-runner-action@v1 with: - package-name: usb_cam - target-ros2-distro: ${{ matrix.ros_distro }} - vcs-repo-file-url: "" - colcon-defaults: | - { - "build": { - "mixin": ["coverage-gcc"] - } - } - # If possible, pin the repository in the workflow to a specific commit to avoid - # changes in colcon-mixin-repository from breaking your tests. - colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/1ddb69bedfd1f04c2f000e95452f7c24a4d6176b/index.yaml - - uses: actions/upload-artifact@v1 + shared-dirs: | + $ROS_WORKSPACE_PATH/build/usb_cam + renode-run: ./test_usb_cam_lib + devices: vivid + - uses: actions/upload-artifact@v4 with: name: colcon-logs-${{ matrix.ros_distro }} path: ${{ steps.build_and_test_step.outputs.ros-workspace-directory-name }}/log if: always() continue-on-error: true - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: lcov-logs-${{ matrix.ros_distro }} path: ${{ steps.build_and_test_step.outputs.ros-workspace-directory-name }}/lcov