forked from Aircoookie/WLED
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release engineering improvements (Aircoookie#1844)
* version set from package.json and release bin names * support direnv virtualenv * versioned PlatformIO environment * matrix support for parralel CI * gather artifacts * release on tagging * minor scripts formatting
- Loading branch information
Showing
11 changed files
with
216 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
layout python-venv python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
.clang-format | ||
node_modules | ||
.idea | ||
.direnv |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Import('env') | ||
import os | ||
import shutil | ||
import gzip | ||
|
||
OUTPUT_DIR = "build_output{}".format(os.path.sep) | ||
|
||
def _get_cpp_define_value(env, define): | ||
define_list = [item[-1] for item in env["CPPDEFINES"] if item[0] == define] | ||
|
||
if define_list: | ||
return define_list[0] | ||
|
||
return None | ||
|
||
def _create_dirs(dirs=["firmware", "map"]): | ||
# check if output directories exist and create if necessary | ||
if not os.path.isdir(OUTPUT_DIR): | ||
os.mkdir(OUTPUT_DIR) | ||
|
||
for d in dirs: | ||
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)): | ||
os.mkdir("{}{}".format(OUTPUT_DIR, d)) | ||
|
||
def bin_rename_copy(source, target, env): | ||
_create_dirs() | ||
variant = env["PIOENV"] | ||
|
||
# create string with location and file names based on variant | ||
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant) | ||
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) | ||
|
||
release_name = _get_cpp_define_value(env, "WLED_RELEASE_NAME") | ||
|
||
if release_name and os.getenv("WLED_RELEASE"): | ||
_create_dirs(["release"]) | ||
version = _get_cpp_define_value(env, "WLED_VERSION") | ||
release_file = "{}release{}WLED_{}_{}.bin".format(OUTPUT_DIR, os.path.sep, version, release_name) | ||
shutil.copy(str(target[0]), release_file) | ||
|
||
# check if new target files exist and remove if necessary | ||
for f in [map_file, bin_file]: | ||
if os.path.isfile(f): | ||
os.remove(f) | ||
|
||
# copy firmware.bin to firmware/<variant>.bin | ||
shutil.copy(str(target[0]), bin_file) | ||
|
||
# copy firmware.map to map/<variant>.map | ||
if os.path.isfile("firmware.map"): | ||
shutil.move("firmware.map", map_file) | ||
|
||
def bin_gzip(source, target, env): | ||
_create_dirs() | ||
variant = env["PIOENV"] | ||
|
||
# create string with location and file names based on variant | ||
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) | ||
gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant) | ||
|
||
# check if new target files exist and remove if necessary | ||
if os.path.isfile(gzip_file): os.remove(gzip_file) | ||
|
||
# write gzip firmware file | ||
with open(bin_file,"rb") as fp: | ||
with gzip.open(gzip_file, "wb", compresslevel = 9) as f: | ||
shutil.copyfileobj(fp, f) | ||
|
||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy, bin_gzip]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Import('env') | ||
import json | ||
|
||
PACKAGE_FILE = "package.json" | ||
|
||
with open(PACKAGE_FILE, "r") as package: | ||
version = json.load(package)["version"] | ||
env.Append(BUILD_FLAGS=[f"-DWLED_VERSION={version}"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,10 +151,11 @@ build_flags = -g | |
-DCONFIG_LITTLEFS_FOR_IDF_3_2 | ||
|
||
[scripts_defaults] | ||
extra_scripts = pio-scripts/name-firmware.py | ||
pio-scripts/gzip-firmware.py | ||
pio-scripts/strip-floats.py | ||
pio-scripts/user_config_copy.py | ||
extra_scripts = | ||
pre:pio-scripts/set_version.py | ||
post:pio-scripts/output_bins.py | ||
post:pio-scripts/strip-floats.py | ||
pre:pio-scripts/user_config_copy.py | ||
|
||
# ------------------------------------------------------------------------------ | ||
# COMMON SETTINGS: | ||
|
@@ -213,15 +214,15 @@ platform = ${common.platform_wled_default} | |
platform_packages = ${common.platform_packages} | ||
board_build.ldscript = ${common.ldscript_4m1m} | ||
build_unflags = ${common.build_unflags} | ||
build_flags = ${common.build_flags_esp8266} | ||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 | ||
|
||
[env:esp01_1m_full] | ||
board = esp01_1m | ||
platform = ${common.platform_wled_default} | ||
platform_packages = ${common.platform_packages} | ||
board_build.ldscript = ${common.ldscript_1m128k} | ||
build_unflags = ${common.build_unflags} | ||
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA | ||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA | ||
|
||
[env:esp07] | ||
board = esp07 | ||
|
@@ -261,7 +262,7 @@ build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED | |
board = esp32dev | ||
platform = [email protected] | ||
build_unflags = ${common.build_unflags} | ||
build_flags = ${common.build_flags_esp32} | ||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 | ||
lib_ignore = | ||
ESPAsyncTCP | ||
ESPAsyncUDP | ||
|
@@ -271,7 +272,7 @@ board = esp32-poe | |
platform = [email protected] | ||
upload_speed = 921600 | ||
build_unflags = ${common.build_unflags} | ||
build_flags = ${common.build_flags_esp32} -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 | ||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 | ||
lib_ignore = | ||
ESPAsyncTCP | ||
ESPAsyncUDP | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
platformio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# This file is autogenerated by pip-compile | ||
# To update, run: | ||
# | ||
# pip-compile | ||
# | ||
aiofiles==0.6.0 | ||
# via platformio | ||
ajsonrpc==1.1.0 | ||
# via platformio | ||
bottle==0.12.19 | ||
# via platformio | ||
certifi==2020.12.5 | ||
# via requests | ||
chardet==4.0.0 | ||
# via requests | ||
click==7.1.2 | ||
# via | ||
# platformio | ||
# uvicorn | ||
colorama==0.4.4 | ||
# via platformio | ||
h11==0.12.0 | ||
# via | ||
# uvicorn | ||
# wsproto | ||
idna==2.10 | ||
# via requests | ||
ifaddr==0.1.7 | ||
# via zeroconf | ||
marshmallow==3.11.1 | ||
# via platformio | ||
platformio==5.1.1 | ||
# via -r requirements.in | ||
pyelftools==0.27 | ||
# via platformio | ||
pyserial==3.5 | ||
# via platformio | ||
requests==2.25.1 | ||
# via platformio | ||
semantic-version==2.8.5 | ||
# via platformio | ||
starlette==0.14.2 | ||
# via platformio | ||
tabulate==0.8.9 | ||
# via platformio | ||
urllib3==1.26.4 | ||
# via requests | ||
uvicorn==0.13.4 | ||
# via platformio | ||
wsproto==1.0.0 | ||
# via platformio | ||
zeroconf==0.28.8 | ||
# via platformio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters