ci(workflows): wire ccache and caches across ci (#27036)

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche 2026-04-09 22:51:25 -06:00 committed by GitHub
parent a3ad956394
commit 5d5d9e399b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 266 additions and 165 deletions

View File

@ -12,30 +12,52 @@ on:
paths-ignore: paths-ignore:
- 'docs/**' - 'docs/**'
permissions:
contents: read
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build: gate_checks:
runs-on: ubuntu-latest 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: container:
image: ghcr.io/px4/px4-dev:v1.17.0-rc2 image: ghcr.io/px4/px4-dev:v1.17.0-rc2
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
check: [ check: [
"check_format", "check_format",
"check_newlines", "check_newlines",
"tests",
"validate_module_configs", "validate_module_configs",
"shellcheck_all", "shellcheck_all",
"module_documentation", "module_documentation",
] ]
steps: 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 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1
@ -45,19 +67,16 @@ jobs:
- uses: ./.github/actions/setup-ccache - uses: ./.github/actions/setup-ccache
id: ccache id: ccache
if: matrix.check == 'tests'
with: with:
cache-key-prefix: ccache-sitl cache-key-prefix: ccache-sitl
max-size: 300M max-size: 300M
- name: Building [${{ matrix.check }}] - name: Build and run unit tests
env: env:
PX4_SBOM_DISABLE: 1 PX4_SBOM_DISABLE: 1
run: | run: make tests
cd "$GITHUB_WORKSPACE"
make ${{ matrix.check }}
- uses: ./.github/actions/save-ccache - uses: ./.github/actions/save-ccache
if: always() && matrix.check == 'tests' if: always()
with: with:
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }} cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}

View File

@ -38,7 +38,7 @@ jobs:
id: ccache id: ccache
with: with:
cache-key-prefix: ccache-clang-tidy cache-key-prefix: ccache-clang-tidy
max-size: 120M max-size: 150M
- name: Build - px4_sitl_default (Clang) - name: Build - px4_sitl_default (Clang)
run: make -j16 px4_sitl_default-clang run: make -j16 px4_sitl_default-clang

View File

@ -19,12 +19,6 @@ concurrency:
jobs: jobs:
build: build:
runs-on: macos-latest runs-on: macos-latest
strategy:
matrix:
config: [
px4_fmu-v5_default,
px4_sitl
]
steps: steps:
- name: install Python 3.10 - name: install Python 3.10
uses: actions/setup-python@v5 uses: actions/setup-python@v5
@ -33,35 +27,41 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: setup - name: Cache - Restore Homebrew Packages
run: |
./Tools/setup/macos.sh
- 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
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.ccache path: ~/Library/Caches/Homebrew/downloads
key: macos_${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} key: macos-homebrew-${{ runner.arch }}-${{ hashFiles('Tools/setup/macos.sh') }}
restore-keys: macos_${{matrix.config}}-ccache- restore-keys: |
- name: setup ccache macos-homebrew-${{ runner.arch }}-
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
- name: make ${{matrix.config}} - name: Cache - Restore pip Packages
run: | uses: actions/cache@v4
ccache -z with:
make ${{matrix.config}} path: ~/Library/Caches/pip
ccache -s key: macos-pip-${{ runner.arch }}-${{ hashFiles('Tools/setup/requirements.txt') }}
restore-keys: |
macos-pip-${{ runner.arch }}-
- 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 }}

View File

@ -29,12 +29,13 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
version: ['ubuntu:22.04', 'ubuntu:24.04'] 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: container:
image: ${{ matrix.version }} image: ${{ matrix.version }}
volumes: volumes:
- /github/workspace:/github/workspace - /github/workspace:/github/workspace
steps: steps:
- uses: runs-on/action@v2
- name: Fix git in container - name: Fix git in container
run: | run: |
@ -53,9 +54,19 @@ jobs:
if: startsWith(runner.name, 'runs-on--') if: startsWith(runner.name, 'runs-on--')
run: ./Tools/ci/use_aws_apt_mirror.sh run: ./Tools/ci/use_aws_apt_mirror.sh
- name: Install Deps, Build, and Make Quick Check - name: Install Deps
run: | run: ./Tools/setup/ubuntu.sh
# we need to install dependencies and build on the same step
# given the stateless nature of docker images - uses: ./.github/actions/setup-ccache
./Tools/setup/ubuntu.sh id: ccache
make quick_check 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 }}

View File

@ -72,7 +72,7 @@ jobs:
container: container:
image: ghcr.io/px4/px4-dev:v1.17.0-rc2 image: ghcr.io/px4/px4-dev:v1.17.0-rc2
steps: steps:
- uses: runs-on/action@v1 - uses: runs-on/action@v2
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -134,7 +134,7 @@ jobs:
container: container:
image: ghcr.io/px4/px4-dev:v1.17.0-rc2 image: ghcr.io/px4/px4-dev:v1.17.0-rc2
steps: steps:
- uses: runs-on/action@v1 - uses: runs-on/action@v2
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -332,7 +332,7 @@ jobs:
branchname: ${{ steps.set-branch.outputs.branchname }} branchname: ${{ steps.set-branch.outputs.branchname }}
releaseversion: ${{ steps.set-version.outputs.releaseversion }} releaseversion: ${{ steps.set-version.outputs.releaseversion }}
steps: steps:
- uses: runs-on/action@v1 - uses: runs-on/action@v2
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -22,7 +22,7 @@ jobs:
build: build:
runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",extras=s3-cache,spot=false] runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",extras=s3-cache,spot=false]
steps: steps:
- uses: runs-on/action@v1 - uses: runs-on/action@v2
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -18,7 +18,7 @@ concurrency:
jobs: jobs:
build: 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: defaults:
run: run:
shell: bash shell: bash
@ -32,6 +32,8 @@ jobs:
image: ghcr.io/px4/px4-dev:v1.17.0-rc2 image: ghcr.io/px4/px4-dev:v1.17.0-rc2
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps: steps:
- uses: runs-on/action@v2
- name: Install Node v20.18.0 - name: Install Node v20.18.0
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
@ -44,7 +46,15 @@ jobs:
- name: Git ownership workaround - name: Git ownership workaround
run: git config --system --add safe.directory '*' 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 - name: Install empscripten
if: steps.cache-emsdk.outputs.cache-hit != 'true'
run: | run: |
git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk
cd _emscripten_sdk cd _emscripten_sdk

View File

@ -24,7 +24,7 @@ env:
jobs: jobs:
analyze_flash: analyze_flash:
name: Analyzing ${{ matrix.target }} 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: container:
image: ghcr.io/px4/px4-dev:v1.17.0-rc2 image: ghcr.io/px4/px4-dev:v1.17.0-rc2
strategy: strategy:
@ -36,6 +36,8 @@ jobs:
px4_fmu-v6x-bloaty-output: ${{ steps.gen-output.outputs.px4_fmu-v6x-bloaty-output }} 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 }} px4_fmu-v6x-bloaty-summary-map: ${{ steps.gen-output.outputs.px4_fmu-v6x-bloaty-summary-map }}
steps: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
@ -44,17 +46,50 @@ jobs:
- name: Git ownership workaround - name: Git ownership workaround
run: git config --system --add safe.directory '*' 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 - name: Build Target
run: make ${{ matrix.target }}_flash-analysis run: make ${{ matrix.target }}_flash-analysis
- name: Store the ELF with the change - name: Store the ELF with the change
run: cp ./build/**/*.elf ./with-change.elf 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 - name: Clean previous build
run: | run: |
make clean make clean
make distclean make distclean
make submodulesclean make submodulesclean
ccache -C
- name: If it's a PR checkout the base branch - name: If it's a PR checkout the base branch
if: ${{ github.event.pull_request }} if: ${{ github.event.pull_request }}
@ -68,12 +103,34 @@ jobs:
- name: Update submodules - name: Update submodules
run: make submodulesupdate 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 - name: Build
run: make ${{ matrix.target }}_flash-analysis run: make ${{ matrix.target }}_flash-analysis
- name: Store the ELF before the change - name: Store the ELF before the change
run: cp ./build/**/*.elf ./before-change.elf 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 - name: bloaty-action
uses: PX4/bloaty-action@v1.0.0 uses: PX4/bloaty-action@v1.0.0
id: bloaty-step id: bloaty-step

View File

@ -22,7 +22,7 @@ concurrency:
jobs: jobs:
check_itcm: check_itcm:
name: Checking ${{ matrix.target }} 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: container:
image: ghcr.io/px4/px4-dev:v1.17.0-rc2 image: ghcr.io/px4/px4-dev:v1.17.0-rc2
strategy: 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_functions_includes.ld
boards/nxp/mr-tropic/nuttx-config/scripts/itcm_static_functions.ld boards/nxp/mr-tropic/nuttx-config/scripts/itcm_static_functions.ld
steps: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1
@ -53,6 +55,12 @@ jobs:
- name: Git ownership workaround - name: Git ownership workaround
run: git config --system --add safe.directory '*' 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 - name: Build Target
run: make ${{ matrix.target }} run: make ${{ matrix.target }}
@ -64,3 +72,8 @@ jobs:
- name: Execute the itcm-check - name: Execute the itcm-check
run: python3 Tools/itcm_check.py --elf-file built.elf --script-files ${{ matrix.scripts }} 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 }}

View File

@ -18,12 +18,14 @@ concurrency:
jobs: jobs:
build: 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: strategy:
fail-fast: false fail-fast: false
steps: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1

View File

@ -18,12 +18,14 @@ concurrency:
jobs: jobs:
build: 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: strategy:
fail-fast: false fail-fast: false
steps: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1

View File

@ -14,8 +14,10 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-24.04 runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}"]
steps: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1

View File

@ -27,7 +27,11 @@ jobs:
container: container:
image: px4io/px4-dev-ros2-galactic:2021-09-08 image: px4io/px4-dev-ros2-galactic:2021-09-08
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
env:
PX4_SBOM_DISABLE: 1
steps: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1
@ -45,30 +49,21 @@ jobs:
run: | 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 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 - uses: ./.github/actions/setup-ccache
id: ccache_cache_timestamp id: ccache
shell: cmake -P {0} with:
run: | cache-key-prefix: ccache-ros-integration
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) max-size: 400M
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files - name: Cache - Restore Micro-XRCE-DDS Agent
id: cache-xrce-agent
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.ccache path: /opt/Micro-XRCE-DDS-Agent
key: ros_integration_tests-${{matrix.config.build_type}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} key: xrce-agent-v2.2.1-fastdds-2.8.2-galactic-2021-09-08
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 - name: Build - Micro-XRCE-DDS Agent (v2.2.1)
if: steps.cache-xrce-agent.outputs.cache-hit != 'true'
run: | run: |
cd /opt cd /opt
git clone --recursive https://github.com/eProsima/Micro-XRCE-DDS-Agent.git git clone --recursive https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
@ -79,10 +74,18 @@ jobs:
cd build cd build
cmake .. cmake ..
make -j2 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 shell: bash
run: | run: |
PX4_DIR="$(pwd)" PX4_DIR="$(pwd)"
@ -108,19 +111,8 @@ jobs:
"${PX4_DIR}/Tools/copy_to_ros_ws.sh" "$(pwd)" "${PX4_DIR}/Tools/copy_to_ros_ws.sh" "$(pwd)"
rm -rf src/translation_node src/px4_msgs_old rm -rf src/translation_node src/px4_msgs_old
colcon build --symlink-install colcon build --symlink-install
- name: ccache post-run ros workspace
run: ccache -s
- name: Build PX4 - uses: ./.github/actions/build-gazebo-sitl
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
- name: Core dump settings - name: Core dump settings
run: | run: |
@ -135,6 +127,11 @@ jobs:
test/ros_test_runner.py --verbose --model iris --force-color test/ros_test_runner.py --verbose --model iris --force-color
timeout-minutes: 45 timeout-minutes: 45
- uses: ./.github/actions/save-ccache
if: always()
with:
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}
- name: Upload failed logs - name: Upload failed logs
if: failure() if: failure()
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -10,6 +10,9 @@ on:
- '**' - '**'
paths-ignore: paths-ignore:
- 'docs/**' - 'docs/**'
permissions:
contents: read
defaults: defaults:
run: run:
shell: bash shell: bash
@ -20,8 +23,8 @@ concurrency:
jobs: jobs:
build_and_test: build_and_test:
name: Build and test 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] runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -29,33 +32,45 @@ jobs:
- {ros_version: "humble", ubuntu: "jammy"} - {ros_version: "humble", ubuntu: "jammy"}
- {ros_version: "jazzy", ubuntu: "noble"} - {ros_version: "jazzy", ubuntu: "noble"}
container: container:
image: rostooling/setup-ros-docker:ubuntu-${{ matrix.config.ubuntu }}-latest image: ros:${{ matrix.config.ros_version }}-ros-base-${{ matrix.config.ubuntu }}
steps: steps:
- name: Setup ROS 2 (${{ matrix.config.ros_version }}) - uses: runs-on/action@v2
uses: ros-tooling/setup-ros@v0.7
with: - uses: actions/checkout@v4
required-ros-distributions: ${{ matrix.config.ros_version }}
- name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
# Workaround for https://github.com/actions/runner/issues/2033 - name: Configure Git Safe Directory
- name: ownership workaround
run: git config --system --add 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 - name: Check .msg file versioning
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
run: | run: |
./Tools/ci/check_msg_versioning.sh ${{ github.event.pull_request.base.sha }} ${{github.event.pull_request.head.sha}} ./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: | run: |
ros_ws=/ros_ws ros_ws=/ros_ws
mkdir -p $ros_ws/src mkdir -p $ros_ws/src
./Tools/copy_to_ros_ws.sh $ros_ws ./Tools/copy_to_ros_ws.sh $ros_ws
cd $ros_ws cd $ros_ws
source /opt/ros/${{ matrix.config.ros_version }}/setup.sh source /opt/ros/${{ matrix.config.ros_version }}/setup.sh
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install --event-handlers=console_cohesion+ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache --symlink-install --event-handlers=console_cohesion+
source ./install/setup.sh
./build/translation_node/translation_node_unit_tests - 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 }}

View File

@ -37,8 +37,13 @@ jobs:
# transitions). Re-enable once the test infrastructure is stabilized. # transitions). Re-enable once the test infrastructure is stabilized.
# - {model: "tailsitter" , latitude: "29.660316", longitude: "-82.316658", altitude: "30", build_type: "RelWithDebInfo" } # Florida # - {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 # - {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: steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1
@ -46,44 +51,13 @@ jobs:
- name: Git Ownership Workaround - name: Git Ownership Workaround
run: git config --system --add safe.directory '*' run: git config --system --add safe.directory '*'
- id: set-timestamp - uses: ./.github/actions/setup-ccache
name: Set timestamp for cache id: ccache
run: echo "::set-output name=timestamp::$(date +"%Y%m%d%H%M%S")"
- name: Cache Key Config
uses: actions/cache@v4
with: with:
path: ~/.ccache cache-key-prefix: ccache-sitl-gazebo-classic
key: sitl-ccache-${{ steps.set-timestamp.outputs.timestamp }} max-size: 350M
restore-keys: sitl-ccache-${{ steps.set-timestamp.outputs.timestamp }}
- name: Cache Conf Config - uses: ./.github/actions/build-gazebo-sitl
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
- 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
- name: Download MAVSDK - 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" 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_LAT: ${{matrix.config.latitude}}
PX4_HOME_LON: ${{matrix.config.longitude}} PX4_HOME_LON: ${{matrix.config.longitude}}
PX4_HOME_ALT: ${{matrix.config.altitude}} PX4_HOME_ALT: ${{matrix.config.altitude}}
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: | run: |
export export
ulimit -a ulimit -a
- name: Build PX4 / MAVSDK tests - name: Build PX4 / MAVSDK tests
env: env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
DONT_RUN: 1 DONT_RUN: 1
run: make px4_sitl_default sitl_gazebo-classic mavsdk_tests run: make px4_sitl_default sitl_gazebo-classic mavsdk_tests
- name: Cache Post-Run [px4_sitl_default sitl_gazebo-classic mavsdk_tests] - uses: ./.github/actions/save-ccache
run: ccache -s if: always()
with:
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}
- name: Core Dump Settings - name: Core Dump Settings
run: | run: |
@ -120,7 +94,6 @@ jobs:
PX4_HOME_LAT: ${{matrix.config.latitude}} PX4_HOME_LAT: ${{matrix.config.latitude}}
PX4_HOME_LON: ${{matrix.config.longitude}} PX4_HOME_LON: ${{matrix.config.longitude}}
PX4_HOME_ALT: ${{matrix.config.altitude}} 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 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 timeout-minutes: 45