From 0c2830e36b33bf554aeafecf354819036e82550d Mon Sep 17 00:00:00 2001 From: Mario Mariete <11509521+melkati@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:20:21 +0100 Subject: [PATCH 1/2] Add ESP32 S3 support to workflows --- .github/workflows/release3.yml | 212 +++++++++++++++++++++++++++++++++ platformio.ini | 2 +- 2 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release3.yml diff --git a/.github/workflows/release3.yml b/.github/workflows/release3.yml new file mode 100644 index 00000000..ef10460b --- /dev/null +++ b/.github/workflows/release3.yml @@ -0,0 +1,212 @@ +name: Release V2.2 + +# # # # # # # # # # # +# To create new release, just push a new tag with the format v* (v1.0, v2.0, v2.1, v2.2, etc) +# +# In a terminal in platformIO do, for example: +# git tag -a v7.0.005 -m "For general release v0.7.005" +# git push origin v7.0.005 +# # # # # # # # # # # + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + + # get_default_envs: + # name: Gather Environments + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: actions/setup-python@v2 + # - name: Install PlatformIO + # run: | + # pip install -U platformio + # platformio update + # - name: Dump github context + # run: echo "$GITHUB_CONTEXT" + # shell: bash + # env: + # GITHUB_CONTEXT: ${{ toJson(github) }} + # - name: Get default environments + # id: envs + # run: | + # echo "::set-output name=environments::$(pio project config --json-output | jq -cr '.[0][1][0][1]')" + # echo ${{ steps.envs.outputs.environments }} + # outputs: + # environments: ${{ steps.envs.outputs.environments }} + + build: + name: Create Release + + runs-on: ubuntu-latest + # needs: get_default_envs + + strategy: + matrix: + # environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }} + environment: [esp32dev, esp32dev_OLED, TTGO_TDISPLAY, TTGO_TDISPLAY_SANDWICH, TDISPLAY_S3] + # environment: [TTGO_TDISPLAY_SANDWICH] + # environment: [esp32dev, esp32dev-sandwich] + # environment: [esp32dev-sandwich] + + env: + ENVIRONMENT: ${{ matrix.environment == 'TDISPLAY_S3' && 'ESP32S3' || 'ESP32' }} + + timeout-minutes: 30 # time out after 30 minutes (default is 360 minutes) + + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Show enviroments + run: | + echo + + - name: Determine chipFamily + id: determine_chip_family + run: | + case "${{ matrix.environment }}" in + "esp32dev") + CHIP_FAMILY="ESP32";; + "TDISPLAY_S3") + CHIP_FAMILY="ESP32-S3";; + # Add more cases for other environments as needed + *) + CHIP_FAMILY="UNKNOWN";; + esac + echo "::set-output name=chipFamily::${CHIP_FAMILY}" + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -U platformio + platformio update + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + + - name: Show version + run: echo ${{ steps.get_version.outputs.VERSION }} + + - name: Get current date + id: date + run: | + echo "::set-output name=date::$(date +'%d-%m-%Y')" + echo "::set-output name=time::$(date +'%H:%M:%S')" + + - name: Create manifest file + id: createmanifest + run: | + + # Define offset values based on env.ENVIRONMENT + if [[ "${{ env.ENVIRONMENT }}" == "ESP32S3" ]]; then + bootloader_offset=0 + partitions_offset=32768 + app0_offset=57344 + firmware_offset=65536 + spiffs_offset=3997696 + else + # Default values for ESP32 or other environments + bootloader_offset=4096 + partitions_offset=32768 + app0_offset=57344 + firmware_offset=65536 + spiffs_offset=3997696 + fi + + # Create manifest + echo " \"name\": \"${{ github.event.repository.name }}-${{ matrix.environment }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"flavour\": \"${{ matrix.environment }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"version\": \"${{ steps.get_version.outputs.VERSION }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"compilation_date\": \"${{ steps.date.outputs.date }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"compilation_time\": \"${{ steps.date.outputs.time }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"new_install_prompt_erase\": true," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"new_install_improv_wait_time\": 10," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"builds\": [" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " {" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"chipFamily\": \"${{ env.ENVIRONMENT }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"improv\": true," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"parts\": [" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-bootloader.bin\", \"offset\": $bootloader_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-partitions.bin\", \"offset\": $partitions_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-app0.bin\", \"offset\": $app0_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-firmware.bin\", \"offset\": $firmware_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-spiffs.bin\", \"offset\": $spiffs_offset }" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " ]" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " }" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " ]" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo "}" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo "::set-output name=manifest::$(cat ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json)" + + - name: Read manifest files + run: | + echo "Manifest:" + echo ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo "Manifest file contents readed with cat:" + cat ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + + - name: Copy manifest files + if: startsWith(github.ref, 'refs/tags/') + run: | + mkdir ./firmware + cp ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + + - name: Build firmware file + run: | + pio run -e ${{ matrix.environment }} + + - name: Copy firmware files + if: startsWith(github.ref, 'refs/tags/') + run: | + cp .pio/build/${{ matrix.environment }}/bootloader.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-bootloader.bin + cp .pio/build/${{ matrix.environment }}/partitions.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-partitions.bin + cp .pio/build/${{ matrix.environment }}/firmware.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-firmware.bin + + - name: Build spiffs file + run: | + pio run -e ${{ matrix.environment }} -t buildfs + + - name: Copy spiffs files + if: startsWith(github.ref, 'refs/tags/') + run: | + ls -la ./firmware + cp .pio/build/${{ matrix.environment }}/spiffs.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-spiffs.bin + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + name: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.VERSION }} + files: | + ./firmware/*.bin + ./firmware/*.json + draft: false + # prerelease: true + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_ACTION_TOKEN }} + - name: 📂 Sync files - FTP-Deploy-Action + uses: SamKirkland/FTP-Deploy-Action@2.0.0 + env: + FTP_SERVER: ${{ secrets.FTP_SERVER }} + FTP_USERNAME: ${{ secrets.FTP_USER }} + FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} + LOCAL_DIR: ./firmware/ + REMOTE_DIR: /${{ github.event.repository.name }}/ + METHOD: ftp + PORT: 21 + ARGS: --verbose + - name: Clean eMariete.com Cache + run: curl https://emariete.com/clean_cache.php diff --git a/platformio.ini b/platformio.ini index 5b6a2041..25bee446 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,7 +57,7 @@ build_flags = -D MQTT_BROKER_SERVER="\"192.168.1.145"\" -D CO2_GADGET_VERSION="\"0.8."\" - -D CO2_GADGET_REV="\"076-development"\" + -D CO2_GADGET_REV="\"079-development"\" -D CORE_DEBUG_LEVEL=0 -DNEOPIXEL_PIN=26 ; Pinnumber for button for down/next and back / exit actions -DNEOPIXEL_COUNT=16 ; How many neopixels to control From c3fc76c17d03e2689aad6751913d06c430b7b60c Mon Sep 17 00:00:00 2001 From: Mario Mariete <11509521+melkati@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:21:48 +0100 Subject: [PATCH 2/2] Add ESP32 S3 support to workflows --- .github/workflows/release3.yml | 212 +++++++++++++++++++++++++++++++++ platformio.ini | 2 +- 2 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release3.yml diff --git a/.github/workflows/release3.yml b/.github/workflows/release3.yml new file mode 100644 index 00000000..250a96d3 --- /dev/null +++ b/.github/workflows/release3.yml @@ -0,0 +1,212 @@ +name: Release V2.3 + +# # # # # # # # # # # +# To create new release, just push a new tag with the format v* (v1.0, v2.0, v2.1, v2.2, etc) +# +# In a terminal in platformIO do, for example: +# git tag -a v7.0.005 -m "For general release v0.7.005" +# git push origin v7.0.005 +# # # # # # # # # # # + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + + # get_default_envs: + # name: Gather Environments + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: actions/setup-python@v2 + # - name: Install PlatformIO + # run: | + # pip install -U platformio + # platformio update + # - name: Dump github context + # run: echo "$GITHUB_CONTEXT" + # shell: bash + # env: + # GITHUB_CONTEXT: ${{ toJson(github) }} + # - name: Get default environments + # id: envs + # run: | + # echo "::set-output name=environments::$(pio project config --json-output | jq -cr '.[0][1][0][1]')" + # echo ${{ steps.envs.outputs.environments }} + # outputs: + # environments: ${{ steps.envs.outputs.environments }} + + build: + name: Create Release + + runs-on: ubuntu-latest + # needs: get_default_envs + + strategy: + matrix: + # environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }} + environment: [esp32dev, esp32dev_OLED, TTGO_TDISPLAY, TTGO_TDISPLAY_SANDWICH, TDISPLAY_S3] + # environment: [TTGO_TDISPLAY_SANDWICH] + # environment: [esp32dev, esp32dev-sandwich] + # environment: [esp32dev-sandwich] + + env: + ENVIRONMENT: ${{ matrix.environment == 'TDISPLAY_S3' && 'ESP32S3' || 'ESP32' }} + + timeout-minutes: 30 # time out after 30 minutes (default is 360 minutes) + + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Show enviroments + run: | + echo + + - name: Determine chipFamily + id: determine_chip_family + run: | + case "${{ matrix.environment }}" in + "esp32dev") + CHIP_FAMILY="ESP32";; + "TDISPLAY_S3") + CHIP_FAMILY="ESP32-S3";; + # Add more cases for other environments as needed + *) + CHIP_FAMILY="UNKNOWN";; + esac + echo "::set-output name=chipFamily::${CHIP_FAMILY}" + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -U platformio + platformio update + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + + - name: Show version + run: echo ${{ steps.get_version.outputs.VERSION }} + + - name: Get current date + id: date + run: | + echo "::set-output name=date::$(date +'%d-%m-%Y')" + echo "::set-output name=time::$(date +'%H:%M:%S')" + + - name: Create manifest file + id: createmanifest + run: | + + # Define offset values based on env.ENVIRONMENT + if [[ "${{ env.ENVIRONMENT }}" == "ESP32S3" ]]; then + bootloader_offset=0 + partitions_offset=32768 + app0_offset=57344 + firmware_offset=65536 + spiffs_offset=3997696 + else + # Default values for ESP32 or other environments + bootloader_offset=4096 + partitions_offset=32768 + app0_offset=57344 + firmware_offset=65536 + spiffs_offset=3997696 + fi + + # Create manifest + echo " \"name\": \"${{ github.event.repository.name }}-${{ matrix.environment }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"flavour\": \"${{ matrix.environment }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"version\": \"${{ steps.get_version.outputs.VERSION }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"compilation_date\": \"${{ steps.date.outputs.date }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"compilation_time\": \"${{ steps.date.outputs.time }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"new_install_prompt_erase\": true," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"new_install_improv_wait_time\": 10," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"builds\": [" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " {" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"chipFamily\": \"${{ env.ENVIRONMENT }}\"," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"improv\": true," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " \"parts\": [" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-bootloader.bin\", \"offset\": $bootloader_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-partitions.bin\", \"offset\": $partitions_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-app0.bin\", \"offset\": $app0_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-firmware.bin\", \"offset\": $firmware_offset }," >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " { \"path\": \"${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-spiffs.bin\", \"offset\": $spiffs_offset }" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " ]" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " }" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo " ]" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo "}" >> ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo "::set-output name=manifest::$(cat ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json)" + + - name: Read manifest files + run: | + echo "Manifest:" + echo ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + echo "Manifest file contents readed with cat:" + cat ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + + - name: Copy manifest files + if: startsWith(github.ref, 'refs/tags/') + run: | + mkdir ./firmware + cp ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json + + - name: Build firmware file + run: | + pio run -e ${{ matrix.environment }} + + - name: Copy firmware files + if: startsWith(github.ref, 'refs/tags/') + run: | + cp .pio/build/${{ matrix.environment }}/bootloader.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-bootloader.bin + cp .pio/build/${{ matrix.environment }}/partitions.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-partitions.bin + cp .pio/build/${{ matrix.environment }}/firmware.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-firmware.bin + + - name: Build spiffs file + run: | + pio run -e ${{ matrix.environment }} -t buildfs + + - name: Copy spiffs files + if: startsWith(github.ref, 'refs/tags/') + run: | + ls -la ./firmware + cp .pio/build/${{ matrix.environment }}/spiffs.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-spiffs.bin + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + name: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.VERSION }} + files: | + ./firmware/*.bin + ./firmware/*.json + draft: false + # prerelease: true + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_ACTION_TOKEN }} + - name: 📂 Sync files - FTP-Deploy-Action + uses: SamKirkland/FTP-Deploy-Action@2.0.0 + env: + FTP_SERVER: ${{ secrets.FTP_SERVER }} + FTP_USERNAME: ${{ secrets.FTP_USER }} + FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} + LOCAL_DIR: ./firmware/ + REMOTE_DIR: /${{ github.event.repository.name }}/ + METHOD: ftp + PORT: 21 + ARGS: --verbose + - name: Clean eMariete.com Cache + run: curl https://emariete.com/clean_cache.php diff --git a/platformio.ini b/platformio.ini index 5b6a2041..25bee446 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,7 +57,7 @@ build_flags = -D MQTT_BROKER_SERVER="\"192.168.1.145"\" -D CO2_GADGET_VERSION="\"0.8."\" - -D CO2_GADGET_REV="\"076-development"\" + -D CO2_GADGET_REV="\"079-development"\" -D CORE_DEBUG_LEVEL=0 -DNEOPIXEL_PIN=26 ; Pinnumber for button for down/next and back / exit actions -DNEOPIXEL_COUNT=16 ; How many neopixels to control