mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
* ci(codecov): upload unit test coverage and limit SITL coverage to main Coverage on main came from a single standard_vtol SITL flight, unit tests were never uploaded, and the Coverage build never hit ccache because ccache 4.9.1 (Ubuntu 24.04) rejects -fprofile-update=atomic. The flag only keeps hit counts exact under thread races; line coverage is unaffected and lcov already ignores the resulting negative counts. Unit tests now build with coverage and upload as the unittests flag on every PR and push to main. standard_vtol builds as Coverage on main only and uploads as sitl-vtol, carried forward on PRs. codecov.yml sets the default branch, informational project/patch statuses and ignores. Per-build-type ccache keys stop the Coverage and RelWithDebInfo jobs from overwriting each other's cache. Fixes #28862 Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ramon Roche <mrpollo@gmail.com> * ci(codecov): run unit test coverage as its own job The Coverage build shifts EKF replay float output, so running it in the Unit Tests job made the change indication step auto-commit new baselines to the PR branch. Unit Tests goes back to the plain build and a separate job produces the unittests upload. disable_search keeps the Codecov uploader to the lcov report instead of running gcov over the build tree. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ramon Roche <mrpollo@gmail.com> --------- Signed-off-by: Ramon Roche <mrpollo@gmail.com>
139 lines
5.1 KiB
YAML
139 lines
5.1 KiB
YAML
# NOTE: this workflow is now running on Dronecode / PX4 AWS account.
|
|
# - If you want to keep the tests running in GitHub Actions you need to uncomment the "runs-on: ubuntu-latest" lines
|
|
# and comment the "runs-on: [runs-on,runner=..." lines.
|
|
# - If you would like to duplicate this setup try setting up "RunsOn" on your own AWS account try https://runs-on.com
|
|
|
|
name: SITL Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Testing PX4 ${{ matrix.config.model }}
|
|
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
|
container:
|
|
image: px4io/px4-dev:v1.16.0-rc1-258-g0369abd556
|
|
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- {model: "quadx", latitude: "59.617693", longitude: "-151.145316", altitude: "48", build_type: "RelWithDebInfo" } # Alaska
|
|
- {model: "hex", latitude: "47.397742", longitude: "8.545594", altitude: "488", build_type: "RelWithDebInfo" } # Zurich
|
|
# Coverage on main only; PRs reuse main's numbers through Codecov carryforward (codecov.yml)
|
|
- {model: "standard_vtol", latitude: "47.397742", longitude: "8.545594", altitude: "488", build_type: "${{ github.event_name == 'push' && 'Coverage' || 'RelWithDebInfo' }}" } # Zurich
|
|
- {model: "xvert", latitude: "47.397742", longitude: "8.545594", altitude: "488", build_type: "RelWithDebInfo" } # Zurich
|
|
env:
|
|
PX4_CMAKE_BUILD_TYPE: ${{ matrix.config.build_type }}
|
|
PX4_SBOM_DISABLE: 1
|
|
|
|
steps:
|
|
- uses: runs-on/action@v2
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 1
|
|
- name: Configure Git Safe Directory
|
|
run: git config --system --add safe.directory '*'
|
|
|
|
- uses: ./.github/actions/setup-ccache
|
|
id: ccache
|
|
with:
|
|
cache-key-prefix: ccache-mavsdk-tests-${{ matrix.config.build_type }}
|
|
max-size: 350M
|
|
|
|
- name: Build PX4 SITL
|
|
shell: bash
|
|
run: make px4_sitl_default
|
|
|
|
- name: Cache Stats after PX4 Firmware
|
|
shell: bash
|
|
run: ccache -s
|
|
|
|
- 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)_ubuntu22.04_amd64.deb"
|
|
|
|
- name: Install MAVSDK
|
|
run: dpkg -i "libmavsdk-dev_$(cat test/mavsdk_tests/MAVSDK_VERSION)_ubuntu22.04_amd64.deb"
|
|
|
|
- name: Check PX4 Environment Variables
|
|
env:
|
|
PX4_HOME_LAT: ${{matrix.config.latitude}}
|
|
PX4_HOME_LON: ${{matrix.config.longitude}}
|
|
PX4_HOME_ALT: ${{matrix.config.altitude}}
|
|
run: |
|
|
export
|
|
ulimit -a
|
|
|
|
- name: Build PX4 / MAVSDK tests
|
|
env:
|
|
DONT_RUN: 1
|
|
run: make px4_sitl_default mavsdk_tests
|
|
|
|
- uses: ./.github/actions/save-ccache
|
|
if: always()
|
|
with:
|
|
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}
|
|
|
|
- name: Core Dump Settings
|
|
run: |
|
|
ulimit -c unlimited
|
|
echo "`pwd`/%e.core" > /proc/sys/kernel/core_pattern
|
|
|
|
- name: Run SITL / MAVSDK Tests
|
|
env:
|
|
PX4_HOME_LAT: ${{matrix.config.latitude}}
|
|
PX4_HOME_LON: ${{matrix.config.longitude}}
|
|
PX4_HOME_ALT: ${{matrix.config.altitude}}
|
|
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 10 --abort-early --model ${{matrix.config.model}} test/mavsdk_tests/configs/sih-sitl.json --verbose --force-color
|
|
timeout-minutes: 45
|
|
|
|
- name: Upload failed logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: failed-${{matrix.config.model}}-logs.zip
|
|
path: |
|
|
logs/**/**/**/*.log
|
|
logs/**/**/**/*.ulg
|
|
build/px4_sitl_default/tmp_mavsdk_tests/rootfs/fs/log/**/*.ulg
|
|
|
|
- name: Look at Core files
|
|
if: failure() && ${{ hashFiles('px4.core') != '' }}
|
|
run: gdb build/px4_sitl_default/bin/px4 px4.core -ex "thread apply all bt" -ex "quit"
|
|
|
|
- name: Upload PX4 coredump
|
|
if: failure() && ${{ hashFiles('px4.core') != '' }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: coredump
|
|
path: px4.core
|
|
|
|
- name: Generate Coverage Report
|
|
if: matrix.config.build_type == 'Coverage'
|
|
run: |
|
|
mkdir -p coverage
|
|
lcov --directory build/px4_sitl_default --base-directory build/px4_sitl_default --gcov-tool gcov --capture -o coverage/lcov.info --ignore-errors negative
|
|
|
|
- name: Upload Coverage Information to Codecov
|
|
if: matrix.config.build_type == 'Coverage'
|
|
uses: codecov/codecov-action@v6
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: sitl-vtol
|
|
files: coverage/lcov.info
|
|
disable_search: true
|