mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 10:26:52 +08:00
ci: upgrade sitl mavsdk tests workflow
This commit is contained in:
+121
-106
@@ -10,126 +10,141 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
name: Testing PX4 ${{ matrix.config.model }}
|
||||||
|
runs-on: [runs-on,runner=16cpu-linux-x64,image=ubuntu22-full-x64,"run-id=${{ github.run_id }}"]
|
||||||
|
# outputs:
|
||||||
|
# timestamp: ${{ steps.set-timestamp.outputs.timestamp }}
|
||||||
|
container:
|
||||||
|
image: px4io/px4-dev-simulation-focal:2021-09-08
|
||||||
|
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- {model: "iris", latitude: "59.617693", longitude: "-151.145316", altitude: "48", build_type: "RelWithDebInfo" } # Alaska
|
- {model: "iris", latitude: "59.617693", longitude: "-151.145316", altitude: "48", build_type: "RelWithDebInfo" } # Alaska
|
||||||
# - {model: "standard_vtol", latitude: "-38.071235", longitude: "145.281220", altitude: "31", build_type: "AddressSanitizer" } # Australia
|
|
||||||
- {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
|
||||||
|
|
||||||
container:
|
|
||||||
image: px4io/px4-dev-simulation-focal:2021-09-08
|
|
||||||
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.ACCESS_TOKEN }}
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Download MAVSDK
|
- name: Git Ownership Workaround
|
||||||
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: git config --system --add safe.directory '*'
|
||||||
- name: Install MAVSDK
|
|
||||||
run: dpkg -i "libmavsdk-dev_$(cat test/mavsdk_tests/MAVSDK_VERSION)_ubuntu20.04_amd64.deb"
|
|
||||||
|
|
||||||
- name: Prepare ccache timestamp
|
- id: set-timestamp
|
||||||
id: ccache_cache_timestamp
|
name: Set timestamp for cache
|
||||||
shell: cmake -P {0}
|
run: echo "::set-output name=timestamp::$(date +"%Y%m%d%H%M%S")"
|
||||||
run: |
|
|
||||||
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
|
||||||
message("::set-output name=timestamp::${current_date}")
|
|
||||||
- name: ccache cache files
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.ccache
|
|
||||||
key: sitl_tests-${{matrix.config.build_type}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
|
|
||||||
restore-keys: sitl_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 = 100M" >> ~/.ccache/ccache.conf
|
|
||||||
echo "hash_dir = false" >> ~/.ccache/ccache.conf
|
|
||||||
ccache -s
|
|
||||||
ccache -z
|
|
||||||
|
|
||||||
- name: check environment
|
- name: Cache Key Config
|
||||||
env:
|
uses: actions/cache@v4
|
||||||
PX4_HOME_LAT: ${{matrix.config.latitude}}
|
with:
|
||||||
PX4_HOME_LON: ${{matrix.config.longitude}}
|
path: ~/.ccache
|
||||||
PX4_HOME_ALT: ${{matrix.config.altitude}}
|
key: sitl-ccache-${{ steps.set-timestamp.outputs.timestamp }}
|
||||||
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
restore-keys: sitl-ccache-${{ steps.set-timestamp.outputs.timestamp }}
|
||||||
run: |
|
|
||||||
export
|
|
||||||
ulimit -a
|
|
||||||
- name: Build PX4
|
|
||||||
env:
|
|
||||||
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
|
||||||
run: make px4_sitl_default
|
|
||||||
- name: ccache post-run px4/firmware
|
|
||||||
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: ccache post-run sitl_gazebo-classic
|
|
||||||
run: ccache -s
|
|
||||||
- name: Build 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: ccache post-run mavsdk_tests
|
|
||||||
run: ccache -s
|
|
||||||
|
|
||||||
- name: Core dump settings
|
- name: Cache Conf Config
|
||||||
run: |
|
run: |
|
||||||
ulimit -c unlimited
|
mkdir -p ~/.ccache
|
||||||
echo "`pwd`/%e.core" > /proc/sys/kernel/core_pattern
|
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: Run SITL tests
|
- name: Build PX4
|
||||||
env:
|
env:
|
||||||
PX4_HOME_LAT: ${{matrix.config.latitude}}
|
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
||||||
PX4_HOME_LON: ${{matrix.config.longitude}}
|
run: make px4_sitl_default
|
||||||
PX4_HOME_ALT: ${{matrix.config.altitude}}
|
|
||||||
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
|
||||||
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 --abort-early --model ${{matrix.config.model}} --upload test/mavsdk_tests/configs/sitl.json --verbose
|
|
||||||
timeout-minutes: 45
|
|
||||||
|
|
||||||
- name: Look at core files
|
- name: Cache Post-Run [px4_sitl_default]
|
||||||
if: failure()
|
run: ccache -s
|
||||||
run: gdb build/px4_sitl_default/bin/px4 px4.core -ex "thread apply all bt" -ex "quit"
|
|
||||||
- name: Upload px4 coredump
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v2-preview
|
|
||||||
with:
|
|
||||||
name: coredump
|
|
||||||
path: px4.core
|
|
||||||
|
|
||||||
- name: Upload px4 binary
|
- name: Build SITL Gazebo
|
||||||
if: failure()
|
env:
|
||||||
uses: actions/upload-artifact@v2-preview
|
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
||||||
with:
|
run: make px4_sitl_default sitl_gazebo-classic
|
||||||
name: binary
|
|
||||||
path: build/px4_sitl_default/bin/px4
|
|
||||||
|
|
||||||
# Report test coverage
|
- name: Cache Post-Run [sitl_gazebo-classic]
|
||||||
- name: Upload coverage
|
run: ccache -s
|
||||||
if: contains(matrix.config.build_type, 'Coverage')
|
|
||||||
run: |
|
- name: Download MAVSDK
|
||||||
git config --global credential.helper "" # disable the keychain credential helper
|
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"
|
||||||
git config --global --add credential.helper store # enable the local store credential helper
|
|
||||||
echo "https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com" >> ~/.git-credentials # add credential
|
- name: Install MAVSDK
|
||||||
git config --global url."https://github.com/".insteadof git@github.com: # credentials add credential
|
run: dpkg -i "libmavsdk-dev_$(cat test/mavsdk_tests/MAVSDK_VERSION)_ubuntu20.04_amd64.deb"
|
||||||
mkdir -p coverage
|
|
||||||
lcov --directory build/px4_sitl_default --base-directory build/px4_sitl_default --gcov-tool gcov --capture -o coverage/lcov.info
|
- name: Check PX4 Environment Variables
|
||||||
- name: Upload coverage information to Codecov
|
env:
|
||||||
if: contains(matrix.config.build_type, 'Coverage')
|
PX4_HOME_LAT: ${{matrix.config.latitude}}
|
||||||
uses: codecov/codecov-action@v1
|
PX4_HOME_LON: ${{matrix.config.longitude}}
|
||||||
with:
|
PX4_HOME_ALT: ${{matrix.config.altitude}}
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
||||||
flags: mavsdk
|
run: |
|
||||||
file: coverage/lcov.info
|
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
|
||||||
|
|
||||||
|
- 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}}
|
||||||
|
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
||||||
|
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 --abort-early --model ${{matrix.config.model}} --upload test/mavsdk_tests/configs/sitl.json --verbose
|
||||||
|
timeout-minutes: 45
|
||||||
|
|
||||||
|
- name: Upload failed logs
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: failed-${{matrix.config.model}}-logs.zip
|
||||||
|
path: |
|
||||||
|
logs/**/**/**/*.log
|
||||||
|
logs/**/**/**/*.ulg
|
||||||
|
build/px4_sitl_default/tmp_mavsdk_tests/rootfs/*.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@v4
|
||||||
|
with:
|
||||||
|
name: coredump
|
||||||
|
path: px4.core
|
||||||
|
|
||||||
|
- name: Setup & Generate Coverage Report
|
||||||
|
if: contains(matrix.config.build_type, 'Coverage')
|
||||||
|
run: |
|
||||||
|
git config --global credential.helper "" # disable the keychain credential helper
|
||||||
|
git config --global --add credential.helper store # enable the local store credential helper
|
||||||
|
echo "https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com" >> ~/.git-credentials # add credential
|
||||||
|
git config --global url."https://github.com/".insteadof git@github.com: # credentials add credential
|
||||||
|
mkdir -p coverage
|
||||||
|
lcov --directory build/px4_sitl_default --base-directory build/px4_sitl_default --gcov-tool gcov --capture -o coverage/lcov.info
|
||||||
|
|
||||||
|
- name: Upload Coverage Information to Codecov
|
||||||
|
if: contains(matrix.config.build_type, 'Coverage')
|
||||||
|
uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
flags: mavsdk
|
||||||
|
file: coverage/lcov.info
|
||||||
|
|||||||
Reference in New Issue
Block a user