update new build

This commit is contained in:
proddy
2021-03-14 17:37:18 +01:00
parent ed38a34151
commit 02d01334b2
8 changed files with 153 additions and 174 deletions

View File

@@ -1,72 +0,0 @@
name: Build ESP32 Dev Firmware
on:
push:
branches:
- esp32_dev
tags:
# - '*.*.*'
paths:
- 'CHANGELOG_LATEST.md'
workflow_dispatch:
branches: [ esp32_dev ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Version
id: fetch_version
run: |
version=`grep -E '^#define EMSESP_APP_VERSION' ./src/version.h | awk '{print $3}' | sed 's/"//g'`
echo "::set-output name=s::$version"
- name: Setup Python
uses: actions/setup-python@v1
- name: Install
run: |
python -m pip install --upgrade pip
pip install -U platformio
platformio upgrade
platformio update
- name: Build web
run: |
cd interface
npm install
npm run build
- name: Build images
run: |
platformio run -e esp32-ci
- name: Delete
uses: dev-drprasad/delete-tag-and-release@v0.1.2
# if: startsWith(github.ref, 'refs/tags/')
with:
delete_release: true
tag_name: esp32_dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Changelog
run: cat RELEASENOTES_DEV.md CHANGELOG_LATEST.md > BODY.txt
- name: Release
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
with:
body_path: BODY.txt
name: ESP32 Development Build v${{steps.fetch_version.outputs.s}}
tag_name: esp32_dev
prerelease: true
files: |
./build/firmware/*.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

59
.github/workflows/pre_release.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: "pre-release"
on:
push:
branches:
- "dev"
jobs:
pre-release:
name: "Automatic pre-release build"
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Get build variables
id: build_info
run: |
version=`grep -E '^#define EMSESP_APP_VERSION' ./src/version.h | awk -F'"' '{print $2}'`
echo "::set-output name=version::$version"
platform=`grep -E '^#define EMSESP_PLATFORM' ./src/version.h | awk -F'"' '{print $2}'`
echo "::set-output name=platform::$platform"
- name: Compile locally
run: make
- name: Setup Python
uses: actions/setup-python@v2
- name: Install pio
run: |
python -m pip install --upgrade pip
pip install -U platformio
platformio upgrade
platformio update
- name: Build web
run: |
cd interface
npm install
npm run build
- name: Build firmware
run: |
platformio run -e ci
- name: Release
id: "automatic_releases"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: ${{steps.build_info.outputs.platform}} Development Build v${{steps.build_info.outputs.version}}
automatic_release_tag: "latest"
prerelease: true
files: |
CHANGELOG_DEV.md

View File

@@ -1,55 +0,0 @@
name: Release Stable ESP32
on:
workflow_dispatch:
branches: [ stable_esp32 ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Version
id: fetch_version
run: |
version=`grep -E '^#define EMSESP_APP_VERSION' ./src/version.h | awk '{print $3}' | sed 's/"//g'`
echo "::set-output name=s::$version"
- name: Setup Python
uses: actions/setup-python@v1
- name: Install
run: |
python -m pip install --upgrade pip
pip install -U platformio
platformio upgrade
platformio update
- name: Build web
run: |
cd interface
npm install
npm run build
- name: Build images
run: |
platformio run -e esp32-ci
- name: Changelog
run: cat RELEASENOTES.md CHANGELOG_LATEST.md > BODY.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: BODY.txt
name: EMS-ESP v${{steps.fetch_version.outputs.s}} (ESP32)
tag_name: v${{steps.fetch_version.outputs.s}}
prerelease: false
files: |
./build/firmware/*.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,22 +0,0 @@
name: Standalone Build
on:
push:
branches: [ esp32_dev ]
paths:
- 'src/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: make clean
run: make clean
- name: make
run: make

56
.github/workflows/tagged_release.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: "tagged-release"
on:
push:
tags:
- "v*"
jobs:
tagged-release:
name: "Tagged Release"
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Get build variables
id: build_info
run: |
version=`grep -E '^#define EMSESP_APP_VERSION' ./src/version.h | awk -F'"' '{print $2}'`
echo "::set-output name=version::$version"
platform=`grep -E '^#define EMSESP_PLATFORM' ./src/version.h | awk -F'"' '{print $2}'`
echo "::set-output name=platform::$platform"
- name: Compile locally
run: make
- name: Setup Python
uses: actions/setup-python@v2
- name: Install pio
run: |
python -m pip install --upgrade pip
pip install -U platformio
platformio upgrade
platformio update
- name: Build web
run: |
cd interface
npm install
npm run build
- name: Build firmware
run: |
platformio run -e ci
- name: Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
CHANGELOG.md
./build/firmware/*.*

View File

@@ -61,7 +61,7 @@ check_flags =
clangtidy: --checks=-*,clang-analyzer-*,performance-* clangtidy: --checks=-*,clang-analyzer-*,performance-*
; build for GitHub Actions CI ; build for GitHub Actions CI
[env:esp32-ci] [env:ci]
extra_scripts = extra_scripts =
scripts/rename_fw.py scripts/rename_fw.py
board = esp32dev board = esp32dev

View File

@@ -1,16 +1,18 @@
Import('env', "projenv") Import("env")
import os import os
import re import re
import shutil import shutil
import gzip
OUTPUT_DIR = "build{}".format(os.path.sep) OUTPUT_DIR = "build{}".format(os.path.sep)
def bin_copy(source, target, env): def bin_copy(source, target, env):
# get the EMS-ESP version # get the build info
bag = {} bag = {}
exprs = [(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version')] exprs = [
(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version'),
(re.compile(r'^#define EMSESP_PLATFORM\s+"(\S+)"'), 'platform'),
]
with open('./src/version.h', 'r') as f: with open('./src/version.h', 'r') as f:
for l in f.readlines(): for l in f.readlines():
for expr, var in exprs: for expr, var in exprs:
@@ -18,33 +20,43 @@ def bin_copy(source, target, env):
if m and len(m.groups()) > 0: if m and len(m.groups()) > 0:
bag[var] = m.group(1) bag[var] = m.group(1)
# esp8266 or esp32 app_version = bag.get('app_version')
platform = "esp" + env['PIOPLATFORM'].strip("espressif") platform = bag.get("platform")
# if using the pio build directory, use str(target[0]).split(os.path.sep)[2] # print(env.Dump())
variant = "EMS-ESP-" + bag.get('app_version').replace(".", "_") + "-" + platform # my_flags = env.ParseFlags(env['BUILD_FLAGS'])
# defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}
# print(my_flags)
# print((my_flags.get("CPPDEFINES"))
# alternatively take platfrom from the pio target
# platform = str(target[0]).split(os.path.sep)[2]
print("app version: "+app_version)
print("platform: "+platform)
# convert . to _ so Windows doesn't complain
variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + platform
# create string with location and file names based on variant # check if output directories exist and create if necessary
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 firmware directory and target subdirectories (esp8266/esp32) exist and create if necessary
if not os.path.isdir(OUTPUT_DIR): if not os.path.isdir(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR) os.mkdir(OUTPUT_DIR)
for d in ['firmware']: for d in ['firmware']:
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)): if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
os.mkdir("{}{}".format(OUTPUT_DIR, d)) os.mkdir("{}{}".format(OUTPUT_DIR, d))
# copy firmware.bin to new name and in the build/firmware folder, delete if already exists # create string with location and file names based on variant
if os.path.isfile(bin_file): os.remove(bin_file) bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
# check if new target files exist and remove if necessary
for f in [bin_file]:
if os.path.isfile(f):
os.remove(f)
print("renaming file to "+bin_file)
# copy firmware.bin to firmware/<variant>.bin
shutil.copy(str(target[0]), bin_file) shutil.copy(str(target[0]), bin_file)
# create the gzip'd version
if os.path.isfile(gzip_file): os.remove(gzip_file)
with open(bin_file, "rb") as fp:
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
shutil.copyfileobj(fp, f)
print("Built firmwares: "+ bin_file + ", " + gzip_file)
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_copy]) env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_copy])

View File

@@ -1 +1,2 @@
#define EMSESP_APP_VERSION "3.0.0b7" #define EMSESP_APP_VERSION "3.0.0"
#define EMSESP_PLATFORM "ESP32"