From 11972b31dd00ca355f4fdd48a34522c3fb62725a Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Tue, 4 Jan 2022 19:57:29 +0100 Subject: [PATCH 1/9] Completely refactored CI workflow --- .github/workflows/analysis.yml | 88 ------ .github/workflows/userconfigs.yml | 66 ---- .github/workflows/workflow.yml | 485 ++++++++++++++++++++++++++++++ 3 files changed, 485 insertions(+), 154 deletions(-) delete mode 100644 .github/workflows/analysis.yml delete mode 100644 .github/workflows/userconfigs.yml create mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml deleted file mode 100644 index cf11761..0000000 --- a/.github/workflows/analysis.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Analysis -on: - push: - release: - types: - - created -# pull_request: -# types: [opened, synchronize, reopened] - -jobs: - build: - runs-on: ubuntu-latest - env: - SONAR_SCANNER_VERSION: 4.4.0.2170 - SONAR_SERVER_URL: "https://sonarcloud.io" - BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed - SONAR_CACHE_DIR: sonar_cache - strategy: - fail-fast: false - matrix: - node: [allfeatures] - name: ${{ matrix.node }} - steps: - - - name: Checkout (without submodules) - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - - name: Set up JDK 11 (for Sonar) - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Download and set up sonar-scanner - env: - SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip - run: | - mkdir -p $HOME/.sonar - curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH - - - name: Download and set up build-wrapper (for Sonar) - env: - BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip - run: | - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ - echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH - - - name: Checkout and install esp-idf - uses: 0xFEEDC0DE64/checkout_install_esp_idf@main - - - name: Fast Submodule Checkout components/arduino-esp32 - uses: 0xFEEDC0DE64/fast_submodule_checkout@main - with: - submodule: components/arduino-esp32 - - - name: Checkout remaining submodules - run: git submodule update --init --recursive $(git submodule | awk '{ if ($2 != "esp-idf" && $2 != "components/arduino-esp32") print $2 }') - - - name: Setup ccache - uses: 0xFEEDC0DE64/setup_ccache@main - with: - key: ${{ runner.os }}-ccache-${{ matrix.node }} - - - - name: Build firmware - run: | - export CCACHE_MAXSIZE=400M CCACHE_BASEDIR="$(pwd)" - . export.sh - ./switchconf.sh ${{ matrix.node }} - build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} idf.py --ccache build - ccache -s - - - name: Cache sonar - uses: 0xFEEDC0DE64/cache-with-update@update-cache-on-cachehit - with: - path: ${{ env.SONAR_SERVER_URL }} - key: ${{ runner.os }}-sonar-${{ matrix.node }} - - - name: Run sonar-scanner - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: | - sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" --define sonar.cfamily.cache.path="${{ env.SONAR_CACHE_DIR }}" diff --git a/.github/workflows/userconfigs.yml b/.github/workflows/userconfigs.yml deleted file mode 100644 index 523b7ba..0000000 --- a/.github/workflows/userconfigs.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build -on: - push: - release: - types: - - created - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [feedc0de, comred, peter, mick, nofeatures] # allfeatures not used here - name: ${{ matrix.node }} - steps: - - - name: Checkout (without submodules) - uses: actions/checkout@v2 - - - name: Checkout and install esp-idf - uses: 0xFEEDC0DE64/checkout_install_esp_idf@main - - - name: Fast Submodule Checkout components/arduino-esp32 - uses: 0xFEEDC0DE64/fast_submodule_checkout@main - with: - submodule: components/arduino-esp32 - - - name: Checkout remaining submodules - run: git submodule update --init --recursive $(git submodule | awk '{ if ($2 != "esp-idf" && $2 != "components/arduino-esp32") print $2 }') - - - name: Setup ccache - uses: 0xFEEDC0DE64/setup_ccache@main - with: - key: ${{ runner.os }}-ccache-${{ matrix.node }} - - - name: Unpack ignore folder - env: - GPG_KEY: ${{ secrets.GPG_KEY }} - run: | - tools/bobby-decrypt - - - name: Build firmware - run: | - export CCACHE_MAXSIZE=400M CCACHE_BASEDIR="$(pwd)" - . export.sh - ./switchconf.sh ${{ matrix.node }} - idf.py --ccache build - ccache -s - - - name: Set outputs - id: vars - run: | - echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - - - name: Upload Build Artifact - uses: actions/upload-artifact@v2.2.4 - with: - name: bobbyquad_${{ matrix.node }} - path: | - build_${{ matrix.node }}/bobbyquad_${{ matrix.node }}.bin - build_${{ matrix.node }}/bobbyquad_${{ matrix.node }}.elf - build_${{ matrix.node }}/bootloader/bootloader.bin - build_${{ matrix.node }}/bootloader/bootloader.elf - build_${{ matrix.node }}/partition_table/partition-table.bin diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..935123b --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,485 @@ +name: CI +on: + push: + release: + types: + - created +# pull_request: +# types: [opened, synchronize, reopened] + + +jobs: + checkout: + runs-on: ubuntu-latest + name: Checkout (with submodules) + steps: + - name: Cache repository + uses: actions/cache@v2 + id: cache-repository + with: + path: repository + key: ${{ runner.os }}-repository-${{ github.sha }} + + - name: Checkout (without submodules) + uses: actions/checkout@v2 + with: + path: repository + + - name: Fast Submodule Checkout esp-idf + uses: 0xFEEDC0DE64/fast_submodule_checkout@main + with: + submodule: esp-idf + repo: repository + + - name: Fast Submodule Checkout components/arduino-esp32 + uses: 0xFEEDC0DE64/fast_submodule_checkout@main + with: + submodule: components/arduino-esp32 + repo: repository + + - name: Checkout remaining submodules + run: git -C repository submodule update --init --recursive $(git -C repository submodule | awk '{ if ($2 != "esp-idf" && $2 != "components/arduino-esp32") print $2 }') + + checkout-history: + runs-on: ubuntu-latest + name: Checkout (with history and submodules) + steps: + - name: Cache repository + uses: actions/cache@v2 + id: cache-repository + with: + path: repository + key: ${{ runner.os }}-repository-history-${{ github.sha }} + + - name: Checkout (without submodules) + uses: actions/checkout@v2 + with: + path: repository + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Fast Submodule Checkout esp-idf + uses: 0xFEEDC0DE64/fast_submodule_checkout@main + with: + submodule: esp-idf + repo: repository + + - name: Fast Submodule Checkout components/arduino-esp32 + uses: 0xFEEDC0DE64/fast_submodule_checkout@main + with: + submodule: components/arduino-esp32 + repo: repository + + - name: Checkout remaining submodules + run: git -C repository submodule update --init --recursive $(git -C repository submodule | awk '{ if ($2 != "esp-idf" && $2 != "components/arduino-esp32") print $2 }') + + install-idf: + runs-on: ubuntu-latest + name: Install esp-idf + needs: + - checkout + steps: + - name: Cache repository + uses: actions/cache@v2 + id: cache-repository + with: + path: repository + key: ${{ runner.os }}-repository-${{ github.sha }} + + - name: Verify that "Cache repostory" had a hit + # GitHub doesnt support if + #if: steps.cache-repository.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-repository.outputs.cache-hit }} | grep -c "true" + then + echo "Cache repository had a hit, good" + else + echo "Cache repository did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Get esp-idf release name + id: get-esp-idf-release + uses: 0xFEEDC0DE64/get_latest_tag@main + with: + repo: repository/esp-idf + + - name: Cache .espressif + id: cache-espressif + uses: actions/cache@v2 + with: + path: ~/.espressif + key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} + + - name: Install .espressif dependencies + # GitHub doesnt support if + #if: steps.cache-espressif.outputs.cache-hit != 'true' + #run: $(realpath -s "repository/esp-idf")/install.sh + run: | + if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" + then + echo "Cache hit - skipping esp-idf install" + else + $(realpath -s "repository/esp-idf")/install.sh + fi + # seems there is a caching issue sometimes, install.sh should be fast if already installed + #$(realpath -s "repository/esp-idf")/install.sh + shell: bash + + install-sonar-scanner: + runs-on: ubuntu-latest + env: + SONAR_SCANNER_VERSION: 4.4.0.2170 + name: Install sonar-scanner + steps: + - name: Cache sonar-scanner + uses: actions/cache@v2 + id: cache-sonar-scanner + with: + path: sonar-scanner + key: ${{ runner.os }}-sonar-scanner-${{ env.SONAR_SCANNER_VERSION }} + + - name: Download and set up sonar-scanner + env: + SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip + # GitHub doesnt support if + #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + #run: $(realpath -s "repository/esp-idf")/install.sh + run: | + if echo ${{ steps.cache-sonar-scanner.outputs.cache-hit }} | grep -c "true" + then + echo "Cache hit - skipping sonar-scanner download" + else + curl -sSLo sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} + unzip -o sonar-scanner.zip -d sonar-scanner/ + echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH + fi + + install-sonar-build-wrapper: + runs-on: ubuntu-latest + name: Install sonar-build-wrapper + steps: + - name: Cache sonar-build-wrapper + uses: actions/cache@v2 + id: cache-sonar-build-wrapper + with: + path: sonar-build-wrapper + key: ${{ runner.os }}-sonar-build-wrapper + + - name: Download and set up build-wrapper (for Sonar) + env: + BUILD_WRAPPER_DOWNLOAD_URL: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip + # GitHub doesnt support if + #if: steps.cache-sonar-build-wrapper.outputs.cache-hit != 'true' + #run: $(realpath -s "repository/esp-idf")/install.sh + run: | + if echo ${{ steps.cache-sonar-build-wrapper.outputs.cache-hit }} | grep -c "true" + then + echo "Cache hit - skipping sonar-build-wrapper download" + else + curl -sSLo build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} + unzip -o build-wrapper-linux-x86.zip -d sonar-build-wrapper/ + echo "$(pwd)/sonar-build-wrapper/build-wrapper-linux-x86" >> $GITHUB_PATH + fi + + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node: [feedc0de, comred, peter, mick, nofeatures] + name: ${{ matrix.node }} + needs: + - checkout + - install-idf + steps: + - name: Cache repository + uses: actions/cache@v2 + id: cache-repository + with: + path: repository + key: ${{ runner.os }}-repository-${{ github.sha }} + + - name: Verify that "Cache repostory" had a hit + # GitHub doesnt support if + #if: steps.cache-repository.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-repository.outputs.cache-hit }} | grep -c "true" + then + echo "Cache repository had a hit, good" + else + echo "Cache repository did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Get esp-idf release name + id: get-esp-idf-release + uses: 0xFEEDC0DE64/get_latest_tag@main + with: + repo: repository/esp-idf + + - name: Cache .espressif + id: cache-espressif + uses: actions/cache@v2 + with: + path: ~/.espressif + key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} + + - name: Verify that "Cache .espressif" had a hit + # GitHub doesnt support if + #if: steps.cache-espressif.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" + then + echo "Cache .espressif had a hit, good" + else + echo "Cache .espressif did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Setup ccache + uses: 0xFEEDC0DE64/setup_ccache@main + with: + key: ${{ runner.os }}-ccache-${{ matrix.node }} + + - name: Unpack ignore folder + env: + GPG_KEY: ${{ secrets.GPG_KEY }} + run: | + if [[ "${{ matrix.node }}" == "comred" ]] || [[ "${{ matrix.node }}" == "peter" ]] + then + echo Unpacking ignore folder... + cd repository + tools/bobby-decrypt + fi + + - name: Build firmware + run: | + cd repository + export CCACHE_MAXSIZE=400M CCACHE_BASEDIR="$(pwd)" + . export.sh + ./switchconf.sh ${{ matrix.node }} + idf.py --ccache build + ccache -s + + - name: Set outputs + id: vars + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + + - name: Upload Build Artifact + uses: actions/upload-artifact@v2.2.4 + with: + name: bobbyquad_${{ matrix.node }} + path: | + repository/build_${{ matrix.node }}/bobbyquad_${{ matrix.node }}.bin + repository/build_${{ matrix.node }}/bobbyquad_${{ matrix.node }}.elf + + build-analyze: + runs-on: ubuntu-latest + env: + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory + name: allfeatures + needs: + - checkout-history + - install-idf + - install-sonar-build-wrapper + steps: + - name: Cache repository + uses: actions/cache@v2 + id: cache-repository + with: + path: repository + key: ${{ runner.os }}-repository-history-${{ github.sha }} + + - name: Verify that "Cache repostory" had a hit + # GitHub doesnt support if + #if: steps.cache-repository.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-repository.outputs.cache-hit }} | grep -c "true" + then + echo "Cache repository had a hit, good" + else + echo "Cache repository did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Get esp-idf release name + id: get-esp-idf-release + uses: 0xFEEDC0DE64/get_latest_tag@main + with: + repo: repository/esp-idf + + - name: Cache .espressif + id: cache-espressif + uses: actions/cache@v2 + with: + path: ~/.espressif + key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} + + - name: Verify that "Cache .espressif" had a hit + # GitHub doesnt support if + #if: steps.cache-espressif.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" + then + echo "Cache .espressif had a hit, good" + else + echo "Cache .espressif did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Cache sonar-build-wrapper + uses: actions/cache@v2 + id: cache-sonar-build-wrapper + with: + path: sonar-build-wrapper + key: ${{ runner.os }}-sonar-build-wrapper + + - name: Verify that "Cache sonar-build-wrapper" had a hit + # GitHub doesnt support if + #if: steps.cache-sonar-build-wrapper.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-sonar-build-wrapper.outputs.cache-hit }} | grep -c "true" + then + echo "Cache sonar-build-wrapper had a hit, good" + else + echo "Cache sonar-build-wrapper did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Cache sonar-build-wrapper-output + uses: actions/cache@v2 + id: cache-sonar-build-wrapper-output + with: + path: repository + key: ${{ runner.os }}-sonar-build-wrapper-output-${{ github.sha }} + + - name: Set up JDK 11 (for Sonar) + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Setup sonar-build-wrapper + run: | + echo "$(pwd)/sonar-build-wrapper/build-wrapper-linux-x86" >> $GITHUB_PATH + + - name: Setup ccache + uses: 0xFEEDC0DE64/setup_ccache@main + with: + key: ${{ runner.os }}-ccache-allfeatures + + - name: Build firmware + run: | + cd repository + export CCACHE_MAXSIZE=400M CCACHE_BASEDIR="$(pwd)" + . export.sh + ./switchconf.sh allfeatures + build-wrapper-linux-x86-64 --out-dir "${{ env.BUILD_WRAPPER_OUT_DIR }}" idf.py --ccache build + ccache -s + + - name: Set outputs + id: vars + run: | + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + + - name: Upload Build Artifact + uses: actions/upload-artifact@v2.2.4 + with: + name: bobbyquad_allfeatures + path: | + repository/build_allfeatures/bobbyquad_allfeatures.bin + repository/build_allfeatures/bobbyquad_allfeatures.elf + + analyze: + runs-on: ubuntu-latest + env: + SONAR_SCANNER_VERSION: 4.4.0.2170 + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory + SONAR_CACHE_DIR: sonar_cache + name: Analyze + needs: + - checkout-history + - install-sonar-scanner + - build-analyze + steps: + - name: Cache sonar-build-wrapper-output + uses: actions/cache@v2 + id: cache-sonar-build-wrapper-output + with: + path: repository + key: ${{ runner.os }}-sonar-build-wrapper-output-${{ github.sha }} + + - name: Verify that "Cache sonar-build-wrapper-output" had a hit + # GitHub doesnt support if + #if: steps.cache-sonar-build-wrapper-output.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-sonar-build-wrapper-output.outputs.cache-hit }} | grep -c "true" + then + echo "Cache sonar-build-wrapper-output had a hit, good" + else + echo "Cache sonar-build-wrapper-output did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Cache sonar-scanner + uses: actions/cache@v2 + id: cache-sonar-scanner + with: + path: sonar-scanner + key: ${{ runner.os }}-sonar-scanner-${{ env.SONAR_SCANNER_VERSION }} + + - name: Verify that "Cache sonar-scanner" had a hit + # GitHub doesnt support if + #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-sonar-scanner.outputs.cache-hit }} | grep -c "true" + then + echo "Cache sonar-scanner had a hit, good" + else + echo "Cache sonar-scanner did not hit? Did the prepare step run successfully?" + exit 1 + fi + shell: bash + + - name: Set up JDK 11 (for Sonar) + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Setup sonar-scanner + run: | + echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH + + - name: Cache sonar-scanner + uses: 0xFEEDC0DE64/cache-with-update@update-cache-on-cachehit + with: + path: ${{ env.SONAR_CACHE_DIR }} + key: ${{ runner.os }}-sonar-scanner-cache-${{ env.SONAR_SCANNER_VERSION }} + + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + cd repository + sonar-scanner \ + --define sonar.host.url="https://sonarcloud.io" \ + --define sonar.cfamily.build-wrapper-output="../${{ env.BUILD_WRAPPER_OUT_DIR }}" \ + --define sonar.cfamily.cache.path="../${{ env.SONAR_CACHE_DIR }}" From 9992bc7286e423b6d9d03ded0ad9f13464c16fcd Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Tue, 4 Jan 2022 20:07:21 +0100 Subject: [PATCH 2/9] Fixed wrong build wrapper ouput dir in workflow.yml --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 935123b..1862775 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -481,5 +481,5 @@ jobs: cd repository sonar-scanner \ --define sonar.host.url="https://sonarcloud.io" \ - --define sonar.cfamily.build-wrapper-output="../${{ env.BUILD_WRAPPER_OUT_DIR }}" \ + --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ --define sonar.cfamily.cache.path="../${{ env.SONAR_CACHE_DIR }}" From 626d44894d2dbc560b9ebed31a73882ddfd0e940 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Tue, 4 Jan 2022 20:12:17 +0100 Subject: [PATCH 3/9] Smaller fixes in workflow.yml --- .github/workflows/workflow.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 1862775..f505bd4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -261,7 +261,7 @@ jobs: - name: Build firmware run: | cd repository - export CCACHE_MAXSIZE=400M CCACHE_BASEDIR="$(pwd)" + export CCACHE_MAXSIZE=1024M CCACHE_BASEDIR="$(pwd)" . export.sh ./switchconf.sh ${{ matrix.node }} idf.py --ccache build @@ -373,8 +373,7 @@ jobs: java-version: 11 - name: Setup sonar-build-wrapper - run: | - echo "$(pwd)/sonar-build-wrapper/build-wrapper-linux-x86" >> $GITHUB_PATH + run: echo "$(pwd)/sonar-build-wrapper/build-wrapper-linux-x86" >> $GITHUB_PATH - name: Setup ccache uses: 0xFEEDC0DE64/setup_ccache@main @@ -384,7 +383,7 @@ jobs: - name: Build firmware run: | cd repository - export CCACHE_MAXSIZE=400M CCACHE_BASEDIR="$(pwd)" + export CCACHE_MAXSIZE=1024M CCACHE_BASEDIR="$(pwd)" . export.sh ./switchconf.sh allfeatures build-wrapper-linux-x86-64 --out-dir "${{ env.BUILD_WRAPPER_OUT_DIR }}" idf.py --ccache build @@ -464,10 +463,9 @@ jobs: java-version: 11 - name: Setup sonar-scanner - run: | - echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH + run: echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH - - name: Cache sonar-scanner + - name: Cache sonar-scanner-cache uses: 0xFEEDC0DE64/cache-with-update@update-cache-on-cachehit with: path: ${{ env.SONAR_CACHE_DIR }} From e6ab72154678de86ad50c42b55526e02876032f7 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 9 Jan 2022 01:23:52 +0100 Subject: [PATCH 4/9] Keine ahnung wie viel ich gemacht hab --- .github/workflows/workflow.yml | 104 +++++++-------------------------- 1 file changed, 21 insertions(+), 83 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f505bd4..fc3b145 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -86,18 +86,8 @@ jobs: key: ${{ runner.os }}-repository-${{ github.sha }} - name: Verify that "Cache repostory" had a hit - # GitHub doesnt support if - #if: steps.cache-repository.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} - run: | - if echo ${{ steps.cache-repository.outputs.cache-hit }} | grep -c "true" - then - echo "Cache repository had a hit, good" - else - echo "Cache repository did not hit? Did the prepare step run successfully?" - exit 1 - fi - shell: bash + if: ${{ steps.cache-repository.outputs.cache-hit != 'true' }} + run: exit 1 - name: Get esp-idf release name id: get-esp-idf-release @@ -113,19 +103,8 @@ jobs: key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} - name: Install .espressif dependencies - # GitHub doesnt support if - #if: steps.cache-espressif.outputs.cache-hit != 'true' - #run: $(realpath -s "repository/esp-idf")/install.sh - run: | - if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" - then - echo "Cache hit - skipping esp-idf install" - else - $(realpath -s "repository/esp-idf")/install.sh - fi - # seems there is a caching issue sometimes, install.sh should be fast if already installed - #$(realpath -s "repository/esp-idf")/install.sh - shell: bash + if: ${{ steps.cache-espressif.outputs.cache-hit != 'true' }} + run: repository/esp-idf/install.sh install-sonar-scanner: runs-on: ubuntu-latest @@ -143,18 +122,11 @@ jobs: - name: Download and set up sonar-scanner env: SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip - # GitHub doesnt support if - #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' - #run: $(realpath -s "repository/esp-idf")/install.sh - run: | - if echo ${{ steps.cache-sonar-scanner.outputs.cache-hit }} | grep -c "true" - then - echo "Cache hit - skipping sonar-scanner download" - else - curl -sSLo sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} - unzip -o sonar-scanner.zip -d sonar-scanner/ - echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH - fi + if: ${{ steps.cache-sonar-scanner.outputs.cache-hit != 'true' }} + run: + curl -sSLo sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} + unzip -o sonar-scanner.zip -d sonar-scanner/ + echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH install-sonar-build-wrapper: runs-on: ubuntu-latest @@ -170,18 +142,11 @@ jobs: - name: Download and set up build-wrapper (for Sonar) env: BUILD_WRAPPER_DOWNLOAD_URL: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip - # GitHub doesnt support if - #if: steps.cache-sonar-build-wrapper.outputs.cache-hit != 'true' - #run: $(realpath -s "repository/esp-idf")/install.sh + if: ${{ steps.cache-sonar-build-wrapper.outputs.cache-hit != 'true' }} run: | - if echo ${{ steps.cache-sonar-build-wrapper.outputs.cache-hit }} | grep -c "true" - then - echo "Cache hit - skipping sonar-build-wrapper download" - else - curl -sSLo build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} - unzip -o build-wrapper-linux-x86.zip -d sonar-build-wrapper/ - echo "$(pwd)/sonar-build-wrapper/build-wrapper-linux-x86" >> $GITHUB_PATH - fi + curl -sSLo build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} + unzip -o build-wrapper-linux-x86.zip -d sonar-build-wrapper/ + echo "$(pwd)/sonar-build-wrapper/build-wrapper-linux-x86" >> $GITHUB_PATH build: runs-on: ubuntu-latest @@ -202,18 +167,8 @@ jobs: key: ${{ runner.os }}-repository-${{ github.sha }} - name: Verify that "Cache repostory" had a hit - # GitHub doesnt support if - #if: steps.cache-repository.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} - run: | - if echo ${{ steps.cache-repository.outputs.cache-hit }} | grep -c "true" - then - echo "Cache repository had a hit, good" - else - echo "Cache repository did not hit? Did the prepare step run successfully?" - exit 1 - fi - shell: bash + if: ${{ steps.cache-repository.outputs.cache-hit != 'true' }} + run: exit 1 - name: Get esp-idf release name id: get-esp-idf-release @@ -240,7 +195,6 @@ jobs: echo "Cache .espressif did not hit? Did the prepare step run successfully?" exit 1 fi - shell: bash - name: Setup ccache uses: 0xFEEDC0DE64/setup_ccache@main @@ -250,13 +204,11 @@ jobs: - name: Unpack ignore folder env: GPG_KEY: ${{ secrets.GPG_KEY }} + if: ${{ matrix.node == 'comred' || matrix.node == 'peter' || matrix.node == 'mick' }} run: | - if [[ "${{ matrix.node }}" == "comred" ]] || [[ "${{ matrix.node }}" == "peter" ]] - then - echo Unpacking ignore folder... - cd repository - tools/bobby-decrypt - fi + echo Unpacking ignore folder... + cd repository + tools/bobby-decrypt - name: Build firmware run: | @@ -299,18 +251,8 @@ jobs: key: ${{ runner.os }}-repository-history-${{ github.sha }} - name: Verify that "Cache repostory" had a hit - # GitHub doesnt support if - #if: steps.cache-repository.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} - run: | - if echo ${{ steps.cache-repository.outputs.cache-hit }} | grep -c "true" - then - echo "Cache repository had a hit, good" - else - echo "Cache repository did not hit? Did the prepare step run successfully?" - exit 1 - fi - shell: bash + if: ${{ steps.cache-repository.outputs.cache-hit != 'true' }} + run: exit 1 - name: Get esp-idf release name id: get-esp-idf-release @@ -337,7 +279,6 @@ jobs: echo "Cache .espressif did not hit? Did the prepare step run successfully?" exit 1 fi - shell: bash - name: Cache sonar-build-wrapper uses: actions/cache@v2 @@ -358,7 +299,6 @@ jobs: echo "Cache sonar-build-wrapper did not hit? Did the prepare step run successfully?" exit 1 fi - shell: bash - name: Cache sonar-build-wrapper-output uses: actions/cache@v2 @@ -434,7 +374,6 @@ jobs: echo "Cache sonar-build-wrapper-output did not hit? Did the prepare step run successfully?" exit 1 fi - shell: bash - name: Cache sonar-scanner uses: actions/cache@v2 @@ -455,7 +394,6 @@ jobs: echo "Cache sonar-scanner did not hit? Did the prepare step run successfully?" exit 1 fi - shell: bash - name: Set up JDK 11 (for Sonar) uses: actions/setup-java@v1 From 9421847f9b27b7569868eaa053c094ff0f1039c8 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 9 Jan 2022 01:33:40 +0100 Subject: [PATCH 5/9] test --- .github/workflows/workflow.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index fc3b145..1f79103 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -375,6 +375,32 @@ jobs: exit 1 fi + - name: Get esp-idf release name + id: get-esp-idf-release + uses: 0xFEEDC0DE64/get_latest_tag@main + with: + repo: repository/esp-idf + + - name: Cache .espressif + id: cache-espressif + uses: actions/cache@v2 + with: + path: ~/.espressif + key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} + + - name: Verify that "Cache .espressif" had a hit + # GitHub doesnt support if + #if: steps.cache-espressif.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" + then + echo "Cache .espressif had a hit, good" + else + echo "Cache .espressif did not hit? Did the prepare step run successfully?" + exit 1 + fi + - name: Cache sonar-scanner uses: actions/cache@v2 id: cache-sonar-scanner From 592974935e6b5e9c91f4337cf502abed6a6ba2db Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Thu, 13 Jan 2022 09:58:10 +0100 Subject: [PATCH 6/9] Forgot pipe symbol --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 1f79103..fff7a9f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -123,7 +123,7 @@ jobs: env: SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip if: ${{ steps.cache-sonar-scanner.outputs.cache-hit != 'true' }} - run: + run: | curl -sSLo sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} unzip -o sonar-scanner.zip -d sonar-scanner/ echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH From 2f13a1b8b1a818928b3816a9014001ad6d886699 Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Thu, 13 Jan 2022 10:54:52 +0100 Subject: [PATCH 7/9] Combined analysis --- .github/workflows/workflow.yml | 88 ++-------------------------------- 1 file changed, 4 insertions(+), 84 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index fff7a9f..024acea 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -233,15 +233,18 @@ jobs: repository/build_${{ matrix.node }}/bobbyquad_${{ matrix.node }}.bin repository/build_${{ matrix.node }}/bobbyquad_${{ matrix.node }}.elf - build-analyze: + build-and-analyze: runs-on: ubuntu-latest env: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory + SONAR_SCANNER_VERSION: 4.4.0.2170 + SONAR_CACHE_DIR: sonar_cache name: allfeatures needs: - checkout-history - install-idf - install-sonar-build-wrapper + - install-sonar-scanner steps: - name: Cache repository uses: actions/cache@v2 @@ -343,89 +346,6 @@ jobs: repository/build_allfeatures/bobbyquad_allfeatures.bin repository/build_allfeatures/bobbyquad_allfeatures.elf - analyze: - runs-on: ubuntu-latest - env: - SONAR_SCANNER_VERSION: 4.4.0.2170 - BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory - SONAR_CACHE_DIR: sonar_cache - name: Analyze - needs: - - checkout-history - - install-sonar-scanner - - build-analyze - steps: - - name: Cache sonar-build-wrapper-output - uses: actions/cache@v2 - id: cache-sonar-build-wrapper-output - with: - path: repository - key: ${{ runner.os }}-sonar-build-wrapper-output-${{ github.sha }} - - - name: Verify that "Cache sonar-build-wrapper-output" had a hit - # GitHub doesnt support if - #if: steps.cache-sonar-build-wrapper-output.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} - run: | - if echo ${{ steps.cache-sonar-build-wrapper-output.outputs.cache-hit }} | grep -c "true" - then - echo "Cache sonar-build-wrapper-output had a hit, good" - else - echo "Cache sonar-build-wrapper-output did not hit? Did the prepare step run successfully?" - exit 1 - fi - - - name: Get esp-idf release name - id: get-esp-idf-release - uses: 0xFEEDC0DE64/get_latest_tag@main - with: - repo: repository/esp-idf - - - name: Cache .espressif - id: cache-espressif - uses: actions/cache@v2 - with: - path: ~/.espressif - key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} - - - name: Verify that "Cache .espressif" had a hit - # GitHub doesnt support if - #if: steps.cache-espressif.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} - run: | - if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" - then - echo "Cache .espressif had a hit, good" - else - echo "Cache .espressif did not hit? Did the prepare step run successfully?" - exit 1 - fi - - - name: Cache sonar-scanner - uses: actions/cache@v2 - id: cache-sonar-scanner - with: - path: sonar-scanner - key: ${{ runner.os }}-sonar-scanner-${{ env.SONAR_SCANNER_VERSION }} - - - name: Verify that "Cache sonar-scanner" had a hit - # GitHub doesnt support if - #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} - run: | - if echo ${{ steps.cache-sonar-scanner.outputs.cache-hit }} | grep -c "true" - then - echo "Cache sonar-scanner had a hit, good" - else - echo "Cache sonar-scanner did not hit? Did the prepare step run successfully?" - exit 1 - fi - - - name: Set up JDK 11 (for Sonar) - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Setup sonar-scanner run: echo "$(pwd)/sonar-scanner/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH From 940c0769773ded41ad39b3facd525c5c2bbe65ad Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Thu, 13 Jan 2022 11:06:14 +0100 Subject: [PATCH 8/9] Forgot to download cache --- .github/workflows/workflow.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 024acea..8a29989 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -283,6 +283,26 @@ jobs: exit 1 fi + - name: Cache sonar-scanner + uses: actions/cache@v2 + id: cache-sonar-scanner + with: + path: sonar-scanner + key: ${{ runner.os }}-sonar-scanner-${{ env.SONAR_SCANNER_VERSION }} + + - name: Verify that "Cache sonar-scanner" had a hit + # GitHub doesnt support if + #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + #run: git submodule update --init --recursive ${{ inputs.submodule }} + run: | + if echo ${{ steps.cache-sonar-scanner.outputs.cache-hit }} | grep -c "true" + then + echo "Cache sonar-scanner had a hit, good" + else + echo "Cache sonar-scanner did not hit? Did the prepare step run successfully?" + exit 1 + fi + - name: Cache sonar-build-wrapper uses: actions/cache@v2 id: cache-sonar-build-wrapper From 8b91e63f4707f6ee668b9583e143e2a0780f66ad Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Thu, 13 Jan 2022 13:54:36 +0100 Subject: [PATCH 9/9] Removed 'github does not support ifs' --- .github/workflows/workflow.yml | 52 ++++++++-------------------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 8a29989..03f6f4d 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -184,17 +184,10 @@ jobs: key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} - name: Verify that "Cache .espressif" had a hit - # GitHub doesnt support if - #if: steps.cache-espressif.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} + if: ${{ steps.cache-espressif.outputs.cache-hit != 'true' }} run: | - if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" - then - echo "Cache .espressif had a hit, good" - else - echo "Cache .espressif did not hit? Did the prepare step run successfully?" - exit 1 - fi + echo "Cache .espressif did not hit? Did the prepare step run successfully?" + exit 1 - name: Setup ccache uses: 0xFEEDC0DE64/setup_ccache@main @@ -271,17 +264,10 @@ jobs: key: ${{ runner.os }}-espressif-${{ steps.get-esp-idf-release.outputs.tag_name }} - name: Verify that "Cache .espressif" had a hit - # GitHub doesnt support if - #if: steps.cache-espressif.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} + if: ${{ steps.cache-espressif.outputs.cache-hit != 'true' }} run: | - if echo ${{ steps.cache-espressif.outputs.cache-hit }} | grep -c "true" - then - echo "Cache .espressif had a hit, good" - else - echo "Cache .espressif did not hit? Did the prepare step run successfully?" - exit 1 - fi + echo "Cache .espressif did not hit? Did the prepare step run successfully?" + exit 1 - name: Cache sonar-scanner uses: actions/cache@v2 @@ -291,17 +277,10 @@ jobs: key: ${{ runner.os }}-sonar-scanner-${{ env.SONAR_SCANNER_VERSION }} - name: Verify that "Cache sonar-scanner" had a hit - # GitHub doesnt support if - #if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} + if: ${{ steps.cache-sonar-scanner.outputs.cache-hit != 'true' }} run: | - if echo ${{ steps.cache-sonar-scanner.outputs.cache-hit }} | grep -c "true" - then - echo "Cache sonar-scanner had a hit, good" - else - echo "Cache sonar-scanner did not hit? Did the prepare step run successfully?" - exit 1 - fi + echo "Cache sonar-scanner did not hit? Did the prepare step run successfully?" + exit 1 - name: Cache sonar-build-wrapper uses: actions/cache@v2 @@ -311,17 +290,10 @@ jobs: key: ${{ runner.os }}-sonar-build-wrapper - name: Verify that "Cache sonar-build-wrapper" had a hit - # GitHub doesnt support if - #if: steps.cache-sonar-build-wrapper.outputs.cache-hit != 'true' - #run: git submodule update --init --recursive ${{ inputs.submodule }} + if: ${{ steps.cache-sonar-build-wrapper.outputs.cache-hit != 'true' }} run: | - if echo ${{ steps.cache-sonar-build-wrapper.outputs.cache-hit }} | grep -c "true" - then - echo "Cache sonar-build-wrapper had a hit, good" - else - echo "Cache sonar-build-wrapper did not hit? Did the prepare step run successfully?" - exit 1 - fi + echo "Cache sonar-build-wrapper did not hit? Did the prepare step run successfully?" + exit 1 - name: Cache sonar-build-wrapper-output uses: actions/cache@v2