Skip to content

Relative spawn

Relative spawn #776

Workflow file for this run

---
name: test-build
on:
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
#TODO model dependency to image-workflow. Workaround: retrigger run after image-workflow finished.
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: true
- name: Build
shell: bash
run: |
source /opt/ros/humble/setup.bash
colcon build --continue-on-error
source install/setup.bash
- name: Cache Build
id: cache-test-id
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .
key: ${{ runner.os }}-build-${{ github.run_number }}
test-scenario-execution:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
colcon test --packages-select \
scenario_execution \
scenario_execution_gazebo \
scenario_coverage \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--pytest-args \
--junit-xml=TEST.xml
# Add "--capture=no" to see output of tests
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-scenario-execution
path: ./**/TEST.xml
test-scenario-execution-ros:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
colcon test --packages-select \
scenario_execution_ros \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--pytest-args \
--junit-xml=TEST.xml
# Add "--capture=no" to see output of tests
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-scenario-execution-ros
path: ./**/TEST.xml
scenario-files-validation:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Scenario Files
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
find . -name "*.osc" | grep -Ev "lib_osc/*|examples/example_scenario_variation|scenario_coverage|fail*|install|build" | while read -r file; do
echo "$file";
ros2 run scenario_execution scenario_execution "$file" -n;
done
test-example-scenario:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Scenario
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
#shellcheck disable=SC1083
scenario_batch_execution -i examples/example_scenario/ -o test_example_scenario -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-scenario-result
path: test_example_scenario/test.xml
test-example-library:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Library
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_library/scenarios -o test_example_library -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-library-result
path: test_example_library/test.xml
test-example-variation:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Variation
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
scenario_variation -o scenario_variation_out examples/example_scenario_variation/example_scenario_variation.osc
# shellcheck disable=SC1083
scenario_batch_execution -i scenario_variation_out -o test_example_variation -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-variation-result
path: test_example_variation/test.xml
test-example-nav2:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Nav2
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/60s/600s/g' examples/example_nav2/example_nav2.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_nav2/ -o test_example_nav2 -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-nav2-result
path: test_example_nav2/test.xml
test-example-simulation:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Simulation
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/120s/600s/g' examples/example_simulation/scenarios/example_simulation.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_simulation/scenarios/ -o test_example_simulation -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-simulation-result
path: test_example_simulation/test.xml
test-example-multirobot:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Example Multirobot
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
sed -i 's/240s/900s/g' examples/example_multi_robot/example_multi_robot.osc
# shellcheck disable=SC1083
scenario_batch_execution -i examples/example_multi_robot/ -o test_example_multirobot -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} yaw:=3.14 output_dir:={OUTPUT_DIR}
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-multirobot-result
path: test_example_multirobot/test.xml
test-scenario-execution-gazebo:
needs: [build]
runs-on: intellabs-01
container:
image: ghcr.io/intellabs/scenario-execution:humble
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Restore cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: ${{ runner.os }}-build-${{ github.run_number }}
path: .
- name: Test Scenario Execution Gazebo
shell: bash
run: |
source /opt/ros/humble/setup.bash
source install/setup.bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export -n CYCLONEDDS_URI
export ROS_DOMAIN_ID=2
export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID}
# shellcheck disable=SC1083
scenario_batch_execution -i simulation/gazebo/test_scenario_execution_gazebo/scenarios/ -o test_scenario_execution_gazebo -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR} live_tree:=True
- name: Upload result
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb
if: always()
with:
name: test-example-simulation-result
path: test_example_simulation/test.xml
tests:
needs: [test-scenario-execution, test-scenario-execution-ros, scenario-files-validation, test-example-scenario, test-example-library, test-example-variation, test-example-nav2, test-example-simulation, test-example-multirobot, test-scenario-execution-gazebo]
runs-on: intellabs-01
if: ${{ always() }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 #v4.0
with:
path: downloaded-artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@f355d34d53ad4e7f506f699478db2dd71da9de5f #v2.15.1
with:
check_name: Test Results
check_run: false
action_fail: true
comment_mode: always
files: |
downloaded-artifacts/test-scenario-execution/scenario_execution/TEST.xml
downloaded-artifacts/test-scenario-execution-ros/scenario_execution_ros/TEST.xml
downloaded-artifacts/test-scenario-execution/scenario_coverage/TEST.xml
downloaded-artifacts/test-example-scenario-result/test.xml
downloaded-artifacts/test-example-library-result/test.xml
downloaded-artifacts/test-example-variation-result/test.xml
downloaded-artifacts/test-example-nav2-result/test.xml
downloaded-artifacts/test-example-simulation-result/test.xml
downloaded-artifacts/test-example-multirobot-result/test.xml