espressif / esp-idf-ci-action

GitHub Action for ESP32 CI
MIT License
67 stars 24 forks source link

Using custom partition table alter the build folder access (RDT-440) #30

Closed DDANPEAL closed 1 year ago

DDANPEAL commented 1 year ago

I have the following action in my Github repository for esp32 project

name: Build firmware

on:
  push:
    branches: [master]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v3
        with:
          submodules: 'recursive'
          fetch-depth: 0 
      - name: esp-idf build
        uses: espressif/esp-idf-ci-action@v1
        with:
          esp_idf_version: v4.3
          target: esp32

      - name: Get latest tag name
        id: version_value
        run: |
          tag=$(git describe --tags --abbrev=0 --match "v*")
          echo "value=${tag:1}" >> $GITHUB_OUTPUT
      - name: folder settings
        run: ls -l /

      - name: build folder settings
        run: ls -l build

      - name: Build and Export Binaries
        env:
          version_value: ${{ steps.version_value.outputs.value }} 
        run: |
          sudo chmod a+w build
          mv build/*.bin build/"${version_value}".bin
          cp build/*.bin ${{github.workspace}}/

        working-directory: ${{github.workspace}}

      - name: Upload Artifacts
        uses: actions/upload-artifact@v3
        with:
          name: ESP-IDF Binaries
          path: |
            *.bin

This works well and I can see the artifacts when using the default sdkconfig ( partition table only )

#
# Partition Table
#
CONFIG_PARTITION_TABLE_SINGLE_APP=y
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
# CONFIG_PARTITION_TABLE_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table

Changing the above part to

#
# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table

I get the following error

STEP : Build and Export Binaries

Run sudo chmod a+w build
  sudo chmod a+w build
  mv build/*.bin build/"${version_value}".bin
  cp build/*.bin /home/runner/work/esp_idf_build_test/esp_idf_build_test/
  shell: /usr/bin/bash -e {0}
  env:
    version_value: 0.0.[2](https://github.com/DDANPEAL/esp_idf_build_test/actions/runs/4671260641/jobs/8272013396#step:7:2)
mv: target 'build/0.0.2.bin' is not a directory
Error: Process completed with exit code 1.

I'm not sure how further I can investigate this ! I check folders permission for when it fails or success and didn't see any changes

kumekay commented 1 year ago

Hello @DDANPEAL

Are you sure you have only one .bin file in esp_idf_build_test?

Probably the error you are receiving is because the mv command is attempting to move files to a target that it expects to be a directory, but instead, it's a file.

It looks like the output is not from the exact workflow version posted at the top of the message because the mv and cp lines are swapped.

DDANPEAL commented 1 year ago

Thank you @kumekay for the tips. Indeed I have multiple bin files but somehow is was working for one case and not for the other ! I changed my workflow to mv specific file by its name instead of wild card