From 1d229ddf2013fb79ea6d3090fd43c9c986f20501 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 10:39:48 -0400 Subject: [PATCH 01/30] Try different architectures --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index be9d8f28..c6f04421 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +arch: + - amd64 + - arm64 os: - linux # - windows From 8467b3320ee12c082ae13b6093786b772ac91914 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 11:08:30 -0400 Subject: [PATCH 02/30] Download the latest firmware instead of building it ourselves --- .travis.yml | 11 +++-------- tools/download_firmware_release.sh | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100755 tools/download_firmware_release.sh diff --git a/.travis.yml b/.travis.yml index c6f04421..ea87a4aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,10 @@ os: language: python install: - pip install -r requirements.txt - - pip install -U platformio - pip install pyinstaller script: - - bash buildFirmware.sh + - tools/download_firmware_release.sh - pyinstaller main-onedir.spec - cd dist && mv main webcontrol && cd webcontrol - touch webcontrol-linux-singledirectory.tar.gz @@ -20,15 +19,11 @@ script: - cd ../.. -before_deploy: - # Set up git user name and tag this commit - - git config --local user.name "Emile Cantin" - - git config --local user.email "emile.cantin@gmail.com" - - export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)} - - git tag $TRAVIS_TAG deploy: provider: releases api_key: $GITHUB_TOKEN file: dist/webcontrol/webcontrol-linux-singledirectory.tar.gz skip_cleanup: true draft: true + on: + tags: true diff --git a/tools/download_firmware_release.sh b/tools/download_firmware_release.sh new file mode 100755 index 00000000..6164c251 --- /dev/null +++ b/tools/download_firmware_release.sh @@ -0,0 +1,21 @@ +#!/bin/bash +mkdir -p firmware +pushd firmware + +# Download the latest release +curl -s https://api.github.com/repos/webcontrolcnc/Firmware/releases/latest \ + | grep "browser_download_url.*hex" \ + | cut -d : -f 2,3 \ + | tr -d \" \ + | wget -qi - + +mkdir -p maslowcnc +mv maslowcnc*.hex maslowcnc/ + +mkdir -p holey +mv holey*.hex holey/ + +mkdir -p madgrizzle +mv madgrizzle*.hex madgrizzle/ + +popd From cb9b85b3dd10206df7f055833cfd046710e480e6 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 11:39:09 -0400 Subject: [PATCH 03/30] Move to job-type configuration --- .travis.yml | 57 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea87a4aa..9cfd6097 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,24 +6,43 @@ os: # - windows language: python -install: - - pip install -r requirements.txt - - pip install pyinstaller -script: - - tools/download_firmware_release.sh - - pyinstaller main-onedir.spec - - cd dist && mv main webcontrol && cd webcontrol - - touch webcontrol-linux-singledirectory.tar.gz - - tar -zcvf webcontrol-linux-singledirectory.tar.gz --exclude=webcontrol-linux-singledirectory.tar.gz . - - cd ../.. +jobs: + include: + - stage: Linux Build + os: linux + install: &base_install + - pip install -r requirements.txt + - pip install pyinstaller + script: + - tools/download_firmware_release.sh + - pyinstaller main-onedir.spec + - cd dist && mv main webcontrol && cd webcontrol + - touch webcontrol-linux-singledirectory.tar.gz + - tar -zcvf webcontrol-linux-singledirectory.tar.gz --exclude=webcontrol-linux-singledirectory.tar.gz . + - ls -l + - cd ../.. + deploy: &base_deploy + provider: releases + token: $GITHUB_TOKEN + file: dist/webcontrol/*.tar.gz + skip_cleanup: true + draft: true + on: + tags: true - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - file: dist/webcontrol/webcontrol-linux-singledirectory.tar.gz - skip_cleanup: true - draft: true - on: - tags: true + - stage: Raspberry Pi build + os: linux + arch: arm64 + install: + <<: *base_install + script: + - tools/download_firmware_release.sh + - pyinstaller main-onedir.spec + - cd dist && mv main webcontrol && cd webcontrol + - touch webcontrol-rpi-singledirectory.tar.gz + - tar -zcvf webcontrol-rpi-singledirectory.tar.gz --exclude=webcontrol-rpi-singledirectory.tar.gz . + - ls -l + - cd ../.. + deploy: + <<: *base_deploy From 5479745fe02a34264b3e9fb8ac1ebc1da727c166 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 11:49:00 -0400 Subject: [PATCH 04/30] Fix travis config --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9cfd6097..528fe493 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,3 @@ -arch: - - amd64 - - arm64 -os: - - linux - # - windows language: python @@ -35,7 +29,7 @@ jobs: os: linux arch: arm64 install: - <<: *base_install + - *base_install script: - tools/download_firmware_release.sh - pyinstaller main-onedir.spec From c9ab632dafa9ace38f3289adf2f177b07177bfaa Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 12:28:41 -0400 Subject: [PATCH 05/30] Try fixing the arm build --- .travis.yml | 17 ++++------------- tools/build_release.sh | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) create mode 100755 tools/build_release.sh diff --git a/.travis.yml b/.travis.yml index 528fe493..bfd59b2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,7 @@ jobs: - pip install pyinstaller script: - tools/download_firmware_release.sh - - pyinstaller main-onedir.spec - - cd dist && mv main webcontrol && cd webcontrol - - touch webcontrol-linux-singledirectory.tar.gz - - tar -zcvf webcontrol-linux-singledirectory.tar.gz --exclude=webcontrol-linux-singledirectory.tar.gz . - - ls -l - - cd ../.. + - tools/build_release.sh linux deploy: &base_deploy provider: releases token: $GITHUB_TOKEN @@ -27,16 +22,12 @@ jobs: - stage: Raspberry Pi build os: linux - arch: arm64 + before_install: + - sudo apt-get -y install liblapack-dev libblas-dev gfortran install: - *base_install script: - tools/download_firmware_release.sh - - pyinstaller main-onedir.spec - - cd dist && mv main webcontrol && cd webcontrol - - touch webcontrol-rpi-singledirectory.tar.gz - - tar -zcvf webcontrol-rpi-singledirectory.tar.gz --exclude=webcontrol-rpi-singledirectory.tar.gz . - - ls -l - - cd ../.. + - tools/build_release.sh rpi deploy: <<: *base_deploy diff --git a/tools/build_release.sh b/tools/build_release.sh new file mode 100755 index 00000000..fac57d30 --- /dev/null +++ b/tools/build_release.sh @@ -0,0 +1,19 @@ +#!/bin/bash +VARIANT=$1 + +# Build the one-dir bundle +pyinstaller --noconfirm main-onedir.spec + +# Rename the directory +pushd dist +mv main webcontrol +pushd webcontrol + +# Zip the directory +touch webcontrol-"${VARIANT}"-singledirectory.tar.gz +tar -zcvf webcontrol-"${VARIANT}"-singledirectory.tar.gz --exclude=webcontrol-"${VARIANT}"-singledirectory.tar.gz . +ls -l + +popd +popd + From 38c48657527f018fb16e9eeff3b32527e257dc16 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 12:31:15 -0400 Subject: [PATCH 06/30] Revert dumb mistake --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfd59b2e..9665a681 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: python jobs: include: - - stage: Linux Build + - stage: Build os: linux install: &base_install - pip install -r requirements.txt @@ -20,8 +20,9 @@ jobs: on: tags: true - - stage: Raspberry Pi build + - stage: Build os: linux + arch: arm64 before_install: - sudo apt-get -y install liblapack-dev libblas-dev gfortran install: From ed98df66b462cb1bf2010d4fed358bd49a7d03f5 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 13:15:00 -0400 Subject: [PATCH 07/30] Specify Pyhton version --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9665a681..1dc78974 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python +python: "3.7" jobs: include: From 351e0129387d84895b51d82cfe29cd58af674057 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 13:46:37 -0400 Subject: [PATCH 08/30] Temporarily disable opencv --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 958473e6..7f014c88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ Jinja2>=2.10.1 MarkupSafe==1.1 numpy==1.16.2 scipy==1.3.1 -opencv-python==3.4.3.18 +#opencv-python==3.4.3.18 pyserial==3.4 python-engineio==2.3.2 python-socketio==2.0.0 @@ -23,4 +23,4 @@ PyGithub wget distro python-frontmatter -markdown \ No newline at end of file +markdown From 2f08a4af2c3c1379c89a679d72bae7aa8be26af3 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 13:58:48 -0400 Subject: [PATCH 09/30] Temporarily disable scipy & add a macOS build --- .travis.yml | 12 ++++++++++++ requirements.txt | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1dc78974..2721b31e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: "3.7" jobs: include: - stage: Build + name: Linux os: linux install: &base_install - pip install -r requirements.txt @@ -22,6 +23,17 @@ jobs: tags: true - stage: Build + name: macOS + os: osx + install: + - *base_install + script: + - tools/download_firmware_release.sh + - tools/build_release.sh rpi + deploy: + <<: *base_deploy + - stage: Build + name: Raspberry Pi os: linux arch: arm64 before_install: diff --git a/requirements.txt b/requirements.txt index 7f014c88..166a6fb8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ itsdangerous==0.24 Jinja2>=2.10.1 MarkupSafe==1.1 numpy==1.16.2 -scipy==1.3.1 +#scipy==1.3.1 #opencv-python==3.4.3.18 pyserial==3.4 python-engineio==2.3.2 From 92b169c48965153936a1ec2a8e396f8a770df4d1 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 14:07:58 -0400 Subject: [PATCH 10/30] Try and fix macOS build --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2721b31e..8629b428 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: python -python: "3.7" +# python: "3.7" jobs: include: @@ -29,7 +29,7 @@ jobs: - *base_install script: - tools/download_firmware_release.sh - - tools/build_release.sh rpi + - tools/build_release.sh osx deploy: <<: *base_deploy - stage: Build From 5e830ca939a0171c878f8169ed3093e015f1434b Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 14:14:04 -0400 Subject: [PATCH 11/30] Disable RPI build & re-enable dependencies --- .travis.yml | 26 +++++++++++++------------- requirements.txt | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8629b428..626f9763 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,16 +32,16 @@ jobs: - tools/build_release.sh osx deploy: <<: *base_deploy - - stage: Build - name: Raspberry Pi - os: linux - arch: arm64 - before_install: - - sudo apt-get -y install liblapack-dev libblas-dev gfortran - install: - - *base_install - script: - - tools/download_firmware_release.sh - - tools/build_release.sh rpi - deploy: - <<: *base_deploy + # - stage: Build + # name: Raspberry Pi + # os: linux + # arch: arm64 + # before_install: + # - sudo apt-get -y install liblapack-dev libblas-dev gfortran + # install: + # - *base_install + # script: + # - tools/download_firmware_release.sh + # - tools/build_release.sh rpi + # deploy: + # <<: *base_deploy diff --git a/requirements.txt b/requirements.txt index 166a6fb8..2ecfc5aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,8 +9,8 @@ itsdangerous==0.24 Jinja2>=2.10.1 MarkupSafe==1.1 numpy==1.16.2 -#scipy==1.3.1 -#opencv-python==3.4.3.18 +scipy==1.3.1 +opencv-python==3.4.3.18 pyserial==3.4 python-engineio==2.3.2 python-socketio==2.0.0 From f62f542e6c6661cae6694b1c285b60f3315f923b Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 14:26:10 -0400 Subject: [PATCH 12/30] Install python ourselves on macOS --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 626f9763..ec210b23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,15 @@ jobs: - stage: Build name: macOS os: osx + language: generic + addons: + homebrew: + update: true + packages: python3 + before_install: + - pip3 install virtualenv + - virtualenv -p python3 ~/venv + - source ~/venv/bin/activate install: - *base_install script: From 7b4d74f13e17883308bc028ab4af6bc29fac6ad0 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 15:23:56 -0400 Subject: [PATCH 13/30] Try Windows build --- .travis.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec210b23..da894bbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ jobs: language: generic addons: homebrew: - update: true packages: python3 before_install: - pip3 install virtualenv @@ -41,6 +40,22 @@ jobs: - tools/build_release.sh osx deploy: <<: *base_deploy + - stage: Build + name: Windows + os: windows + language: generic + before_install: + - choco install python + - pip install virtualenv + - virtualenv -p python3 ~/venv + - source ~/venv/bin/activate + install: + - *base_install + script: + - tools/download_firmware_release.sh + - tools/build_release.sh windows + deploy: + <<: *base_deploy # - stage: Build # name: Raspberry Pi # os: linux From e94260ee2068e1d883ebb4db59c96b6dbb1bc1b9 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 15:52:37 -0400 Subject: [PATCH 14/30] Fix windows env not booting --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index da894bbb..197ee977 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ jobs: - stage: Build name: Windows os: windows - language: generic + language: shell before_install: - choco install python - pip install virtualenv From 82b2f55feb232a25670730f8588b53c2490f210e Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 15:56:18 -0400 Subject: [PATCH 15/30] Fix pip on windows --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 197ee977..c73c37ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ jobs: language: shell before_install: - choco install python + - choco install pip - pip install virtualenv - virtualenv -p python3 ~/venv - source ~/venv/bin/activate From afbc537f8eb9a1266910d3f90c0971681c168492 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 16:04:51 -0400 Subject: [PATCH 16/30] Fix pip on windows --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c73c37ab..9930d0ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,8 +44,10 @@ jobs: name: Windows os: windows language: shell + env: PATH=/c/Python37:/c/Python37/Scripts:$PATH before_install: - - choco install python + - choco install python --version=3.7.7 + - python -m pip install -U pip setuptools - choco install pip - pip install virtualenv - virtualenv -p python3 ~/venv From b6bbf768905fab3434bfef7a4551108e462e53b9 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 16:06:48 -0400 Subject: [PATCH 17/30] Fix pip on windows --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9930d0ae..e9a5a757 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,6 @@ jobs: before_install: - choco install python --version=3.7.7 - python -m pip install -U pip setuptools - - choco install pip - pip install virtualenv - virtualenv -p python3 ~/venv - source ~/venv/bin/activate From c2d534b6a4ff55b79bbae1d8986fac2dbfcb294c Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Mon, 25 May 2020 16:13:03 -0400 Subject: [PATCH 18/30] Try without virtualenv on windows --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e9a5a757..d4eb4eb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,9 +48,9 @@ jobs: before_install: - choco install python --version=3.7.7 - python -m pip install -U pip setuptools - - pip install virtualenv - - virtualenv -p python3 ~/venv - - source ~/venv/bin/activate + # - pip install virtualenv + # - virtualenv -p python3 ~/venv + # - source ~/venv/bin/activate install: - *base_install script: From cc114f2388ef35641c686b1f8c37e8e70f94077e Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 11:56:24 -0400 Subject: [PATCH 19/30] Add a mechanism to install without pyinstaller --- .gitignore | 3 +++ Actions/actions.py | 1 + README.md | 16 +++++++++++----- tools/build_base_release.sh | 7 +++++++ tools/install_dependencies.sh | 14 ++++++++++++++ 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100755 tools/build_base_release.sh create mode 100755 tools/install_dependencies.sh diff --git a/.gitignore b/.gitignore index cf5c7a2a..e582484c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ venv.bak/ build dist +# compiled firmware +firmware + #logs log.txt alog.txt diff --git a/Actions/actions.py b/Actions/actions.py index b8f74993..70464d5f 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -1406,6 +1406,7 @@ def upgradeFirmware(self, version): # cmd = "\"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\bin\\avrdude\" -Cavr/avrdude.conf -v -patmega2560 -cwiring -P" + port + " -b115200 -D -Uflash:w:" + filename + ":i" #else: cmd = home+"/tools/avrdude -C"+home+"/tools/avrdude.conf -v -patmega2560 -cwiring -P"+port+" -b115200 -D -Uflash:w:"+filename+":i" + # cmd = "avrdude -v -patmega2560 -cwiring -P"+port+" -b115200 -D -Uflash:w:"+filename+":i" #print(cmd) # I think this is blocking.. x = os.system(cmd) diff --git a/README.md b/README.md index ac41a56a..9c7b27b7 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,17 @@ For Windows 10 and Linux (Debian-based, such as Ubuntu) machines, users can down For Linux/RPI users, make a new subdirectory,and then issue the untar: **For RPI:** ->cd ~
->mkdir webcontrol
->cd webcontrol
->wget https://github.com/madgrizzle/WebControl/releases/download/v0.920/webcontrol-0.920-rpi-singledirectory.tar.gz
->tar -zxvf webcontrol-0.920-rpi-singledirectory.tar.gz
+ +``` +cd ~ +wget https://github.com/madgrizzle/WebControl/releases/download/v0.920/webcontrol-0.920-rpi-singledirectory.tar.gz +mkdir webcontrol +tar -zxvf webcontrol-0.920-rpi-singledirectory.tar.gz -C webcontrol +cd webcontrol +sudo tools/install_dependencies.sh +python3 main.py +``` + **For Linux:** >cd ~
diff --git a/tools/build_base_release.sh b/tools/build_base_release.sh new file mode 100755 index 00000000..805e6a7d --- /dev/null +++ b/tools/build_base_release.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +mkdir -p dist/webcontrol +touch dist/webcontrol/webcontrol-base.tar.gz + +tar -zcvf dist/webcontrol/webcontrol-base.tar.gz --exclude=dist --exclude=.venv --exclude=.git . + diff --git a/tools/install_dependencies.sh b/tools/install_dependencies.sh new file mode 100755 index 00000000..9531e1ce --- /dev/null +++ b/tools/install_dependencies.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +apt-get update + +apt-get install -y --no-install-recommends python3-pip python3-setuptools python3-dev unzip wget sed build-essential cmake pkg-config libv4l-dev libatlas-base-dev gfortran libevent-dev libatlas-base-dev avrdude libffi-dev libxml2-dev libxslt-dev libsm6 libxext6 libxrender-dev git python3-opencv python3-scipy python3-numpy libjasper1 libgstreamer1.0-0 libavcodec58 libqtgui4 libqt4-test + +apt-get -y autoremove + +# Remove opencv, scipy and numpy from requirements (since they're already installed) +sed -i '/opencv-python.*/d' requirements.txt +sed -i '/scipy.*/d' requirements.txt +sed -i '/numpy.*/d' requirements.txt + +pip3 install -r requirements.txt From 3af055195d1d0eaa1876c99c9858b5377a75436f Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 11:59:03 -0400 Subject: [PATCH 20/30] Add basic build --- .travis.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4eb4eb3..fc593e81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,11 @@ language: python jobs: include: - stage: Build - name: Linux + name: Base os: linux - install: &base_install - - pip install -r requirements.txt - - pip install pyinstaller script: - tools/download_firmware_release.sh - - tools/build_release.sh linux + - tools/build_base_release.sh deploy: &base_deploy provider: releases token: $GITHUB_TOKEN @@ -22,6 +19,17 @@ jobs: on: tags: true + - stage: Build + name: Linux + os: linux + install: &base_install + - pip install -r requirements.txt + - pip install pyinstaller + script: + - tools/download_firmware_release.sh + - tools/build_release.sh linux + deploy: + <<: *base_deploy - stage: Build name: macOS os: osx From 3dde6d11d0c0b2ee3c64ed14707b8dfca68fefd0 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 12:07:06 -0400 Subject: [PATCH 21/30] Add deploy stage to publish the release --- .travis.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc593e81..7d0db04c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ jobs: token: $GITHUB_TOKEN file: dist/webcontrol/*.tar.gz skip_cleanup: true + pre-release: true draft: true on: tags: true @@ -56,9 +57,6 @@ jobs: before_install: - choco install python --version=3.7.7 - python -m pip install -U pip setuptools - # - pip install virtualenv - # - virtualenv -p python3 ~/venv - # - source ~/venv/bin/activate install: - *base_install script: @@ -66,16 +64,7 @@ jobs: - tools/build_release.sh windows deploy: <<: *base_deploy - # - stage: Build - # name: Raspberry Pi - # os: linux - # arch: arm64 - # before_install: - # - sudo apt-get -y install liblapack-dev libblas-dev gfortran - # install: - # - *base_install - # script: - # - tools/download_firmware_release.sh - # - tools/build_release.sh rpi - # deploy: - # <<: *base_deploy + - stage: Deploy + deploy: + <<: *base_deploy + draft: false From 2a923f81d7b850a2aaba3b8a657c738b3200f57e Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 13:35:04 -0400 Subject: [PATCH 22/30] Rename 'Base' build to 'universal', and add singlefile releases --- .gitignore | 3 +++ .travis.yml | 2 +- main.spec | 2 +- tools/build_base_release.sh | 7 ------- tools/build_release.sh | 17 +++++++++++------ tools/build_universal_release.sh | 7 +++++++ 6 files changed, 23 insertions(+), 15 deletions(-) delete mode 100755 tools/build_base_release.sh create mode 100755 tools/build_universal_release.sh diff --git a/.gitignore b/.gitignore index e582484c..bea0c6ee 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ alog.txt __pycache__/ *.py[cod] *$py.class + +# macOS junk +.DS_Store diff --git a/.travis.yml b/.travis.yml index 7d0db04c..39be5c93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ language: python jobs: include: - stage: Build - name: Base + name: Universal os: linux script: - tools/download_firmware_release.sh diff --git a/main.spec b/main.spec index 98fdadba..8b4ce59b 100644 --- a/main.spec +++ b/main.spec @@ -22,7 +22,7 @@ exe = EXE(pyz, a.zipfiles, a.datas, [], - name='main', + name='webcontrol', debug=False, bootloader_ignore_signals=False, strip=False, diff --git a/tools/build_base_release.sh b/tools/build_base_release.sh deleted file mode 100755 index 805e6a7d..00000000 --- a/tools/build_base_release.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -mkdir -p dist/webcontrol -touch dist/webcontrol/webcontrol-base.tar.gz - -tar -zcvf dist/webcontrol/webcontrol-base.tar.gz --exclude=dist --exclude=.venv --exclude=.git . - diff --git a/tools/build_release.sh b/tools/build_release.sh index fac57d30..240f90b2 100755 --- a/tools/build_release.sh +++ b/tools/build_release.sh @@ -1,19 +1,24 @@ #!/bin/bash VARIANT=$1 -# Build the one-dir bundle +# cleanup +rm -rf dist + +# Build the bundles pyinstaller --noconfirm main-onedir.spec +pyinstaller --noconfirm main.spec # Rename the directory pushd dist -mv main webcontrol -pushd webcontrol -# Zip the directory +# Zip the releases touch webcontrol-"${VARIANT}"-singledirectory.tar.gz -tar -zcvf webcontrol-"${VARIANT}"-singledirectory.tar.gz --exclude=webcontrol-"${VARIANT}"-singledirectory.tar.gz . +pushd main +tar -zcvf ../webcontrol-"${VARIANT}"-singledirectory.tar.gz . +popd +touch webcontrol-"${VARIANT}"-singlefile.tar.gz +tar -zcvf webcontrol-"${VARIANT}"-singlefile.tar.gz webcontrol ls -l popd -popd diff --git a/tools/build_universal_release.sh b/tools/build_universal_release.sh new file mode 100755 index 00000000..69503e10 --- /dev/null +++ b/tools/build_universal_release.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +mkdir -p dist/ +touch dist/webcontrol-universal.tar.gz + +tar -zcvf dist/webcontrol-universal.tar.gz --exclude=dist --exclude=.venv --exclude=.git . + From 882dfb4efd95e81f4064e776ab1ec4f0cfc4a86b Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 13:44:17 -0400 Subject: [PATCH 23/30] Fix released file path --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39be5c93..7f3ce13b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ jobs: deploy: &base_deploy provider: releases token: $GITHUB_TOKEN - file: dist/webcontrol/*.tar.gz + file: dist/*.tar.gz skip_cleanup: true pre-release: true draft: true From ec6090bb772c2b68f3be328ed2cbbc082466df3e Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 13:47:43 -0400 Subject: [PATCH 24/30] Fix YML indentation --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f3ce13b..85b4e823 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ jobs: - tools/build_release.sh windows deploy: <<: *base_deploy - - stage: Deploy - deploy: - <<: *base_deploy - draft: false + - stage: Deploy + deploy: + <<: *base_deploy + draft: false From 93f7f6e7caa87391950e9bac6e178be6261bef45 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 13:50:49 -0400 Subject: [PATCH 25/30] Forgot to renamt the file in Travis-CI as well --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 85b4e823..e5f4b80c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ jobs: os: linux script: - tools/download_firmware_release.sh - - tools/build_base_release.sh + - tools/build_universal_release.sh deploy: &base_deploy provider: releases token: $GITHUB_TOKEN From 8f7660dd387f481cd815165edb41e22607241c05 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 14:01:21 -0400 Subject: [PATCH 26/30] Fix prerelease flag --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e5f4b80c..83a1f7aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ jobs: token: $GITHUB_TOKEN file: dist/*.tar.gz skip_cleanup: true - pre-release: true + prerelease: true draft: true on: tags: true From c126b582f545dce8b2cd420909806808a8047591 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 14:10:19 -0400 Subject: [PATCH 27/30] Enable file glob --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 83a1f7aa..4d38824d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ jobs: deploy: &base_deploy provider: releases token: $GITHUB_TOKEN + file_glob: true file: dist/*.tar.gz skip_cleanup: true prerelease: true From a0488dc43a244c6b51cbed069d381194da00473b Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 14:23:40 -0400 Subject: [PATCH 28/30] Fix the publish job --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4d38824d..e38b4f6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,11 @@ jobs: - tools/build_release.sh windows deploy: <<: *base_deploy - - stage: Deploy + - stage: Publish + install: + - echo install + script: + - echo script deploy: <<: *base_deploy draft: false From 1ce1c8799c16f67421f922f73239eb96160547f3 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 26 May 2020 20:21:15 -0400 Subject: [PATCH 29/30] Tweak the universal release so it upgrades properly on RPi --- tools/build_universal_release.sh | 7 +++++++ tools/upgrade_webcontrol.sh | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/tools/build_universal_release.sh b/tools/build_universal_release.sh index 69503e10..88715dde 100755 --- a/tools/build_universal_release.sh +++ b/tools/build_universal_release.sh @@ -1,5 +1,12 @@ #!/bin/bash +# create the webcontrol script +touch webcontrol +chmod +x webcontrol +echo "#!/bin/bash" > webcontrol +echo "" >> webcontrol +echo "python3 main.py" >> webcontrol + mkdir -p dist/ touch dist/webcontrol-universal.tar.gz diff --git a/tools/upgrade_webcontrol.sh b/tools/upgrade_webcontrol.sh index 8ec7c7bf..1a6c21bb 100755 --- a/tools/upgrade_webcontrol.sh +++ b/tools/upgrade_webcontrol.sh @@ -4,4 +4,12 @@ echo $1 echo $2 cd $2 tar -zxvf $1 + +# Install dependencies if we're running on Raspbian +IS_RASPBIAN=$(cat /etc/os-release | grep "Raspbian") +if [ -n "${IS_RASPBIAN}" ] +then + sudo tools/install_dependencies.sh +fi + ./webcontrol From 3d0df837d2cca5278df1d6898bb8e3cc1763fcea Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Wed, 27 May 2020 10:20:09 -0400 Subject: [PATCH 30/30] Added some logging to the upgrade script --- tools/upgrade_webcontrol.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/upgrade_webcontrol.sh b/tools/upgrade_webcontrol.sh index 1a6c21bb..b6a90b69 100755 --- a/tools/upgrade_webcontrol.sh +++ b/tools/upgrade_webcontrol.sh @@ -9,7 +9,9 @@ tar -zxvf $1 IS_RASPBIAN=$(cat /etc/os-release | grep "Raspbian") if [ -n "${IS_RASPBIAN}" ] then + echo "We are on Raspbian, installing dependencies" sudo tools/install_dependencies.sh fi +echo "Starting WebControl" ./webcontrol