From ec86ef92c1be3aaf319f7a8b690971be8a27180e Mon Sep 17 00:00:00 2001 From: "Pasch, Frederik" Date: Thu, 25 Jul 2024 10:25:34 +0200 Subject: [PATCH] ci for jazzy --- .github/workflows/image.yml | 2 +- .github/workflows/test_build.yml | 131 +++++++++++++++---------------- 2 files changed, 65 insertions(+), 68 deletions(-) diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 67f5a326..26486e60 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -39,4 +39,4 @@ jobs: context: . file: .github/workflows/Dockerfile push: true - tags: ghcr.io/intellabs/scenario-execution:humble \ No newline at end of file + tags: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} \ No newline at end of file diff --git a/.github/workflows/test_build.yml b/.github/workflows/test_build.yml index 6b9424c0..8aea43c4 100644 --- a/.github/workflows/test_build.yml +++ b/.github/workflows/test_build.yml @@ -12,7 +12,7 @@ jobs: #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 + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -24,20 +24,22 @@ jobs: - name: Build shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash colcon build --continue-on-error source install/setup.bash + rm -rf log + rm -rf build - name: Cache Build id: cache-test-id uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: . - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} test-scenario-execution: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -45,12 +47,12 @@ jobs: - name: Restore cache uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash export -n CYCLONEDDS_URI export ROS_DOMAIN_ID=2 @@ -68,13 +70,13 @@ jobs: uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-scenario-execution + name: test-scenario-execution-${{ github.event.pull_request.base.ref }} path: ./**/TEST.xml test-scenario-execution-ros: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -82,12 +84,12 @@ jobs: - name: Restore cache uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash export -n CYCLONEDDS_URI export ROS_DOMAIN_ID=2 @@ -103,13 +105,13 @@ jobs: uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-scenario-execution-ros + name: test-scenario-execution-ros-${{ github.event.pull_request.base.ref }} path: ./**/TEST.xml scenario-files-validation: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -117,12 +119,12 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Scenario Files shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/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"; @@ -132,7 +134,7 @@ jobs: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -140,26 +142,26 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example Scenario shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/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} + scenario_batch_execution -i examples/example_scenario/ -o test_example_scenario --ignore-process-return-value -- 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 + name: test-example-scenario-result-${{ github.event.pull_request.base.ref }} path: test_example_scenario/test.xml test-example-library: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -167,26 +169,26 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example Library shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/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} + scenario_batch_execution -i examples/example_library/scenarios -o test_example_library --ignore-process-return-value -- 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 + name: test-example-library-result-${{ github.event.pull_request.base.ref }} path: test_example_library/test.xml test-example-variation: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -194,27 +196,27 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example Variation shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/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} + scenario_batch_execution -i scenario_variation_out -o test_example_variation --ignore-process-return-value -- 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 + name: test-example-variation-result-${{ github.event.pull_request.base.ref }} path: test_example_variation/test.xml test-example-nav2: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -222,12 +224,12 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example Nav2 shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash Xvfb :1 -screen 0 800x600x16 & export DISPLAY=:1.0 @@ -236,18 +238,18 @@ jobs: 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} headless:=True + scenario_batch_execution -i examples/example_nav2/ -o test_example_nav2 --ignore-process-return-value -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR} headless:=True - name: Upload result uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-example-nav2-result + name: test-example-nav2-result-${{ github.event.pull_request.base.ref }} path: test_example_nav2/test.xml test-example-simulation: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -255,12 +257,12 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example Simulation shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash Xvfb :1 -screen 0 800x600x16 & export DISPLAY=:1.0 @@ -269,18 +271,18 @@ jobs: 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} headless:=True + scenario_batch_execution -i examples/example_simulation/scenarios/ -o test_example_simulation --ignore-process-return-value -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR} headless:=True - name: Upload result uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-example-simulation-result + name: test-example-simulation-result-${{ github.event.pull_request.base.ref }} path: test_example_simulation/test.xml test-example-multirobot: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -288,12 +290,12 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example Multirobot shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash Xvfb :1 -screen 0 800x600x16 & export DISPLAY=:1.0 @@ -302,37 +304,37 @@ jobs: export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID} sed -i 's/240s/900s/g' examples/example_multi_robot/scenarios/example_multi_robot.osc # shellcheck disable=SC1083 - scenario_batch_execution -i examples/example_multi_robot/scenarios/ -o test_example_multirobot -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} yaw:=3.14 output_dir:={OUTPUT_DIR} headless:=True + scenario_batch_execution -i examples/example_multi_robot/scenarios/ -o test_example_multirobot --ignore-process-return-value -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} yaw:=3.14 output_dir:={OUTPUT_DIR} headless:=True - name: Upload result uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-example-multirobot-result + name: test-example-multirobot-result-${{ github.event.pull_request.base.ref }} path: test_example_multirobot/test.xml - name: Convert video if: always() shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source /rosbag2_to_video/install/setup.bash ros2 bag to_video -t /static_camera/image_raw -o test_example_multirobot/example_multi_robot/example-multi-robot.mp4 test_example_multirobot/example_multi_robot/rosbag2_* --fps 5 --codec mp4v - name: Upload video uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-example-multirobot-video + name: test-example-multirobot-video-${{ github.event.pull_request.base.ref }} path: test_example_multirobot/example_multi_robot/example-multi-robot.mp4 - name: Upload ros bag uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-example-multirobot-ros-bag + name: test-example-multirobot-ros-bag-${{ github.event.pull_request.base.ref }} path: test_example_multirobot/**/rosbag* test-example-external-method: needs: [build] runs-on: intellabs-01 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -340,29 +342,29 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Example External Method shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash export -n CYCLONEDDS_URI export ROS_DOMAIN_ID=2 # shellcheck disable=SC1083 - scenario_batch_execution -i examples/example_external_method/scenarios -o test_example_external_method -- ros2 launch scenario_execution_ros scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR} + scenario_batch_execution -i examples/example_external_method/scenarios -o test_example_external_method --ignore-process-return-value -- 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-external-method-result + name: test-example-external-method-result-${{ github.event.pull_request.base.ref }} path: test_example_external_method/test.xml test-scenario-execution-gazebo: needs: [build] runs-on: intellabs-01 timeout-minutes: 30 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -370,12 +372,12 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Scenario Execution Gazebo shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash Xvfb :1 -screen 0 800x600x16 & export DISPLAY=:1.0 @@ -383,19 +385,19 @@ jobs: export ROS_DOMAIN_ID=2 export IGN_PARTITION=${HOSTNAME}:${GITHUB_RUN_ID} # shellcheck disable=SC1083 - scenario_batch_execution -i test/scenario_execution_gazebo_test/scenarios/ -o test_scenario_execution_gazebo -- ros2 launch tb4_sim_scenario sim_nav_scenario_launch.py scenario:={SCENARIO} output_dir:={OUTPUT_DIR} + scenario_batch_execution -i test/scenario_execution_gazebo_test/scenarios/ -o test_scenario_execution_gazebo --ignore-process-return-value -- 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-scenario-execution-gazebo + name: test-scenario-execution-gazebo-${{ github.event.pull_request.base.ref }} path: test_scenario_execution_gazebo/test.xml test-scenario-execution-pybullet: needs: [build] runs-on: intellabs-01 timeout-minutes: 10 container: - image: ghcr.io/intellabs/scenario-execution:humble + image: ghcr.io/intellabs/scenario-execution:${{ github.event.pull_request.base.ref }} credentials: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} @@ -403,22 +405,22 @@ jobs: - name: Restore cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - key: ${{ runner.os }}-build-${{ github.run_number }} + key: ${{ runner.os }}-build-${{ github.event.pull_request.base.ref }}-${{ github.run_number }} path: . - name: Test Scenario Execution PyBullet shell: bash run: | - source /opt/ros/humble/setup.bash + source /opt/ros/${{ github.event.pull_request.base.ref }}/setup.bash source install/setup.bash Xvfb :1 -screen 0 800x600x16 & export DISPLAY=:1.0 - sed -i 's/p.GUI/p.DIRECT/g' ./install/scenario_execution_pybullet/lib/python3.10/site-packages/scenario_execution_pybullet/actions/sim_initialize.py + sed -i 's/p.GUI/p.DIRECT/g' ./install/scenario_execution_pybullet/lib/python3.1*/site-packages/scenario_execution_pybullet/actions/sim_initialize.py ros2 run scenario_execution scenario_execution libs/scenario_execution_pybullet/scenarios/example_pybullet.osc -t -s 0.00416666666 -o test_scenario_execution_pybullet - name: Upload result uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb if: always() with: - name: test-scenario-execution-pybullet + name: test-scenario-execution-pybullet-${{ github.event.pull_request.base.ref }} path: test_scenario_execution_pybullet/test.xml tests: needs: @@ -441,11 +443,6 @@ jobs: uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 #v4.0 with: path: downloaded-artifacts - - name: Restore cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - key: ${{ runner.os }}-build-${{ github.run_number }} - path: . - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@30eadd5010312f995f0d3b3cff7fe2984f69409e #v2.16.1 with: