diff --git a/.github/workflows/carbonix_build.yml b/.github/workflows/carbonix_build.yml new file mode 100644 index 0000000000..ae16001889 --- /dev/null +++ b/.github/workflows/carbonix_build.yml @@ -0,0 +1,344 @@ +name: Carbonix Build + +on: + push: + branches: + - CxPilot + - CxPilot-* + - master + paths-ignore: + # remove non chibios HAL + - 'libraries/AP_HAL_Linux/**' + - 'libraries/AP_HAL_ESP32/**' + - 'libraries/AP_HAL_SITL/**' + # remove non stm directories + - 'Tools/CHDK-Script/**' + - 'Tools/CodeStyle/**' + - 'Tools/completion/**' + - 'Tools/debug/**' + - 'Tools/environment_install/**' + - 'Tools/FilterTestTool/**' + - 'Tools/Frame_params/**' + - 'Tools/geotag/**' + - 'Tools/GIT_Test/**' + - 'Tools/gittools/**' + - 'Tools/Hello/**' + - 'Tools/LogAnalyzer/**' + - 'Tools/mavproxy_modules/**' + - 'Tools/Pozyx/**' + - 'Tools/PrintVersion.py' + - 'Tools/Replay/**' + - 'Tools/simulink/**' + - 'Tools/UDP_Proxy/**' + - 'Tools/vagrant/**' + - 'Tools/Vicon/**' + # Remove vehicles autotest we need support of test_build_option.py in the Tools/autotest directory + - 'Tools/autotest/antennatracker.py' + - 'Tools/autotest/arduplane.py' + - 'Tools/autotest/ardusub.py' + - 'Tools/autotest/balancebot.py' + - 'Tools/autotest/location.txt' + - 'Tools/autotest/quadplane.py' + - 'Tools/autotest/rover.py' + - 'Tools/autotest/sailboat.py' + - 'Tools/autotest/swarminit.txt' + # Remove markdown files as irrelevant + - '**.md' + # Remove dotfile at root directory + - './.dir-locals.el' + - './.dockerignore' + - './.editorconfig' + - './.flake8' + - './.gitattributes' + - './.github' + - './.gitignore' + - './.pre-commit-config.yaml' + - './.pydevproject' + - './.valgrind-suppressions' + - './.valgrindrc' + - 'Dockerfile' + - 'Vagrantfile' + - 'Makefile' + # Remove some directories check + - '.vscode/**' + - '.github/ISSUE_TEMPLATE/**' + + pull_request: + paths-ignore: + # remove non chibios HAL + - 'libraries/AP_HAL_Linux/**' + - 'libraries/AP_HAL_ESP32/**' + - 'libraries/AP_HAL_SITL/**' + # remove non stm directories + - 'Tools/CHDK-Script/**' + - 'Tools/CodeStyle/**' + - 'Tools/completion/**' + - 'Tools/debug/**' + - 'Tools/environment_install/**' + - 'Tools/FilterTestTool/**' + - 'Tools/Frame_params/**' + - 'Tools/geotag/**' + - 'Tools/GIT_Test/**' + - 'Tools/gittools/**' + - 'Tools/Hello/**' + - 'Tools/LogAnalyzer/**' + - 'Tools/mavproxy_modules/**' + - 'Tools/Pozyx/**' + - 'Tools/PrintVersion.py' + - 'Tools/Replay/**' + - 'Tools/simulink/**' + - 'Tools/UDP_Proxy/**' + - 'Tools/vagrant/**' + - 'Tools/Vicon/**' + # Remove vehicles autotest we need support of test_build_option.py in the Tools/autotest directory + - 'Tools/autotest/antennatracker.py' + - 'Tools/autotest/arduplane.py' + - 'Tools/autotest/ardusub.py' + - 'Tools/autotest/autotest.py' + - 'Tools/autotest/balancebot.py' + - 'Tools/autotest/common.py' + - 'Tools/autotest/examples.py' + - 'Tools/autotest/quadplane.py' + - 'Tools/autotest/rover.py' + - 'Tools/autotest/sailboat.py' + - 'Tools/autotest/**.txt' + - 'Tools/autotest/logger_metadata/**' + - 'Tools/autotest/param_metadata/**' + # Remove markdown files as irrelevant + - '**.md' + # Remove dotfile at root directory + - './.dir-locals.el' + - './.dockerignore' + - './.editorconfig' + - './.flake8' + - './.gitattributes' + - './.github' + - './.gitignore' + - './.pre-commit-config.yaml' + - './.pydevproject' + - './.valgrind-suppressions' + - './.valgrindrc' + - 'Dockerfile' + - 'Vagrantfile' + - 'Makefile' + # Remove some directories check + - '.vscode/**' + - '.github/ISSUE_TEMPLATE/**' + + release: + types: [published] + + workflow_dispatch: + +concurrency: + group: ci-${{github.workflow}}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-sitl: + runs-on: 'windows-latest' + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: bash + run: | + NOW=$(date -u +"%F-%T") + echo "timestamp=${NOW}" >> $GITHUB_OUTPUT + WORKFLOWNAME="${{github.workflow}}" + NAME_DASHED=${WORKFLOWNAME//+( )/_} + echo "cache-key=${NAME_DASHED}" >> $GITHUB_OUTPUT + + - uses: cygwin/cygwin-install-action@master + with: + packages: cygwin64 gcc-g++=10.2.0-1 ccache python37 python37-future python37-lxml python37-pip python37-setuptools python37-wheel git procps gettext + add-to-path: false + # Put ccache into github cache for faster build + - name: setup ccache + env: + PATH: /usr/bin:$(cygpath ${SYSTEMROOT})/system32 + shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}' + run: >- + mkdir -p /cygdrive/d/a/ardupilot/ardupilot/ccache && + mkdir -p /usr/local/etc && + echo "export CCACHE_SLOPPINESS=file_stat_matches" >> ~/ccache.conf && + echo "export CCACHE_DIR=/cygdrive/d/a/ardupilot/ardupilot/ccache" >> ~/ccache.conf && + echo "export CCACHE_BASEDIR=/cygdrive/d/a/ardupilot/ardupilot" >> ~/ccache.conf && + echo "export CCACHE_COMPRESS=1" >> ~/ccache.conf && + echo "export CCACHE_COMPRESSLEVEL=6" >> ~/ccache.conf && + echo "export CCACHE_MAXSIZE=400M" >> ~/ccache.conf && + source ~/ccache.conf && + ccache -s + - name: ccache cache files + uses: actions/cache@v3 + with: + path: D:/a/ardupilot/ardupilot/ccache + key: ${{ steps.ccache_cache_timestamp.outputs.cache-key }}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: ${{ steps.ccache_cache_timestamp.outputs.cache-key }}-ccache- # restore ccache from either previous build on this branch or on base branch + - name: Prepare Python environment + env: + PATH: /usr/bin:$(cygpath ${SYSTEMROOT})/system32 + shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}' + run: >- + ln -sf /usr/bin/python3.7 /usr/bin/python && ln -sf /usr/bin/pip3.7 /usr/bin/pip && + python -m pip install --progress-bar off empy pexpect && + python -m pip install --progress-bar off dronecan --upgrade && + cp /usr/bin/ccache /usr/local/bin/ && + cd /usr/local/bin && ln -s ccache /usr/local/bin/gcc && + ln -s ccache /usr/local/bin/g++ && + ln -s ccache /usr/local/bin/x86_64-pc-cygwin-gcc && + ln -s ccache /usr/local/bin/x86_64-pc-cygwin-g++ + + - name: Build SITL + env: + PATH: /usr/bin:$(cygpath ${SYSTEMROOT})/system32 + shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}' + run: >- + export PATH=/usr/local/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32 && + source ~/ccache.conf && + Tools/scripts/cygwin_build.sh && + ccache -s + + - name: Check build files + id: check_files + uses: andstor/file-existence-action@v2 + with: + files: "artifacts/*.exe" + fail: true + + - name: Archive build + uses: actions/upload-artifact@v4 + with: + name: sitl + path: artifacts + retention-days: 90 + + build-apj: + runs-on: ubuntu-20.04 + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.0.29 + strategy: + fail-fast: false # don't cancel if a job from the matrix fails + matrix: + toolchain: [ + chibios, + #chibios-clang, + ] + gcc: [10] + exclude: + - gcc: 10 + toolchain: chibios-clang + + steps: + # git checkout the PR + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + # Put ccache into github cache for faster build + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + run: | + NOW=$(date -u +"%F-%T") + echo "timestamp=${NOW}" >> $GITHUB_OUTPUT + - name: ccache cache files + uses: actions/cache@v3 + with: + path: ~/.ccache + key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master + - name: setup ccache + run: | + . .github/workflows/ccache.env + + - name: build + shell: bash + run: Tools/Carbonix_scripts/carbonix_waf_build.sh + + - name: Check build files + id: check_files + uses: andstor/file-existence-action@v2 + with: + files: "build/CubeOrange/*, build/CubeOrange-Volanti/*, build/CubeOrange-Ottano/*, build/CarbonixF405/*, build/CarbonixF405-no-crystal/*" + fail: true + - name: Gather build output + run: | + mkdir -p temp/others + for dir in CubeOrange CubeOrange-Volanti CubeOrange-Ottano CarbonixF405 CarbonixF405-no-crystal; do + mkdir -p temp/others/$dir/bin + cp -vr build/$dir/bin/* temp/others/$dir/bin/ + done + cp -vr output/* temp/ + mv temp/others/CubeOrange-Volanti temp/Volanti + mv temp/others/CubeOrange-Ottano temp/Ottano + if [ -d "ArduPlane/ReleaseNotes.txt" ]; then + cp -v ArduPlane/ReleaseNotes.txt temp/ + else + echo "ReleaseNotes.txt File does not exist" + fi + if [ -d "libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/payloads" ]; then + cp -vr libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/payloads temp/ + else + echo "payloads Folder does not exist" + fi + shell: sh -e {0} + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: apj + path: temp + retention-days: 90 + + upload: + runs-on: ubuntu-20.04 + needs: [build-apj, build-sitl] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Extract firmware version, commit id, and branch name + id: extract_info + run: | + FIRMWARE_VERSION=$(grep -oP '#define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_Common/CxVersion.h) + COMMIT_ID=$(git rev-parse --short HEAD) + BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) + echo "firmware_version=$FIRMWARE_VERSION" >> $GITHUB_ENV + echo "commit_id=$COMMIT_ID" >> $GITHUB_ENV + echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV + shell: sh -e {0} + + - name: Download APJ build + uses: actions/download-artifact@v4 + with: + name: apj + path: temp + + - name: Download SITL build + uses: actions/download-artifact@v4 + with: + name: sitl + path: temp/sitl + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Upload artifacts to S3 + run: | + DATE_HR=$(date +%Y%m%d_%H%M) + if ${{ github.event_name == 'release' }}; then + PATH_TO_S3=s3://carbonix-firmware-release-files/Carbopilot_V2/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}/ + echo "Uploading to: $PATH_TO_S3" + aws s3 cp temp/ $PATH_TO_S3 --recursive + elif ${{ github.event_name == 'push' && startsWith(env.branch_name, 'CxPilot') }}; then + PATH_TO_S3=s3://carbonix-firmware-dev-files/Carbopilot_V2/${{ env.branch_name }}/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}/ + echo "Uploading to: $PATH_TO_S3" + aws s3 cp temp/ $PATH_TO_S3 --recursive + elif ${{ github.event_name == 'pull_request' }}; then + PATH_TO_S3=s3://carbonix-firmware-dev-files/Carbopilot_V2/PR/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}_${{ github.event.pull_request.number }}/ + echo "Uploading to: $PATH_TO_S3" + aws s3 cp temp/ $PATH_TO_S3 --recursive + fi diff --git a/.github/workflows/ccache.env b/.github/workflows/ccache.env index 2cae97776a..47455589cb 100644 --- a/.github/workflows/ccache.env +++ b/.github/workflows/ccache.env @@ -1,6 +1,8 @@ # common ccache env vars for CI export CCACHE_SLOPPINESS=file_stat_matches +git config --global --add safe.directory ${GITHUB_WORKSPACE} + mkdir -p ~/.ccache echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf echo "compression = true" >> ~/.ccache/ccache.conf diff --git a/.github/workflows/colcon.yml b/.github/workflows/colcon.yml index e39af18fc1..22d29b466d 100644 --- a/.github/workflows/colcon.yml +++ b/.github/workflows/colcon.yml @@ -2,6 +2,10 @@ name: colcon build/test on: push: + branches: + - CxPilot + - CxPilot-* + - master paths-ignore: # remove not tests vehicles - 'AntennaTracker/**' diff --git a/.github/workflows/cx_build_compare.yml b/.github/workflows/cx_build_compare.yml new file mode 100644 index 0000000000..51720cdf1a --- /dev/null +++ b/.github/workflows/cx_build_compare.yml @@ -0,0 +1,128 @@ +name: Compare Build Outputs + +on: + pull_request: + types: [labeled] + +concurrency: + group: ci-${{github.workflow}}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-and-compare: + if: github.event.label.name == 'CX_NO_CODE_CHANGE' + runs-on: ubuntu-20.04 + + container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.0.29 + strategy: + fail-fast: false # don't cancel if a job from the matrix fails + matrix: + toolchain: [ + chibios, + ] + gcc: [10] + exclude: + - gcc: 10 + toolchain: chibios-clang + board: ["CubeOrange-Volanti", "CubeOrange-Ottano", "CarbonixF405", "CarbonixF405-no-crystal"] + steps: + # git checkout the PR + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: 'recursive' + + # Put ccache into github cache for faster build + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + run: | + NOW=$(date -u +"%F-%T") + echo "timestamp=${NOW}" >> $GITHUB_OUTPUT + + - name: ccache cache files + uses: actions/cache@v3 + with: + path: ~/.ccache + key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master + + - name: setup ccache + run: | + . .github/workflows/ccache.env + + - name: Check if Hwdef directory has been modified + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} + CHANGED=$(git diff --quiet HEAD origin/${{ github.event.pull_request.base.ref }} -- libraries/AP_HAL_ChibiOS/hwdef || echo "changed") + if [ "$CHANGED" = "changed" ]; then + echo "Directory has been modified" + exit 1 + fi + + - name: Build Head and ${{ github.event.pull_request.base.ref }} ${{matrix.board}} + shell: bash + run: | + git config --global --add safe.directory ${GITHUB_WORKSPACE} + PATH="/github/home/.local/bin:$PATH" + + # export some environment variables designed to get + # repeatable builds from the same source: + export CHIBIOS_GIT_VERSION="12345678" + export GIT_VERSION="abcdef" + export GIT_VERSION_INT="15" + ./waf configure --board ${{matrix.board}} + + ./Tools/Carbonix_scripts/build_no_clean.sh ${{ matrix.board }} + + NO_VERSIONS_DIR="$GITHUB_WORKSPACE/${{matrix.board}}/pr_bin_no_versions" + mkdir -p "$NO_VERSIONS_DIR" + cp -r build/${{matrix.board}}/bin/* "$NO_VERSIONS_DIR" + + echo [`date`] Built Base with no versions + + git checkout ${{ github.event.pull_request.base.ref }} + + # export some environment variables designed to get + # repeatable builds from the same source: + + export CHIBIOS_GIT_VERSION="12345678" + export GIT_VERSION="abcdef" + export GIT_VERSION_INT="15" + ./Tools/Carbonix_scripts/build_no_clean.sh ${{ matrix.board }} + + NO_VERSIONS_DIR="$GITHUB_WORKSPACE/${{matrix.board}}/base_branch_bin_no_versions" + mkdir -p "$NO_VERSIONS_DIR" + cp -r build/${{matrix.board}}/bin/* "$NO_VERSIONS_DIR" + + echo [`date`] Built ${{ github.event.pull_request.base.ref }} with no versions + + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.board }} + path: ${{ github.workspace }}/${{ matrix.board }} + if-no-files-found: warn + retention-days: 7 + + - name: Compare build outputs + shell: bash + run: | + git config --global --add safe.directory ${GITHUB_WORKSPACE} + PATH="/github/home/.local/bin:$PATH" + differences_found=0 + + for base_file in $GITHUB_WORKSPACE/${{ matrix.board }}/base_branch_bin_no_versions/*.bin + do + base_filename=$(basename "$base_file") + diff_output=$(diff $base_file $GITHUB_WORKSPACE/${{ matrix.board }}/pr_bin_no_versions/$base_filename) || true + if [ "$diff_output" != "" ]; then + echo Failed -- Comparing $base_file and $GITHUB_WORKSPACE/${{ matrix.board }}/pr_bin_no_versions/$base_filename resulted in $diff_output + differences_found=1 + else + echo Passed -- Comparing $base_file and $GITHUB_WORKSPACE/${{ matrix.board }}/pr_bin_no_versions/$base_filename + fi + done + if [ $differences_found -eq 1 ]; then + exit 1 + fi + \ No newline at end of file diff --git a/.github/workflows/test_ccache.yml b/.github/workflows/test_ccache.yml index 627de1e613..3c8dbdd629 100644 --- a/.github/workflows/test_ccache.yml +++ b/.github/workflows/test_ccache.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_chibios.yml b/.github/workflows/test_chibios.yml index b00eb9e443..18b5614d37 100644 --- a/.github/workflows/test_chibios.yml +++ b/.github/workflows/test_chibios.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove non chibios HAL diff --git a/.github/workflows/test_linux_sbc.yml b/.github/workflows/test_linux_sbc.yml index 47d6e0e694..500b23ce0c 100644 --- a/.github/workflows/test_linux_sbc.yml +++ b/.github/workflows/test_linux_sbc.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove non LINUX HAL diff --git a/.github/workflows/test_replay.yml b/.github/workflows/test_replay.yml index c2edad8dd9..36bbad80c4 100644 --- a/.github/workflows/test_replay.yml +++ b/.github/workflows/test_replay.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_sitl_copter.yml b/.github/workflows/test_sitl_copter.yml index 57e2d05e41..0e1971ecc0 100644 --- a/.github/workflows/test_sitl_copter.yml +++ b/.github/workflows/test_sitl_copter.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_sitl_periph.yml b/.github/workflows/test_sitl_periph.yml index 88c4b40702..f4cccba0e9 100644 --- a/.github/workflows/test_sitl_periph.yml +++ b/.github/workflows/test_sitl_periph.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles than copter diff --git a/.github/workflows/test_sitl_plane.yml b/.github/workflows/test_sitl_plane.yml index d0d4f65652..8306c58669 100644 --- a/.github/workflows/test_sitl_plane.yml +++ b/.github/workflows/test_sitl_plane.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_sitl_rover.yml b/.github/workflows/test_sitl_rover.yml index cbfe777ee7..cc3246537a 100644 --- a/.github/workflows/test_sitl_rover.yml +++ b/.github/workflows/test_sitl_rover.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_sitl_sub.yml b/.github/workflows/test_sitl_sub.yml index ceea4cca06..f5c54c0394 100644 --- a/.github/workflows/test_sitl_sub.yml +++ b/.github/workflows/test_sitl_sub.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_sitl_tracker.yml b/.github/workflows/test_sitl_tracker.yml index 75d631aecc..c221f91798 100644 --- a/.github/workflows/test_sitl_tracker.yml +++ b/.github/workflows/test_sitl_tracker.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # remove other vehicles diff --git a/.github/workflows/test_unit_tests.yml b/.github/workflows/test_unit_tests.yml index 833c979bc5..b2e4498d73 100644 --- a/.github/workflows/test_unit_tests.yml +++ b/.github/workflows/test_unit_tests.yml @@ -4,6 +4,7 @@ on: push: branches: - CxPilot + - CxPilot-* - master paths-ignore: # Remove markdown files as irrelevant diff --git a/Tools/Carbonix_scripts/build_no_clean.sh b/Tools/Carbonix_scripts/build_no_clean.sh new file mode 100644 index 0000000000..ef61952fb4 --- /dev/null +++ b/Tools/Carbonix_scripts/build_no_clean.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# This file is mainly used by workflows/cx_build_compare.yml to build the firmware for a specific board without bootloader and clean. + +# Exit immediately if a command exits with a non-zero status +set -e + +# The board to build for is passed as an argument to the script +BOARD=$1 + +if [ "$BOARD" == "CubeOrange" ] || [ "$BOARD" == "CubeOrange-Volanti" ] || [ "$BOARD" == "CubeOrange-Ottano" ] || [ "$BOARD" == "sitl" ] +then + echo "Compiling Plane for $BOARD..." + ./waf plane +else + echo "Compiling AP_Periph for $BOARD..." + ./waf AP_Periph +fi + +echo "Build for $BOARD completed." diff --git a/Tools/Carbonix_scripts/carbonix_waf_build.sh b/Tools/Carbonix_scripts/carbonix_waf_build.sh new file mode 100644 index 0000000000..ab98176e22 --- /dev/null +++ b/Tools/Carbonix_scripts/carbonix_waf_build.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Exit if any command fails +set -e + +echo "Running distclean..." +./waf distclean + +main_boards=("CubeOrange" "CubeOrange-Volanti" "CubeOrange-Ottano") +for board in "${main_boards[@]}"; do + echo "Compiling ArduPlane for $board..." + ./waf configure --board "$board" --define=CARBOPILOT=1 + ./waf plane +done + +periph_boards=("CarbonixF405" "CarbonixF405-no-crystal") + +# Build all periph board with custom parameters +for board in "${periph_boards[@]}"; do + for file in $(find libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/ -name "*.parm"); do + # Extract the filename without the extension + filename=$(basename -- "$file") + filename="${filename%.*}" + # Extract the Parent folder name + foldername=$(basename -- "$(dirname -- "$file")") + echo "Compiling AP_Periph for $board with $filename with foldername $foldername..." + # Create extra hwdef file + printf "undef CAN_APP_NODE_NAME\ndefine CAN_APP_NODE_NAME \"$board-$filename\"" > temp.hwdef + + # Compile AP_Periph for each board + echo "Compiling AP_Periph for $board with $filename..." + ./waf configure --board "$board" --define=CARBOPILOT=1 --extra-hwdef=temp.hwdef --default-parameters="$file" + ./waf AP_Periph + + # Rename build outputs + mkdir -p output/$foldername/${filename}_$board + # Move all the files (not folders) in build/$board/bin to build/$board/bin/$filename + find build/$board/bin -maxdepth 1 -type f -exec mv {} output/$foldername/${filename}_$board \; + # Move default $file in the output folder + cp $file output/$foldername/${filename}_$board + + # Cleanup + rm temp.hwdef + done +done + +# Build all Default periph board +for board in "${periph_boards[@]}"; do + echo "Compiling AP_Periph for $board..." + ./waf configure --board "$board" --define=CARBOPILOT=1 + ./waf AP_Periph +done + +echo "Script completed successfully." diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 270242a7cc..ef92dcc1ff 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -10831,6 +10831,7 @@ def disabled_tests(self): "GroundEffectCompensation_takeOffExpected": "Flapping", "GroundEffectCompensation_touchDownExpected": "Flapping", "FlyMissionTwice": "See https://github.com/ArduPilot/ardupilot/pull/18561", + "GyroFFTAverage": "Feature disabled, see https://github.com/ardupilot/ardupilot/commit/a4835634e043b1038f04226d219ac4a4fdd87897", "CANGPSCopterMission": "CX temporary : JIRA - SW-317" } diff --git a/Tools/scripts/cygwin_build.sh b/Tools/scripts/cygwin_build.sh index 4a4b6bf129..a6283d5fb8 100755 --- a/Tools/scripts/cygwin_build.sh +++ b/Tools/scripts/cygwin_build.sh @@ -17,11 +17,13 @@ $GPP_COMPILER -print-sysroot SYS_ROOT=$($GPP_COMPILER -print-sysroot) echo "SYS_ROOT=$SYS_ROOT" +git config --global --add safe.directory /cygdrive/d/a/carbopilot_V2/carbopilot_V2 + rm -rf artifacts mkdir artifacts ( - python ./waf --color yes --toolchain $TOOLCHAIN --board sitl configure 2>&1 + python ./waf --color yes --toolchain $TOOLCHAIN --board sitl configure --define CARBOPILOT=1 2>&1 python ./waf plane 2>&1 ) | tee artifacts/build.txt # python ./waf copter 2>&1 @@ -29,15 +31,20 @@ mkdir artifacts # python ./waf rover 2>&1 # python ./waf sub 2>&1 +# Get Carbonix version number to name the exe file +FIRMWARE_VERSION=$(grep -oP '#define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_Common/CxVersion.h)-$(git rev-parse --short HEAD) + # copy both with exe and without to cope with differences # between windows versions in CI -cp -v build/sitl/bin/arduplane artifacts/ArduPlane.elf.exe +cp -v build/sitl/bin/arduplane artifacts/${FIRMWARE_VERSION}.exe + +# cp -v build/sitl/bin/arduplane artifacts/ArduPlane.elf.exe # cp -v build/sitl/bin/arducopter artifacts/ArduCopter.elf.exe # cp -v build/sitl/bin/arducopter-heli artifacts/ArduHeli.elf.exe # cp -v build/sitl/bin/ardurover artifacts/ArduRover.elf.exe # cp -v build/sitl/bin/ardusub artifacts/ArduSub.elf.exe -cp -v build/sitl/bin/arduplane artifacts/ArduPlane.elf +# cp -v build/sitl/bin/arduplane artifacts/ArduPlane.elf # cp -v build/sitl/bin/arducopter artifacts/ArduCopter.elf # cp -v build/sitl/bin/arducopter-heli artifacts/ArduHeli.elf # cp -v build/sitl/bin/ardurover artifacts/ArduRover.elf @@ -52,5 +59,25 @@ for exe in artifacts/*.exe; do done done +# Process Carbonix SITL parameters +for file in libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/sitl_params/*.parm +do + destfolder=artifacts/$(basename $file .parm)-${FIRMWARE_VERSION} + mkdir -p $destfolder + outfile=$destfolder/defaults.parm + echo "Processing $(basename $file)" + + # Run parse_sitl_params.py script passing full path to .parm file and output folder + python Tools/Carbonix_scripts/process_sitl_defaults.py $file $outfile + + # Create batch script to launch SITL with the correct parameters + if [[ $file == *"realflight"* ]]; then + model="flightaxis" + else + model="quadplane" + fi + printf "rem Launch at Eli Field\r\n..\\${FIRMWARE_VERSION}.exe -O 40.0594626,-88.5513292,206.0,0 --serial0 tcp:0 -M ${model} --defaults defaults.parm\r\n" > $destfolder/launch.bat +done + git log -1 > artifacts/git.txt ls -l artifacts/