Create zip (#39)

* feat: testing craetezip script

* feat: testing craetezip script

* feat: testing craetezip script

* feat: testing craetezip script

* feat: testing createzip script

* feat: testing createzip script

* chore(minor): 1.4.0-create-zip.1 [skip ci]

## [1.4.0-create-zip.1](https://github.com/lorow/OpenIris/compare/v1.3.0...v1.4.0-create-zip.1) (2023-01-31)

### 🍕 Features

* testing craetezip script ([7db8063](7db8063291))
* testing craetezip script ([2584e37](2584e37ffa))
* testing craetezip script ([174e9ae](174e9aebe7))
* testing craetezip script ([0d2b56e](0d2b56e62f))
* testing createzip script ([c7d3ed7](c7d3ed7b79))
* testing createzip script ([4eb4758](4eb4758147))

* feat: testing createzip script

* chore(minor): 1.4.0-create-zip.2 [skip ci]

## [1.4.0-create-zip.2](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.1...v1.4.0-create-zip.2) (2023-01-31)

### 🍕 Features

* testing createzip script ([fb9c35d](fb9c35dda9))

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* feat: testing createzip script

* chore(minor): 1.4.0-create-zip.3 [skip ci]

## [1.4.0-create-zip.3](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.2...v1.4.0-create-zip.3) (2023-01-31)

### 🍕 Features

* testing createzip script ([1a3ba1b](1a3ba1b47f))
* testing createzip script ([3094c29](3094c29d1f))
* testing createzip script ([af89d4d](af89d4d380))
* testing createzip script ([35bb0f2](35bb0f2935))
* testing createzip script ([ab196c5](ab196c56ac))
* testing createzip script ([c63e223](c63e223002))
* testing createzip script ([9d3fd65](9d3fd65d6f))
* testing createzip script ([ef652f4](ef652f4a92))
* testing createzip script ([bcef340](bcef34014d))
* testing createzip script ([8d4d5cc](8d4d5cc170))
* testing createzip script ([fd6ccdc](fd6ccdcae1))

* fix offset order bug

* fix: firmware binary bundling bug

* chore(patch): 1.4.0-create-zip.4 [skip ci]

## [1.4.0-create-zip.4](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.3...v1.4.0-create-zip.4) (2023-02-01)

### 🐛 Bug Fixes

* firmware binary bundling bug ([6004cdf](6004cdf9b7))

* no-release: cleanup script

* refactor: cleanup script

* chore(patch): 1.4.0-create-zip.5 [skip ci]

## [1.4.0-create-zip.5](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.4...v1.4.0-create-zip.5) (2023-02-02)

### 🧑‍💻 Code Refactoring

* cleanup script ([a2202d6](a2202d6288))

* feat: add detection of environment variable

* chore(minor): 1.4.0-create-zip.6 [skip ci]

## [1.4.0-create-zip.6](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.5...v1.4.0-create-zip.6) (2023-02-02)

### 🍕 Features

* add detection of environment variable ([ca8080e](ca8080e7f1))

* refactor: prepare for merge

---------

Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
This commit is contained in:
DaOfficialWizard 2023-02-02 10:43:53 +00:00 committed by GitHub
parent 8932767f6f
commit 8229a3a1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 183 additions and 67 deletions

View File

@ -3,27 +3,19 @@ on:
push:
branches:
- "master"
- "main"
pull_request:
branches:
- "master"
- "main"
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
target_name: [
esp32AIThinker,
esp32M5Stack,
esp32Cam,
esp_eye,
wrover,
]
target_build_type: [
"",
_release,
_OTA,
]
matrix:
target_name: [esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover]
target_build_type: ["", _release, _OTA]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -40,78 +32,84 @@ jobs:
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
restore-keys: |
${{ runner.os }}-pio-
- name: Setup Python install
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: "3.x"
- name: Install PlatformIO with Pip
run: |
python -m pip install --upgrade pip
pip install distro
pip install --upgrade platformio
pio upgrade --dev
pio pkg update --global
- name: Update build command
working-directory: ./ESP
run: |
sed -i '/\[env\]/p; s/\[env\]/upload_protocol = custom/' platformio.ini
- name: Build OpenIris Firmware
working-directory: ./ESP
run: |
export OPENIRIS_CI_BUILD=1
mkdir build
mkdir build/${{ matrix.target_name }}${{ matrix.target_build_type }}
echo "::group::platformio.ini"
cat platformio.ini
echo "::endgroup::"
echo "::group::pio run"
pio run --environment ${{ matrix.target_name }}${{ matrix.target_build_type }}
#- name: Archive Version File
# uses: actions/upload-artifact@v3
# with:
# name: version
# path: ./ESP/tools/version.txt
echo "::endgroup::"
unzip -l './build/${{ matrix.target_name }}${{ matrix.target_build_type }}/*.zip'
- name: Archive Firmware name File
# create an environment variable with the name of the firmware file by catting the firmware_name.txt file
run: |
echo "FIRMWARE_NAME=$(cat ./ESP/tools/firmware_name.txt)" >> $GITHUB_ENV
- name: Archive Firmware Files
- name: Archive Firmware Binaries
uses: actions/upload-artifact@v3
with:
with:
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware
path: "./ESP/.pio/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.bin"
#path: "./ESP/.pio/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.bin"
path: "./ESP/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.zip"
retention-days: 5
if-no-files-found: error
release-openiris:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Directory
run: mkdir -p build
- name: Download Firmware Files
uses: actions/download-artifact@v2
with:
path: build/
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install -g conventional-changelog-conventionalcommits
- run: npm install -g semantic-release@v19.0.5
- run: npm install -g @semantic-release/exec
- run: npm install -g @semantic-release/git
- run: npm install -g @semantic-release/release-notes-generator
- run: npm install -g @semantic-release/changelog
- run: npm install -g @semantic-release/github
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: semantic-release
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Directory
run: mkdir -p build
- name: Download Firmware Files
uses: actions/download-artifact@v2
with:
path: build/
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install -g conventional-changelog-conventionalcommits
- run: npm install -g semantic-release@v19.0.5
- run: npm install -g @semantic-release/exec
- run: npm install -g @semantic-release/git
- run: npm install -g @semantic-release/release-notes-generator
- run: npm install -g @semantic-release/changelog
- run: npm install -g @semantic-release/github
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: semantic-release
cleanup:
strategy:
fail-fast: false
matrix:
target_name: [
esp32AIThinker,
esp32M5Stack,
esp32Cam,
esp_eye,
wrover,
]
target_build_type: [
"",
_release,
_OTA,
]
matrix:
target_name: [esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover]
target_build_type: ["", _release, _OTA]
name: Cleanup actions
needs:
- release-openiris
@ -121,4 +119,4 @@ jobs:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware

View File

@ -158,7 +158,7 @@
"addReleases": "bottom",
"assets": [
{
"path": "./build/**/*.bin"
"path": "./build/**/*.zip"
}
]
}

View File

@ -3,6 +3,63 @@
[![semantic versioning](https://img.shields.io/badge/semantic%20versioning-2.0.0-green.svg)](https://semver.org)
> All notable changes to this project will be documented in this file
## [1.4.0-create-zip.6](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.5...v1.4.0-create-zip.6) (2023-02-02)
### 🍕 Features
* add detection of environment variable ([ca8080e](https://github.com/lorow/OpenIris/commit/ca8080e7f1727d273f4d135414a1e17d11eaddc8))
## [1.4.0-create-zip.5](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.4...v1.4.0-create-zip.5) (2023-02-02)
### 🧑‍💻 Code Refactoring
* cleanup script ([a2202d6](https://github.com/lorow/OpenIris/commit/a2202d6288a76ab195d7cfb8fc14245d1a4715f9))
## [1.4.0-create-zip.4](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.3...v1.4.0-create-zip.4) (2023-02-01)
### 🐛 Bug Fixes
* firmware binary bundling bug ([6004cdf](https://github.com/lorow/OpenIris/commit/6004cdf9b7c97d7f604f62077751926919059774))
## [1.4.0-create-zip.3](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.2...v1.4.0-create-zip.3) (2023-01-31)
### 🍕 Features
* testing createzip script ([1a3ba1b](https://github.com/lorow/OpenIris/commit/1a3ba1b47ff9b948e69e1ce03119fe1aea65e62e))
* testing createzip script ([3094c29](https://github.com/lorow/OpenIris/commit/3094c29d1fde5d3b16dd7150f9784e07d0093cc3))
* testing createzip script ([af89d4d](https://github.com/lorow/OpenIris/commit/af89d4d38062947fef578970787d1b90e3cea188))
* testing createzip script ([35bb0f2](https://github.com/lorow/OpenIris/commit/35bb0f2935832b2e65a3f0870c8f084daee5fde1))
* testing createzip script ([ab196c5](https://github.com/lorow/OpenIris/commit/ab196c56ac61932144e27d69b181e7c0b25aedc6))
* testing createzip script ([c63e223](https://github.com/lorow/OpenIris/commit/c63e22300215103321b4be6821d9f3902c9dd128))
* testing createzip script ([9d3fd65](https://github.com/lorow/OpenIris/commit/9d3fd65d6f13f22f522d840ce50dad74663891c2))
* testing createzip script ([ef652f4](https://github.com/lorow/OpenIris/commit/ef652f4a923f59134a697ed6dc0228a31b978826))
* testing createzip script ([bcef340](https://github.com/lorow/OpenIris/commit/bcef34014d37b3b974bdd8209b67ae6e9f30cfaf))
* testing createzip script ([8d4d5cc](https://github.com/lorow/OpenIris/commit/8d4d5cc1705628c38b0046201b4ff146f9ba9e20))
* testing createzip script ([fd6ccdc](https://github.com/lorow/OpenIris/commit/fd6ccdcae140dd2fdfd8a4b439cba84282a9832c))
## [1.4.0-create-zip.2](https://github.com/lorow/OpenIris/compare/v1.4.0-create-zip.1...v1.4.0-create-zip.2) (2023-01-31)
### 🍕 Features
* testing createzip script ([fb9c35d](https://github.com/lorow/OpenIris/commit/fb9c35dda9b8447e74673ffb7ed793bd57d9c39e))
## [1.4.0-create-zip.1](https://github.com/lorow/OpenIris/compare/v1.3.0...v1.4.0-create-zip.1) (2023-01-31)
### 🍕 Features
* testing craetezip script ([7db8063](https://github.com/lorow/OpenIris/commit/7db8063291e24926929450ebf8b40778f82a9d97))
* testing craetezip script ([2584e37](https://github.com/lorow/OpenIris/commit/2584e37ffacb2aa2ed915842c03657b85c4dd881))
* testing craetezip script ([174e9ae](https://github.com/lorow/OpenIris/commit/174e9aebe74fdff6fdbe88cf6555c6d1d2ba8555))
* testing craetezip script ([0d2b56e](https://github.com/lorow/OpenIris/commit/0d2b56e62fbd4c7694ee40a06ccfa2ac0dba8eab))
* testing createzip script ([c7d3ed7](https://github.com/lorow/OpenIris/commit/c7d3ed7b79d4da68052b08bc9c9489a7925883b7))
* testing createzip script ([4eb4758](https://github.com/lorow/OpenIris/commit/4eb4758147e021e7e2447eb98a663bd8b4d5de3e))
## [1.3.0](https://github.com/lorow/OpenIris/compare/v1.2.0...v1.3.0) (2023-01-31)

View File

@ -20,7 +20,7 @@
"include": "/lib/src"
},
"dependencies": {},
"version": "1.3.0",
"version": "1.4.0",
"frameworks": "arduino",
"platforms": "espressif32"
}
}

View File

@ -6,4 +6,4 @@ StateManager<WebServerState_e> webServerStateManager;
StateManager<MDNSState_e> mdnsStateManager;
StateManager<CameraState_e> cameraStateManager;
StateManager<LEDStates_e> ledStateManager;
StateManager<StreamState_e> streamStateManager;
StateManager<StreamState_e> streamStateManager;

View File

@ -149,4 +149,4 @@ extern StateManager<CameraState_e> cameraStateManager;
extern StateManager<LEDStates_e> ledStateManager;
extern StateManager<StreamState_e> streamStateManager;
#endif // STATEMANAGER_HPP
#endif // STATEMANAGER_HPP

View File

@ -68,4 +68,6 @@ lib_deps =
https://github.com/me-no-dev/AsyncTCP.git
build_type = debug
extra_scripts = pre:tools/customname.py
extra_scripts =
pre:tools/customname.py
post:tools/createzip.py

59
ESP/tools/createzip.py Normal file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env python3
Import("env")
import sys
import os
from ntpath import basename
from zipfile import ZipFile
import json
def createZip(source, target, env):
if os.getenv("OPENIRIS_CI_BUILD", False):
if sys.platform.lower().startswith(("ubuntu", "linux")):
print("Program has been built, creating zip archive!")
program_path = target[0].get_abspath()
array_args = [env["FLASH_EXTRA_IMAGES"]]
for offset, image in env["FLASH_EXTRA_IMAGES"]:
print("\nImage: %s" % str(image))
array_args.extend([str(offset), str(image)])
array_args.append(env["ESP32_APP_OFFSET"])
array_args.append(program_path)
n = 2
partitions_arg = array_args[1:]
print(f"partitions_args: {partitions_arg}")
partitions = final = [
partitions_arg[i * n : (i + 1) * n]
for i in range((len(partitions_arg) + n - 1) // n)
]
print(f"partitions: {partitions}")
file_name = "./build/{0}/{1}.zip".format(
str(env["PIOENV"]), env["PROGNAME"]
)
with ZipFile(file_name, "w") as archive:
print('\nCreating "' + archive.filename + '"', end="\n")
parts = []
for [offset, path] in partitions:
filename = basename(path)
archive.write(path, filename)
partition = {
"path": filename,
"offset": int(offset, 16),
}
parts.append(partition)
manifest = {
"chipFamily": "ESP32",
"parts": parts,
}
archive.writestr("manifest.json", json.dumps(manifest))
else:
print("Not running on Linux, skipping zip creation")
else:
print("CI build not detected, skipping zip creation")
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", createZip)