Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI setup #154

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1d229dd
Try different architectures
emilecantin May 25, 2020
8467b33
Download the latest firmware instead of building it ourselves
emilecantin May 25, 2020
cb9b85b
Move to job-type configuration
emilecantin May 25, 2020
5479745
Fix travis config
emilecantin May 25, 2020
c9ab632
Try fixing the arm build
emilecantin May 25, 2020
38c4865
Revert dumb mistake
emilecantin May 25, 2020
ed98df6
Specify Pyhton version
emilecantin May 25, 2020
2d045ad
Merge remote-tracking branch 'origin/master' into chore/ci-setup2
emilecantin May 25, 2020
351e012
Temporarily disable opencv
emilecantin May 25, 2020
2f08a4a
Temporarily disable scipy & add a macOS build
emilecantin May 25, 2020
92b169c
Try and fix macOS build
emilecantin May 25, 2020
5e830ca
Disable RPI build & re-enable dependencies
emilecantin May 25, 2020
f62f542
Install python ourselves on macOS
emilecantin May 25, 2020
7b4d74f
Try Windows build
emilecantin May 25, 2020
e94260e
Fix windows env not booting
emilecantin May 25, 2020
82b2f55
Fix pip on windows
emilecantin May 25, 2020
afbc537
Fix pip on windows
emilecantin May 25, 2020
b6bbf76
Fix pip on windows
emilecantin May 25, 2020
c2d534b
Try without virtualenv on windows
emilecantin May 25, 2020
cc114f2
Add a mechanism to install without pyinstaller
emilecantin May 26, 2020
3af0551
Add basic build
emilecantin May 26, 2020
3dde6d1
Add deploy stage to publish the release
emilecantin May 26, 2020
2a923f8
Rename 'Base' build to 'universal', and add singlefile releases
emilecantin May 26, 2020
882dfb4
Fix released file path
emilecantin May 26, 2020
ec6090b
Fix YML indentation
emilecantin May 26, 2020
93f7f6e
Forgot to renamt the file in Travis-CI as well
emilecantin May 26, 2020
8f7660d
Fix prerelease flag
emilecantin May 26, 2020
c126b58
Enable file glob
emilecantin May 26, 2020
a0488dc
Fix the publish job
emilecantin May 26, 2020
1ce1c87
Tweak the universal release so it upgrades properly on RPi
emilecantin May 27, 2020
3d0df83
Added some logging to the upgrade script
emilecantin May 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ venv.bak/
build
dist

# compiled firmware
firmware

#logs
log.txt
alog.txt
Expand All @@ -22,3 +25,6 @@ alog.txt
__pycache__/
*.py[cod]
*$py.class

# macOS junk
.DS_Store
98 changes: 71 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,75 @@
os:
- linux
# - windows

language: python
install:
- pip install -r requirements.txt
- pip install -U platformio
- pip install pyinstaller
# python: "3.7"

script:
- bash buildFirmware.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: Build
name: Universal
os: linux
script:
- tools/download_firmware_release.sh
- tools/build_universal_release.sh
deploy: &base_deploy
provider: releases
token: $GITHUB_TOKEN
file_glob: true
file: dist/*.tar.gz
skip_cleanup: true
prerelease: true
draft: true
on:
tags: true


before_deploy:
# Set up git user name and tag this commit
- git config --local user.name "Emile Cantin"
- git config --local user.email "[email protected]"
- 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
- 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
language: generic
addons:
homebrew:
packages: python3
before_install:
- pip3 install virtualenv
- virtualenv -p python3 ~/venv
- source ~/venv/bin/activate
install:
- *base_install
script:
- tools/download_firmware_release.sh
- tools/build_release.sh osx
deploy:
<<: *base_deploy
- stage: Build
name: Windows
os: windows
language: shell
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
before_install:
- choco install python --version=3.7.7
- python -m pip install -U pip setuptools
install:
- *base_install
script:
- tools/download_firmware_release.sh
- tools/build_release.sh windows
deploy:
<<: *base_deploy
- stage: Publish
install:
- echo install
script:
- echo script
deploy:
<<: *base_deploy
draft: false
1 change: 1 addition & 0 deletions Actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ~</br>
>mkdir webcontrol</br>
>cd webcontrol</br>
>wget https://github.com/madgrizzle/WebControl/releases/download/v0.920/webcontrol-0.920-rpi-singledirectory.tar.gz</br>
>tar -zxvf webcontrol-0.920-rpi-singledirectory.tar.gz</br>

```
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 ~</br>
Expand Down
2 changes: 1 addition & 1 deletion main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='main',
name='webcontrol',
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ PyGithub
wget
distro
python-frontmatter
markdown
markdown
24 changes: 24 additions & 0 deletions tools/build_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
VARIANT=$1

# cleanup
rm -rf dist

# Build the bundles
pyinstaller --noconfirm main-onedir.spec
pyinstaller --noconfirm main.spec

# Rename the directory
pushd dist

# Zip the releases
touch 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

14 changes: 14 additions & 0 deletions tools/build_universal_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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

tar -zcvf dist/webcontrol-universal.tar.gz --exclude=dist --exclude=.venv --exclude=.git .

21 changes: 21 additions & 0 deletions tools/download_firmware_release.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tools/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions tools/upgrade_webcontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@ 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
echo "We are on Raspbian, installing dependencies"
sudo tools/install_dependencies.sh
fi

echo "Starting WebControl"
./webcontrol