From b9247df206a9c133f7cac3a8f043ecf36aeec426 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 5 Oct 2022 14:37:48 +0200 Subject: [PATCH 1/3] CI: Update travis to build/test with cmake Include the new cmake-based build in travis. Split the build into 3 stages: cmake, legacy and tests. cmake: new cmake-based build (*all* variants, including english only) legacy: old build.sh based build (using arduino-builder) tests: cmake tests (not terribly useful at the moment) --- .github/travis/cmake-build.sh | 10 ++++++ .github/travis/cmake-test.sh | 8 +++++ .github/travis/legacy-build.sh | 22 +++++++++++++ .travis.yml | 57 ++++++++++++++++++++-------------- 4 files changed, 74 insertions(+), 23 deletions(-) create mode 100755 .github/travis/cmake-build.sh create mode 100755 .github/travis/cmake-test.sh create mode 100755 .github/travis/legacy-build.sh diff --git a/.github/travis/cmake-build.sh b/.github/travis/cmake-build.sh new file mode 100755 index 000000000..e0746b5ea --- /dev/null +++ b/.github/travis/cmake-build.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -xe +rm -rf build +mkdir build +cd build +cmake .. \ + -DCMAKE_TOOLCHAIN_FILE="../cmake/LocalAvrGcc.cmake" \ + -DCMAKE_BUILD_TYPE=Release \ + -G Ninja +ninja ALL_FIRMWARE diff --git a/.github/travis/cmake-test.sh b/.github/travis/cmake-test.sh new file mode 100755 index 000000000..ec41633b3 --- /dev/null +++ b/.github/travis/cmake-test.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -xe +rm -rf build +mkdir build +cd build +cmake .. -G Ninja +ninja tests +ctest diff --git a/.github/travis/legacy-build.sh b/.github/travis/legacy-build.sh new file mode 100755 index 000000000..063ef62ec --- /dev/null +++ b/.github/travis/legacy-build.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -xe +cp Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h +bash -x build.sh || { echo "1_75mm_MK3S-EINSy10a-E3Dv6full variant failed" && false; } +bash -x build.sh EN_FARM || { echo "1_75mm_MK3S-EINSy10a-E3Dv6full EN_FARM failed" && false; } +rm Firmware/Configuration_prusa.h +cp Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h +bash -x build.sh || { echo "1_75mm_MK3-EINSy10a-E3Dv6full variant failed" && false; } +bash -x build.sh EN_FARM || { echo "1_75mm_MK3-EINSy10a-E3Dv6full EN_FARM failed" && false; } +rm Firmware/Configuration_prusa.h +cp Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h +bash -x build.sh || { echo "1_75mm_MK25S-RAMBo13a-E3Dv6full variant failed" && false; } +rm Firmware/Configuration_prusa.h +cp Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h +bash -x build.sh || { echo "1_75mm_MK25S-RAMBo10a-E3Dv6full variant failed" && false; } +rm Firmware/Configuration_prusa.h +cp Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h +bash -x build.sh || { echo "1_75mm_MK25-RAMBo13a-E3Dv6full variant failed" && false; } +rm Firmware/Configuration_prusa.h +cp Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h +bash -x build.sh || { echo "1_75mm_MK25-RAMBo10a-E3Dv6full variant failed" && false; } +rm Firmware/Configuration_prusa.h diff --git a/.travis.yml b/.travis.yml index ba5f91e3e..fc58712cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,42 @@ dist: focal + before_install: - - sudo apt-get install -y ninja-build python3-polib python3-pyelftools - # Arduino IDE adds a lot of noise caused by network traffic, trying to firewall it off + # Prepare the dependencies for the old build environment + - sudo apt-get install -y python3-polib python3-pyelftools python3-regex + + # Undo whatever *GARBAGE* travis is doing with python and restore the system version + - mkdir -p .dependencies/python3 + - ln -sf /usr/bin/python3 .dependencies/python3/python3 + - PATH=$PWD/.dependencies/python3:$PATH + + # Bootstrap cmake/ninja for the new build environment + - ./utils/bootstrap.py + - PATH=$(./utils/bootstrap.py --print-dependency-directory "cmake")/bin:$PATH + - PATH=$(./utils/bootstrap.py --print-dependency-directory "ninja"):$PATH + + # Arduino IDE adds a lot of noise caused by network traffic, firewall it off - sudo iptables -P INPUT DROP - sudo iptables -P FORWARD DROP - sudo iptables -P OUTPUT ACCEPT - sudo iptables -A INPUT -i lo -j ACCEPT - sudo iptables -A OUTPUT -o lo -j ACCEPT - sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT -script: - - cp Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h - - bash -x build.sh || { echo "1_75mm_MK3S-EINSy10a-E3Dv6full variant failed" && false; } - - bash -x build.sh EN_FARM || { echo "1_75mm_MK3S-EINSy10a-E3Dv6full EN_FARM failed" && false; } - - rm Firmware/Configuration_prusa.h - - cp Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h - - bash -x build.sh || { echo "1_75mm_MK3-EINSy10a-E3Dv6full variant failed" && false; } - - bash -x build.sh EN_FARM || { echo "1_75mm_MK3-EINSy10a-E3Dv6full EN_FARM failed" && false; } - - rm Firmware/Configuration_prusa.h - - cp Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h - - bash -x build.sh || { echo "1_75mm_MK25S-RAMBo13a-E3Dv6full variant failed" && false; } - - rm Firmware/Configuration_prusa.h - - cp Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h - - bash -x build.sh || { echo "1_75mm_MK25S-RAMBo10a-E3Dv6full variant failed" && false; } - - rm Firmware/Configuration_prusa.h - - cp Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h - - bash -x build.sh || { echo "1_75mm_MK25-RAMBo13a-E3Dv6full variant failed" && false; } - - rm Firmware/Configuration_prusa.h - - cp Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h - - bash -x build.sh || { echo "1_75mm_MK25-RAMBo10a-E3Dv6full variant failed" && false; } - - rm Firmware/Configuration_prusa.h + +jobs: + include: + # legacy build.sh environment + - stage: legacy + script: ./.github/travis/legacy-build.sh + + # cmake-based build + - stage: cmake + script: ./.github/travis/cmake-build.sh + + # cmake tests + - stage: tests + script: ./.github/travis/cmake-test.sh + +stages: + - cmake + - legacy + - tests From 82ded37916610d3fe6264bbfb8c78a09cb9fb451 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 5 Oct 2022 22:57:08 +0200 Subject: [PATCH 2/3] CI: Switch to a minimal image --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fc58712cb..c886dce23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ dist: focal +language: minimal before_install: # Prepare the dependencies for the old build environment From cf576e98bfc7f8e88e6fe8a51a74f606bc946ab1 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 5 Oct 2022 23:31:07 +0200 Subject: [PATCH 3/3] cleanup: Remove obsolete test.sh Replaced by cmake tests --- test.sh | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100755 test.sh diff --git a/test.sh b/test.sh deleted file mode 100755 index 90047e2d4..000000000 --- a/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -cd .. || exit 5 - -if [ ! -d "Prusa-Firmware-test" ]; then - mkdir Prusa-Firmware-test || exit 10 -fi - -cd Prusa-Firmware-test || exit 20 - -cmake -G "Eclipse CDT4 - Ninja" ../Prusa-Firmware || exit 30 -cmake --build . || exit 35 -./tests || exit 40 \ No newline at end of file