diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 665820862a80..e33742339d46 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -12,30 +12,52 @@ on: paths-ignore: - 'docs/**' +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build: - runs-on: ubuntu-latest - + gate_checks: + name: Gate Checks [${{ matrix.check }}] + runs-on: [runs-on,runner=2cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] container: image: ghcr.io/px4/px4-dev:v1.17.0-rc2 - strategy: fail-fast: true matrix: check: [ "check_format", "check_newlines", - "tests", "validate_module_configs", "shellcheck_all", "module_documentation", ] + steps: + - uses: runs-on/action@v2 + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Configure Git Safe Directory + run: git config --system --add safe.directory '*' + + - name: Building [${{ matrix.check }}] + env: + PX4_SBOM_DISABLE: 1 + run: make ${{ matrix.check }} + + tests: + name: Unit Tests + runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] + container: + image: ghcr.io/px4/px4-dev:v1.17.0-rc2 steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 @@ -45,19 +67,16 @@ jobs: - uses: ./.github/actions/setup-ccache id: ccache - if: matrix.check == 'tests' with: cache-key-prefix: ccache-sitl max-size: 300M - - name: Building [${{ matrix.check }}] + - name: Build and run unit tests env: PX4_SBOM_DISABLE: 1 - run: | - cd "$GITHUB_WORKSPACE" - make ${{ matrix.check }} + run: make tests - uses: ./.github/actions/save-ccache - if: always() && matrix.check == 'tests' + if: always() with: cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 47d6af5eb4ea..cb7166eae408 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -38,7 +38,7 @@ jobs: id: ccache with: cache-key-prefix: ccache-clang-tidy - max-size: 120M + max-size: 150M - name: Build - px4_sitl_default (Clang) run: make -j16 px4_sitl_default-clang diff --git a/.github/workflows/compile_macos.yml b/.github/workflows/compile_macos.yml index 5e011a5bf636..7ec351c3da6a 100644 --- a/.github/workflows/compile_macos.yml +++ b/.github/workflows/compile_macos.yml @@ -19,12 +19,6 @@ concurrency: jobs: build: runs-on: macos-latest - strategy: - matrix: - config: [ - px4_fmu-v5_default, - px4_sitl - ] steps: - name: install Python 3.10 uses: actions/setup-python@v5 @@ -33,35 +27,41 @@ jobs: - uses: actions/checkout@v4 - - name: setup - run: | - ./Tools/setup/macos.sh + - name: Cache - Restore Homebrew Packages + uses: actions/cache@v4 + with: + path: ~/Library/Caches/Homebrew/downloads + key: macos-homebrew-${{ runner.arch }}-${{ hashFiles('Tools/setup/macos.sh') }} + restore-keys: | + macos-homebrew-${{ runner.arch }}- - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - file(APPEND "$ENV{GITHUB_OUTPUT}" "timestamp=${current_date}\n") - - name: ccache cache files + - name: Cache - Restore pip Packages uses: actions/cache@v4 with: - path: ~/.ccache - key: macos_${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} - restore-keys: macos_${{matrix.config}}-ccache- - - name: setup ccache - run: | - mkdir -p ~/.ccache - echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf - echo "compression = true" >> ~/.ccache/ccache.conf - echo "compression_level = 6" >> ~/.ccache/ccache.conf - echo "max_size = 40M" >> ~/.ccache/ccache.conf - echo "hash_dir = false" >> ~/.ccache/ccache.conf - ccache -s - ccache -z + path: ~/Library/Caches/pip + key: macos-pip-${{ runner.arch }}-${{ hashFiles('Tools/setup/requirements.txt') }} + restore-keys: | + macos-pip-${{ runner.arch }}- - - name: make ${{matrix.config}} - run: | - ccache -z - make ${{matrix.config}} - ccache -s + - name: setup + run: ./Tools/setup/macos.sh + + - uses: ./.github/actions/setup-ccache + id: ccache + with: + cache-key-prefix: ccache-macos + max-size: 200M + + - name: Build px4_sitl + run: make px4_sitl + + - name: Cache - Stats after px4_sitl + run: ccache -s + + - name: Build px4_fmu-v5_default + run: make px4_fmu-v5_default + + - uses: ./.github/actions/save-ccache + if: always() + with: + cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} diff --git a/.github/workflows/compile_ubuntu.yml b/.github/workflows/compile_ubuntu.yml index 08975c9a6d4e..0a5d29703425 100644 --- a/.github/workflows/compile_ubuntu.yml +++ b/.github/workflows/compile_ubuntu.yml @@ -29,12 +29,13 @@ jobs: fail-fast: false matrix: version: ['ubuntu:22.04', 'ubuntu:24.04'] - runs-on: [runs-on,runner=4cpu-linux-x64,"image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false] + runs-on: [runs-on,runner=4cpu-linux-x64,"image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false,extras=s3-cache] container: image: ${{ matrix.version }} volumes: - /github/workspace:/github/workspace steps: + - uses: runs-on/action@v2 - name: Fix git in container run: | @@ -53,9 +54,19 @@ jobs: if: startsWith(runner.name, 'runs-on--') run: ./Tools/ci/use_aws_apt_mirror.sh - - name: Install Deps, Build, and Make Quick Check - run: | - # we need to install dependencies and build on the same step - # given the stateless nature of docker images - ./Tools/setup/ubuntu.sh - make quick_check + - name: Install Deps + run: ./Tools/setup/ubuntu.sh + + - uses: ./.github/actions/setup-ccache + id: ccache + with: + cache-key-prefix: ccache-ubuntu-${{ matrix.version }} + max-size: 200M + + - name: Make Quick Check + run: make quick_check + + - uses: ./.github/actions/save-ccache + if: always() + with: + cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} diff --git a/.github/workflows/docs-orchestrator.yml b/.github/workflows/docs-orchestrator.yml index d92c86d49ef0..79d113567f64 100644 --- a/.github/workflows/docs-orchestrator.yml +++ b/.github/workflows/docs-orchestrator.yml @@ -72,7 +72,7 @@ jobs: container: image: ghcr.io/px4/px4-dev:v1.17.0-rc2 steps: - - uses: runs-on/action@v1 + - uses: runs-on/action@v2 - name: Checkout uses: actions/checkout@v4 @@ -134,7 +134,7 @@ jobs: container: image: ghcr.io/px4/px4-dev:v1.17.0-rc2 steps: - - uses: runs-on/action@v1 + - uses: runs-on/action@v2 - name: Checkout uses: actions/checkout@v4 @@ -332,7 +332,7 @@ jobs: branchname: ${{ steps.set-branch.outputs.branchname }} releaseversion: ${{ steps.set-version.outputs.releaseversion }} steps: - - uses: runs-on/action@v1 + - uses: runs-on/action@v2 - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/docs_deploy.yml b/.github/workflows/docs_deploy.yml index bdf729b2b3ee..a9723f7bd398 100644 --- a/.github/workflows/docs_deploy.yml +++ b/.github/workflows/docs_deploy.yml @@ -22,7 +22,7 @@ jobs: build: runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",extras=s3-cache,spot=false] steps: - - uses: runs-on/action@v1 + - uses: runs-on/action@v2 - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/failsafe_sim.yml b/.github/workflows/failsafe_sim.yml index 64a4908e25de..f3db5bb3b3c5 100644 --- a/.github/workflows/failsafe_sim.yml +++ b/.github/workflows/failsafe_sim.yml @@ -18,7 +18,7 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] defaults: run: shell: bash @@ -32,6 +32,8 @@ jobs: image: ghcr.io/px4/px4-dev:v1.17.0-rc2 options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined steps: + - uses: runs-on/action@v2 + - name: Install Node v20.18.0 uses: actions/setup-node@v4 with: @@ -44,7 +46,15 @@ jobs: - name: Git ownership workaround run: git config --system --add safe.directory '*' + - name: Cache - Restore Emscripten SDK + id: cache-emsdk + uses: actions/cache@v4 + with: + path: _emscripten_sdk + key: emsdk-4.0.15 + - name: Install empscripten + if: steps.cache-emsdk.outputs.cache-hit != 'true' run: | git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk cd _emscripten_sdk diff --git a/.github/workflows/flash_analysis.yml b/.github/workflows/flash_analysis.yml index 277a497d05a0..aa8391b20334 100644 --- a/.github/workflows/flash_analysis.yml +++ b/.github/workflows/flash_analysis.yml @@ -24,7 +24,7 @@ env: jobs: analyze_flash: name: Analyzing ${{ matrix.target }} - runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false] + runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] container: image: ghcr.io/px4/px4-dev:v1.17.0-rc2 strategy: @@ -36,6 +36,8 @@ jobs: px4_fmu-v6x-bloaty-output: ${{ steps.gen-output.outputs.px4_fmu-v6x-bloaty-output }} px4_fmu-v6x-bloaty-summary-map: ${{ steps.gen-output.outputs.px4_fmu-v6x-bloaty-summary-map }} steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -44,17 +46,50 @@ jobs: - name: Git ownership workaround run: git config --system --add safe.directory '*' + - name: Cache - Restore ccache (current) + id: cache_current + uses: actions/cache/restore@v4 + with: + path: ~/.ccache + key: ccache-flash-${{ matrix.target }}-current-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + ccache-flash-${{ matrix.target }}-current-${{ github.ref_name }}- + ccache-flash-${{ matrix.target }}-current- + + - name: Cache - Configure ccache + run: | + mkdir -p ~/.ccache + echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf + echo "compression = true" >> ~/.ccache/ccache.conf + echo "compression_level = 6" >> ~/.ccache/ccache.conf + echo "max_size = 200M" >> ~/.ccache/ccache.conf + echo "hash_dir = false" >> ~/.ccache/ccache.conf + echo "compiler_check = content" >> ~/.ccache/ccache.conf + ccache -s + ccache -z + - name: Build Target run: make ${{ matrix.target }}_flash-analysis - name: Store the ELF with the change run: cp ./build/**/*.elf ./with-change.elf + - name: Cache - Stats after Current Build + run: ccache -s + + - name: Cache - Save ccache (current) + if: always() + uses: actions/cache/save@v4 + with: + path: ~/.ccache + key: ${{ steps.cache_current.outputs.cache-primary-key }} + - name: Clean previous build run: | make clean make distclean make submodulesclean + ccache -C - name: If it's a PR checkout the base branch if: ${{ github.event.pull_request }} @@ -68,12 +103,34 @@ jobs: - name: Update submodules run: make submodulesupdate + - name: Cache - Restore ccache (baseline) + id: cache_baseline + uses: actions/cache/restore@v4 + with: + path: ~/.ccache + key: ccache-flash-${{ matrix.target }}-baseline-${{ github.sha }} + restore-keys: | + ccache-flash-${{ matrix.target }}-baseline- + + - name: Cache - Reset ccache stats + run: ccache -z + - name: Build run: make ${{ matrix.target }}_flash-analysis - name: Store the ELF before the change run: cp ./build/**/*.elf ./before-change.elf + - name: Cache - Stats after Baseline Build + run: ccache -s + + - name: Cache - Save ccache (baseline) + if: always() + uses: actions/cache/save@v4 + with: + path: ~/.ccache + key: ${{ steps.cache_baseline.outputs.cache-primary-key }} + - name: bloaty-action uses: PX4/bloaty-action@v1.0.0 id: bloaty-step @@ -138,19 +195,19 @@ jobs: ## 🔎 FLASH Analysis
- px4_fmu-v5x [Total VM Diff: ${{ env.V5X-SUMMARY-MAP-ABS }} byte (${{ env.V5X-SUMMARY-MAP-PERC}} %)] + px4_fmu-v5x [Total VM Diff: ${{ env.V5X-SUMMARY-MAP-ABS }} byte (${{ env.V5X-SUMMARY-MAP-PERC}} %)] - ``` - ${{ needs.analyze_flash.outputs.px4_fmu-v5x-bloaty-output }} - ``` + ``` + ${{ needs.analyze_flash.outputs.px4_fmu-v5x-bloaty-output }} + ```
- px4_fmu-v6x [Total VM Diff: ${{ env.V6X-SUMMARY-MAP-ABS }} byte (${{ env.V6X-SUMMARY-MAP-PERC }} %)] + px4_fmu-v6x [Total VM Diff: ${{ env.V6X-SUMMARY-MAP-ABS }} byte (${{ env.V6X-SUMMARY-MAP-PERC }} %)] - ``` - ${{ needs.analyze_flash.outputs.px4_fmu-v6x-bloaty-output }} - ``` + ``` + ${{ needs.analyze_flash.outputs.px4_fmu-v6x-bloaty-output }} + ```
**Updated: _${{ steps.bt.outputs.timestamp }}_** diff --git a/.github/workflows/itcm_check.yml b/.github/workflows/itcm_check.yml index a48559114a0c..412941a8d7de 100644 --- a/.github/workflows/itcm_check.yml +++ b/.github/workflows/itcm_check.yml @@ -22,7 +22,7 @@ concurrency: jobs: check_itcm: name: Checking ${{ matrix.target }} - runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false] + runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] container: image: ghcr.io/px4/px4-dev:v1.17.0-rc2 strategy: @@ -46,6 +46,8 @@ jobs: boards/nxp/mr-tropic/nuttx-config/scripts/itcm_functions_includes.ld boards/nxp/mr-tropic/nuttx-config/scripts/itcm_static_functions.ld steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 @@ -53,6 +55,12 @@ jobs: - name: Git ownership workaround run: git config --system --add safe.directory '*' + - uses: ./.github/actions/setup-ccache + id: ccache + with: + cache-key-prefix: ccache-itcm-${{ matrix.target }} + max-size: 200M + - name: Build Target run: make ${{ matrix.target }} @@ -64,3 +72,8 @@ jobs: - name: Execute the itcm-check run: python3 Tools/itcm_check.py --elf-file built.elf --script-files ${{ matrix.scripts }} + + - uses: ./.github/actions/save-ccache + if: always() + with: + cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} diff --git a/.github/workflows/mavros_mission_tests.yml b/.github/workflows/mavros_mission_tests.yml index af0ec62ec564..0e7a4fe17c65 100644 --- a/.github/workflows/mavros_mission_tests.yml +++ b/.github/workflows/mavros_mission_tests.yml @@ -18,12 +18,14 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] strategy: fail-fast: false steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 diff --git a/.github/workflows/mavros_offboard_tests.yml b/.github/workflows/mavros_offboard_tests.yml index da0f3ce1b6c5..e0835a905b65 100644 --- a/.github/workflows/mavros_offboard_tests.yml +++ b/.github/workflows/mavros_offboard_tests.yml @@ -18,12 +18,14 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] strategy: fail-fast: false steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 diff --git a/.github/workflows/python_checks.yml b/.github/workflows/python_checks.yml index 72a6c600443c..5907fbd95c5f 100644 --- a/.github/workflows/python_checks.yml +++ b/.github/workflows/python_checks.yml @@ -14,8 +14,10 @@ on: jobs: build: - runs-on: ubuntu-24.04 + runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}"] steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 diff --git a/.github/workflows/ros_integration_tests.yml b/.github/workflows/ros_integration_tests.yml index 5421c8b4fafe..cf20b6493174 100644 --- a/.github/workflows/ros_integration_tests.yml +++ b/.github/workflows/ros_integration_tests.yml @@ -27,7 +27,11 @@ jobs: container: image: px4io/px4-dev-ros2-galactic:2021-09-08 options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined + env: + PX4_SBOM_DISABLE: 1 steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 @@ -45,30 +49,21 @@ jobs: run: | apt update && apt install -y gazebo11 libgazebo11-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly libgstreamer-plugins-base1.0-dev - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::set-output name=timestamp::${current_date}") - - name: ccache cache files + - uses: ./.github/actions/setup-ccache + id: ccache + with: + cache-key-prefix: ccache-ros-integration + max-size: 400M + + - name: Cache - Restore Micro-XRCE-DDS Agent + id: cache-xrce-agent uses: actions/cache@v4 with: - path: ~/.ccache - key: ros_integration_tests-${{matrix.config.build_type}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} - restore-keys: ros_integration_tests-${{matrix.config.build_type}}-ccache- - - name: setup ccache - run: | - mkdir -p ~/.ccache - echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf - echo "compression = true" >> ~/.ccache/ccache.conf - echo "compression_level = 6" >> ~/.ccache/ccache.conf - echo "max_size = 300M" >> ~/.ccache/ccache.conf - echo "hash_dir = false" >> ~/.ccache/ccache.conf - ccache -s - ccache -z - - - name: Get and build micro-xrce-dds-agent + path: /opt/Micro-XRCE-DDS-Agent + key: xrce-agent-v2.2.1-fastdds-2.8.2-galactic-2021-09-08 + + - name: Build - Micro-XRCE-DDS Agent (v2.2.1) + if: steps.cache-xrce-agent.outputs.cache-hit != 'true' run: | cd /opt git clone --recursive https://github.com/eProsima/Micro-XRCE-DDS-Agent.git @@ -79,10 +74,18 @@ jobs: cd build cmake .. make -j2 - - name: ccache post-run micro-xrce-dds-agent - run: ccache -s - - name: Get and build the ros2 interface library + - name: Cache - Restore PX4 ROS 2 Interface Library Workspace + id: cache-px4-ros2-ws + uses: actions/cache@v4 + with: + path: /opt/px4_ws + # Bump 'v1' when the cached workspace layout changes in a way + # that is not captured by the message/service hash below. + key: px4-ros2-ws-v1-galactic-2021-09-08-${{ hashFiles('msg/*.msg', 'msg/versioned/*.msg', 'srv/*.srv') }} + + - name: Build - PX4 ROS 2 Interface Library + if: steps.cache-px4-ros2-ws.outputs.cache-hit != 'true' shell: bash run: | PX4_DIR="$(pwd)" @@ -108,19 +111,8 @@ jobs: "${PX4_DIR}/Tools/copy_to_ros_ws.sh" "$(pwd)" rm -rf src/translation_node src/px4_msgs_old colcon build --symlink-install - - name: ccache post-run ros workspace - run: ccache -s - - - name: Build PX4 - env: - PX4_SBOM_DISABLE: 1 - run: make px4_sitl_default - - name: ccache post-run px4/firmware - run: ccache -s - - name: Build SITL Gazebo - run: make px4_sitl_default sitl_gazebo-classic - - name: ccache post-run sitl_gazebo-classic - run: ccache -s + + - uses: ./.github/actions/build-gazebo-sitl - name: Core dump settings run: | @@ -135,6 +127,11 @@ jobs: test/ros_test_runner.py --verbose --model iris --force-color timeout-minutes: 45 + - uses: ./.github/actions/save-ccache + if: always() + with: + cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} + - name: Upload failed logs if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/ros_translation_node.yml b/.github/workflows/ros_translation_node.yml index 64bae13f835c..916368a476b9 100644 --- a/.github/workflows/ros_translation_node.yml +++ b/.github/workflows/ros_translation_node.yml @@ -10,6 +10,9 @@ on: - '**' paths-ignore: - 'docs/**' +permissions: + contents: read + defaults: run: shell: bash @@ -20,8 +23,8 @@ concurrency: jobs: build_and_test: - name: Build and test - runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false] + name: Build and test [${{ matrix.config.ros_version }}] + runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] strategy: fail-fast: false matrix: @@ -29,33 +32,45 @@ jobs: - {ros_version: "humble", ubuntu: "jammy"} - {ros_version: "jazzy", ubuntu: "noble"} container: - image: rostooling/setup-ros-docker:ubuntu-${{ matrix.config.ubuntu }}-latest + image: ros:${{ matrix.config.ros_version }}-ros-base-${{ matrix.config.ubuntu }} steps: - - name: Setup ROS 2 (${{ matrix.config.ros_version }}) - uses: ros-tooling/setup-ros@v0.7 - with: - required-ros-distributions: ${{ matrix.config.ros_version }} - - name: Checkout repository - uses: actions/checkout@v4 + - uses: runs-on/action@v2 + + - uses: actions/checkout@v4 with: fetch-depth: 0 - # Workaround for https://github.com/actions/runner/issues/2033 - - name: ownership workaround + - name: Configure Git Safe Directory run: git config --system --add safe.directory '*' + - uses: ./.github/actions/setup-ccache + id: ccache + with: + cache-key-prefix: ccache-ros-translation-${{ matrix.config.ros_version }} + max-size: 150M + base-dir: /ros_ws + install-ccache: 'true' + - name: Check .msg file versioning if: github.event_name == 'pull_request' run: | ./Tools/ci/check_msg_versioning.sh ${{ github.event.pull_request.base.sha }} ${{github.event.pull_request.head.sha}} - - name: Build and test + - name: Build - Translation Node run: | ros_ws=/ros_ws mkdir -p $ros_ws/src ./Tools/copy_to_ros_ws.sh $ros_ws cd $ros_ws source /opt/ros/${{ matrix.config.ros_version }}/setup.sh - colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install --event-handlers=console_cohesion+ - source ./install/setup.sh - ./build/translation_node/translation_node_unit_tests + colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache --symlink-install --event-handlers=console_cohesion+ + + - name: Test - Translation Node Unit Tests + run: | + source /ros_ws/install/setup.sh + /ros_ws/build/translation_node/translation_node_unit_tests + + - uses: ./.github/actions/save-ccache + if: always() + with: + cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} diff --git a/.github/workflows/sitl_tests.yml b/.github/workflows/sitl_tests.yml index ba01d2b43892..e2f7b369c0b6 100644 --- a/.github/workflows/sitl_tests.yml +++ b/.github/workflows/sitl_tests.yml @@ -37,8 +37,13 @@ jobs: # transitions). Re-enable once the test infrastructure is stabilized. # - {model: "tailsitter" , latitude: "29.660316", longitude: "-82.316658", altitude: "30", build_type: "RelWithDebInfo" } # Florida # - {model: "standard_vtol", latitude: "47.397742", longitude: "8.545594", altitude: "488", build_type: "Coverage" } # Zurich + env: + PX4_CMAKE_BUILD_TYPE: ${{ matrix.config.build_type }} + PX4_SBOM_DISABLE: 1 steps: + - uses: runs-on/action@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 @@ -46,44 +51,13 @@ jobs: - name: Git Ownership Workaround run: git config --system --add safe.directory '*' - - id: set-timestamp - name: Set timestamp for cache - run: echo "::set-output name=timestamp::$(date +"%Y%m%d%H%M%S")" - - - name: Cache Key Config - uses: actions/cache@v4 + - uses: ./.github/actions/setup-ccache + id: ccache with: - path: ~/.ccache - key: sitl-ccache-${{ steps.set-timestamp.outputs.timestamp }} - restore-keys: sitl-ccache-${{ steps.set-timestamp.outputs.timestamp }} - - - name: Cache Conf Config - run: | - mkdir -p ~/.ccache - echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf - echo "compression = true" >> ~/.ccache/ccache.conf - echo "compression_level = 6" >> ~/.ccache/ccache.conf - echo "max_size = 120M" >> ~/.ccache/ccache.conf - echo "hash_dir = false" >> ~/.ccache/ccache.conf - ccache -s - ccache -z - - - name: Build PX4 - env: - PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}} - PX4_SBOM_DISABLE: 1 - run: make px4_sitl_default + cache-key-prefix: ccache-sitl-gazebo-classic + max-size: 350M - - name: Cache Post-Run [px4_sitl_default] - run: ccache -s - - - name: Build SITL Gazebo - env: - PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}} - run: make px4_sitl_default sitl_gazebo-classic - - - name: Cache Post-Run [sitl_gazebo-classic] - run: ccache -s + - uses: ./.github/actions/build-gazebo-sitl - name: Download MAVSDK run: wget "https://github.com/mavlink/MAVSDK/releases/download/v$(cat test/mavsdk_tests/MAVSDK_VERSION)/libmavsdk-dev_$(cat test/mavsdk_tests/MAVSDK_VERSION)_ubuntu20.04_amd64.deb" @@ -96,19 +70,19 @@ jobs: PX4_HOME_LAT: ${{matrix.config.latitude}} PX4_HOME_LON: ${{matrix.config.longitude}} PX4_HOME_ALT: ${{matrix.config.altitude}} - PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}} run: | export ulimit -a - name: Build PX4 / MAVSDK tests env: - PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}} DONT_RUN: 1 run: make px4_sitl_default sitl_gazebo-classic mavsdk_tests - - name: Cache Post-Run [px4_sitl_default sitl_gazebo-classic mavsdk_tests] - run: ccache -s + - uses: ./.github/actions/save-ccache + if: always() + with: + cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} - name: Core Dump Settings run: | @@ -120,7 +94,6 @@ jobs: PX4_HOME_LAT: ${{matrix.config.latitude}} PX4_HOME_LON: ${{matrix.config.longitude}} PX4_HOME_ALT: ${{matrix.config.altitude}} - PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}} run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 10 --abort-early --model ${{matrix.config.model}} test/mavsdk_tests/configs/sitl.json --verbose --force-color timeout-minutes: 45