GitHub actions (#5)

* Add github actions

* Updates

* Try fix

* Try fix 2

* Try fix 3

* Windows x86, ubuntu fix

* Disable ubuntu

Builds keep failing, looks like a bug in github actions ubuntu image/azure

* Fix esptool 2.8

* Faster upload (4x)

* Change baud rate for logs
This commit is contained in:
Otto Winter 2019-10-24 16:10:10 +02:00 committed by GitHub
parent c3541a9ba0
commit 342d6895a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 139 additions and 2 deletions

118
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,118 @@
name: Build Workflow
on: [push, pull_request]
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
architecture: 'x64'
- name: Print Versions
run: |
python --version
pip --version
- name: Install requirements
run: |
pip install -r requirements_build.txt
pip install -e .
- name: Run PyInstaller
run: |
python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher\__main__.py
- name: See dist directory
run: ls dist
- uses: actions/upload-artifact@master
with:
name: Windows
path: dist/ESPHome-Flasher.exe
build-windows-x86:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
architecture: 'x86'
- name: Print Versions
run: |
python --version
pip --version
- name: Install requirements
run: |
pip install -r requirements_build.txt
pip install -e .
- name: Run PyInstaller
run: |
python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher\__main__.py
- name: See dist directory
run: ls dist
- uses: actions/upload-artifact@master
with:
name: Windows-x86
path: dist/ESPHome-Flasher.exe
#build-ubuntu:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v1
# - name: Install Python
# uses: actions/setup-python@v1
# with:
# python-version: '3.7'
# - name: Install dependencies
# run: |
# sudo apt install python-wxgtk3.0 build-essential libgtk-3-dev
# - name: Print Versions
# run: |
# python --version
# pip --version
# - name: Install requirements
# run: |
# pip install pathlib2
# pip install -r requirements_build.txt
# pip install -e .
# - name: Run PyInstaller
# run: |
# python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher/__main__.py
# - name: See dist directory
# run: ls dist
# - uses: actions/upload-artifact@master
# with:
# name: Ubuntu
# path: dist
build-macos:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Print Versions
run: |
python --version
pip --version
- name: Install requirements
run: |
pip install -r requirements_build.txt
pip install -e .
- name: Run PyInstaller
run: |
python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.icns esphomeflasher/__main__.py
- name: See dist directory
run: ls dist
- uses: actions/upload-artifact@master
with:
name: MacOS
path: dist/ESPHome-Flasher.app

View File

@ -3,6 +3,7 @@ from __future__ import print_function
import argparse
from datetime import datetime
import sys
import time
import esptool
import serial
@ -22,6 +23,8 @@ def parse_args(argv):
group = parser.add_mutually_exclusive_group(required=False)
group.add_argument('--esp8266', action='store_true')
group.add_argument('--esp32', action='store_true')
group.add_argument('--upload-baud-rate', type=int, default=460800,
help="Baud rate to upload with (not for logging)")
parser.add_argument('--bootloader',
help="(ESP32-only) The bootloader to flash.",
default=ESP32_DEFAULT_BOOTLOADER_FORMAT)
@ -110,6 +113,12 @@ def run_esphomeflasher(argv):
stub_chip = chip_run_stub(chip)
if args.upload_baud_rate != 115200:
try:
stub_chip.change_baud(args.upload_baud_rate)
except esptool.FatalError as err:
raise EsphomeflasherError("Error changing ESP upload baud rate: {}".format(err))
flash_size = detect_flash_size(stub_chip)
print(" - Flash Size: {}".format(flash_size))
@ -142,6 +151,11 @@ def run_esphomeflasher(argv):
print("Done! Flashing is complete!")
print()
if args.upload_baud_rate != 115200:
stub_chip._port.baudrate = 115200
time.sleep(0.05) # get rid of crap sent during baud rate change
stub_chip._port.flushInput()
show_logs(stub_chip._port)

View File

@ -22,6 +22,7 @@ class MockEsptoolArgs(object):
self.no_stub = False
self.verify = False
self.erase_all = False
self.encrypt = False
class ChipInfo(object):

View File

@ -4,7 +4,7 @@ __version__ = "1.1.0"
ESP32_DEFAULT_OTA_DATA = 'https://raw.githubusercontent.com/espressif/arduino-esp32/1.0.0/tools/partitions/boot_app0.bin'
ESP32_DEFAULT_BOOTLOADER_FORMAT = 'https://raw.githubusercontent.com/espressif/arduino-esp32/' \
'1.0.0/tools/sdk/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin'
'1.0.4/tools/sdk/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin'
ESP32_DEFAULT_PARTITIONS = 'https://raw.githubusercontent.com/esphome/esphomeflasher/master/partitions.bin'
# https://stackoverflow.com/a/3809435/8924614

4
requirements_build.txt Normal file
View File

@ -0,0 +1,4 @@
wxpython>=4.0,<5.0
esptool==2.8
requests>=2.0,<3
pyinstaller

View File

@ -23,7 +23,7 @@ DOWNLOAD_URL = '{}/archive/{}.zip'.format(GITHUB_URL, const.__version__)
REQUIRES = [
'wxpython>=4.0,<5.0',
'esptool==2.6',
'esptool==2.8',
'requests>=2.0,<3',
]