Skip to content

Commit

Permalink
move CI from travis to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Sep 15, 2020
1 parent d2b4fd5 commit d1dfb37
Show file tree
Hide file tree
Showing 10 changed files with 255 additions and 63 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/EMS-ESP_CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: EMS-ESP CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
#on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]

on:
pull_request:

jobs:
emsesp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio
# platformio upgrade --dev
platformio upgrade
platformio update
- name: Run PlatformIO
run: |
platformio run
89 changes: 89 additions & 0 deletions .github/workflows/EMS-ESP_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build_firmware

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
#on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]

on:
push:
branches: [ dev ]

jobs:
# emsesp_pull:
# runs-on: ubuntu-latest
# continue-on-error: true
# steps:
# - uses: actions/checkout@v1
# - name: Use latest EMS-ESP development
# run: |
# git config --local user.name "Platformio BUILD"
# git switch -c main
# git remote add -f EMS-ESP "https://github.com/proddy/EMS-ESP.git"
# git merge EMS-ESP/dev --allow-unrelated-histories
# - name: Push EMS-ESP # Push updates of latest EMS-ESP development to repo
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: 'dev'
# force: true

emsesp:
# needs: emsesp_pull
runs-on: ubuntu-latest
# continue-on-error: true
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio
# platformio upgrade --dev
platformio upgrade
platformio update
- name: Run PlatformIO
run: |
platformio run
- uses: actions/upload-artifact@v2
with:
name: firmware
path: ./build/firmware

Upload:
needs: [emsesp]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@v2
with:
name: firmware
path: ./mv_firmware
- name: Display structure of downloaded files
run: ls -R
working-directory: ./mv_firmware
- name: Move firmware files in sub-folders
run: |
mkdir -p ./firmware
mkdir -p ./firmware/tasmota32/ESP32_needed_files/
[ ! -f ./mv_firmware/*.bin ] || mv ./mv_firmware/EMS-ESP*.* ./firmware/
[ ! -f ./FIRMWARE.md ] || mv -f ./FIRMWARE.md ./README.md
- name: Commit files # transfer the new binaries back into the repository
run: |
git config --local user.name "Platformio BUILD"
git rm -r --cached .
git add ./README.md
git add -f ./firmware/*.*
git commit -m "EMS-ESP binaries"
- name: Push changes # push the firmware files to branch firmware
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: 'firmware'
force: true

20 changes: 20 additions & 0 deletions .github/workflows/EMS-ESP_cpp_make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: EMS-ESP C/C++ make

on:
push:
# branches: [ dev ]
pull_request:
# branches: [ dev ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: make clean
run: make clean
- name: make
run: make

63 changes: 0 additions & 63 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pio_local.ini
# project specfic
/scripts/stackdmp.txt
emsesp
firmware
/data/www/
/lib/framework/WWWData.h
/interface/build/
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions FIRMWARE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ![logo](https://github.com/proddy/EMS-ESP/blob/main/media/EMS-ESP_logo_dark.png)

**EMS-ESP** is an open-source firmware for the Espressif ESP8266 and ESP32 microcontroller that communicates with **EMS** (Energy Management System) based equipment from manufacturers like Bosch, Buderus, Nefit, Junkers, Worcester and Sieger.

[![version](https://img.shields.io/github/release/proddy/EMS-ESP.svg?label=Latest%20Release)](https://github.com/proddy/EMS-ESP/blob/master/CHANGELOG.md)
[![release-date](https://img.shields.io/github/release-date/proddy/EMS-ESP.svg?label=Released)](https://github.com/proddy/EMS-ESP/commits/master)
[![license](https://img.shields.io/github/license/proddy/EMS-ESP.svg)](LICENSE)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b8880625bdf841d4adb2829732030887)](https://app.codacy.com/app/proddy/EMS-ESP?utm_source=github.com&utm_medium=referral&utm_content=proddy/EMS-ESP&utm_campaign=Badge_Grade_Settings)
[![Build Firmware](https://github.com/proddy/EMS-ESP/workflows/Build_firmware/badge.svg)](https://github.com/proddy/EMS-ESP/actions?query=workflow%3ABuild_firmware)
[![downloads](https://img.shields.io/github/downloads/proddy/EMS-ESP/total.svg)](https://github.com/proddy/EMS-ESP/releases)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/proddy/EMS-ESP.svg)](http://isitmaintained.com/project/proddy/EMS-ESP "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/proddy/EMS-ESP.svg)](http://isitmaintained.com/project/proddy/EMS-ESP "Percentage of issues still open")
<br/>
[![gitter](https://img.shields.io/gitter/room/EMS-ESP/EMS-ESP.svg)](https://gitter.im/EMS-ESP/community)

If you like **EMS-ESP**, please give it a star, or fork it and contribute!

[![GitHub stars](https://img.shields.io/github/stars/proddy/EMS-ESP.svg?style=social&label=Star)](https://github.com/proddy/EMS-ESP/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/proddy/EMS-ESP.svg?style=social&label=Fork)](https://github.com/proddy/EMS-ESP/network)
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/paypalme/prderbyshire/2)

# Installation

Development builds can be found in https://github.com/proddy/EMS-ESP/tree/firmware/firmware. Follow the instructions in the [Wiki](https://emsesp.github.io/docs) on how to install.

See [CHANGELOG.md](https://github.com/proddy/blob/development/tasmota/CHANGELOG.md) for changes since the last release.
2 changes: 2 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ libs_core =
extra_scripts =
pre:scripts/build_interface.py
scripts/main_script.py
scripts/rename_fw.py
scripts/gzip_fw.py

framework = arduino
monitor_speed = 115200
Expand Down
39 changes: 39 additions & 0 deletions scripts/gzip_fw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Import('env')
import os
import re
import shutil
import gzip

OUTPUT_DIR = "build{}".format(os.path.sep)

def bin_gzip(source, target, env):

# get the version
bag = {}
exprs = [
(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version'),
]
with open('./src/version.h', 'r') as f:
for l in f.readlines():
for expr, var in exprs:
m = expr.match(l)
if m and len(m.groups()) > 0:
bag[var] = m.group(1)

app_version = bag.get('app_version')

variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + str(target[0]).split(os.path.sep)[2]

# 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_gzip])
45 changes: 45 additions & 0 deletions scripts/rename_fw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Import('env')
import os
import re
import shutil

OUTPUT_DIR = "build{}".format(os.path.sep)

def bin_copy(source, target, env):

# get the version
bag = {}
exprs = [
(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version'),
]
with open('./src/version.h', 'r') as f:
for l in f.readlines():
for expr, var in exprs:
m = expr.match(l)
if m and len(m.groups()) > 0:
bag[var] = m.group(1)

app_version = bag.get('app_version')

variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + str(target[0]).split(os.path.sep)[2]

# check if output directories exist and create if necessary
if not os.path.isdir(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)

for d in ['firmware']:
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
os.mkdir("{}{}".format(OUTPUT_DIR, d))

# create string with location and file names based on variant
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)

# copy firmware.bin to firmware/<variant>.bin
shutil.copy(str(target[0]), bin_file)

env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_copy])

0 comments on commit d1dfb37

Please sign in to comment.