Skip to content

Commit

Permalink
Merge pull request #511 from sidoh/v1.10.0-wip
Browse files Browse the repository at this point in the history
v1.10 release -- async packet handling, transitions
  • Loading branch information
sidoh authored Aug 30, 2019
2 parents 82a3672 + 776ff32 commit ebacd16
Show file tree
Hide file tree
Showing 99 changed files with 6,322 additions and 1,010 deletions.
24 changes: 12 additions & 12 deletions .build_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ def build_web():
print("Attempting to build webpage...")
try:
if platform.system() == "Windows":
print check_output(["npm.cmd", "install", "--only=dev"])
print check_output(["node_modules\\.bin\\gulp.cmd"])
print(check_output(["npm.cmd", "install", "--only=dev"]))
print(check_output(["node_modules\\.bin\\gulp.cmd"]))
else:
print check_output(["npm", "install"])
print check_output(["node_modules/.bin/gulp"])
print(check_output(["npm", "install"]))
print(check_output(["node_modules/.bin/gulp"]))
copyfile("build/index.html.gz.h", "../dist/index.html.gz.h")
except OSError as e:
print "Encountered error OSError building webpage:", e
print("Encountered error OSError building webpage:", e)
if e.filename:
print "Filename is", e.filename
print "WARNING: Failed to build web package. Using pre-built page."
print("Filename is", e.filename)
print("WARNING: Failed to build web package. Using pre-built page.")
except CalledProcessError as e:
print e.output
print "Encountered error CalledProcessError building webpage:", e
print "WARNING: Failed to build web package. Using pre-built page."
print(e.output)
print("Encountered error CalledProcessError building webpage:", e)
print("WARNING: Failed to build web package. Using pre-built page.")
except Exception as e:
print "Encountered error", type(e).__name__, "building webpage:", e
print "WARNING: Failed to build web package. Using pre-built page."
print("Encountered error", type(e).__name__, "building webpage:", e)
print("WARNING: Failed to build web package. Using pre-built page.")
finally:
os.chdir("..");

Expand Down
4 changes: 2 additions & 2 deletions .get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def is_tool(name):
check_output([cmd, "git"])
return True
except:
return False;
return False

version = "UNKNOWN"

Expand All @@ -28,4 +28,4 @@ def is_tool(name):
pass
pass

sys.stdout.write("-DMILIGHT_HUB_VERSION=%s %s" % (version, ' '.join(sys.argv[1:])))
sys.stdout.write("-DMILIGHT_HUB_VERSION=%s %s" % (version.decode('utf-8'), ' '.join(sys.argv[1:])))
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
.sconsign.dblite
/web/node_modules
/web/build
/web/package-lock.json
/dist/*.bin
/dist/docs
.vscode/
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
Expand Down
72 changes: 72 additions & 0 deletions .prepare_docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

# This script sets up API documentation bundles for deployment to Github Pages.
# It expects the following structure:
#
# In development branches:
#
# * ./docs/openapi.yaml - OpenAPI spec in
# * ./docs/gh-pages - Any assets that should be copied to gh-pages root
#
# In Github Pages, it will generate:
#
# * ./ - Files from ./docs/gh-pages will be copied
# * ./branches/<branch>/... - Deployment bundles including an index.html
# and a snapshot of the Open API spec.

set -eo pipefail

prepare_docs_log() {
echo "[prepare docs release] -- $@"
}

# Only run for tagged commits
if [ -z "$(git tag -l --points-at HEAD)" ]; then
prepare_docs_log "Skipping non-tagged commit."
exit 0
fi

DOCS_DIR="./docs"
DIST_DIR="./dist/docs"
BRANCHES_DIR="${DIST_DIR}/branches"
API_SPEC_FILE="${DOCS_DIR}/openapi.yaml"

rm -rf "${DIST_DIR}"

redoc_bundle_file=$(mktemp)
git_ref_version=$(git describe --always)
branch_docs_dir="${BRANCHES_DIR}/${git_ref_version}"

# Build Redoc bundle (a single HTML file)
redoc-cli bundle ${API_SPEC_FILE} -o ${redoc_bundle_file} --title 'Milight Hub API Documentation'

# Check out current stuff from gh-pages (we'll append to it)
git fetch origin 'refs/heads/gh-pages:refs/heads/gh-pages'
git checkout gh-pages -- branches || prepare_docs_log "Failed to checkout branches from gh-pages, skipping..."

if [ -e "./branches" ]; then
mkdir -p "${DIST_DIR}"
mv "./branches" "${BRANCHES_DIR}"
else
mkdir -p "${BRANCHES_DIR}"
fi

if [ -e "${DOCS_DIR}/gh-pages" ]; then
cp -r ${DOCS_DIR}/gh-pages/* "${DIST_DIR}"
else
prepare_docs_log "Skipping copy of gh-pages dir, doesn't exist"
fi

# Create the docs bundle for our ref. This will be the redoc bundle + a
# snapshot of the OpenAPI spec
mkdir -p "${branch_docs_dir}"
cp "${API_SPEC_FILE}" "${branch_docs_dir}"
cp "${redoc_bundle_file}" "${branch_docs_dir}/index.html"

# Update `latest` symlink to this branch
rm -rf "${BRANCHES_DIR}/latest"
ln -s "${git_ref_version}" "${BRANCHES_DIR}/latest"

# Create a JSON file containing a list of all branches with docs (we'll
# have an index page that renders the list).
ls "${BRANCHES_DIR}" | jq -Rc '.' | jq -sc '.' > "${DIST_DIR}/branches.json"
37 changes: 24 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
language: python
python:
- '2.7'
- '3.7'
sudo: false
cache:
directories:
- "~/.platformio"
env:
- NODE_VERSION="6"
- NODE_VERSION="10"
before_install:
- nvm install $NODE_VERSION
install:
- pip install -U platformio
- pip3 install -U platformio
- platformio lib install
- cd web && npm install && cd ..
- npm install -g swagger-cli redoc-cli
script:
- swagger-cli validate ./docs/openapi.yaml
- platformio run
before_deploy:
- ./.prepare_release
- ./.prepare_docs
deploy:
provider: releases
prerelease: true
api_key:
secure: p1BjM1a/u20EES+pl0+w7B/9600pvpcVYTfMiZhyMOXB0MbNm+uZKYeqiG6Tf3A9duVqMtn0R+ROO+YqL5mlnrVSi74kHMxCIF2GGtK7DIReyEI5JeF5oSi5j9bEsXu8602+1Uez8tInWgzdu2uK2G0FJF/og1Ygnk/L3haYIldIo6kL+Yd6Anlu8L2zqiovC3j3r3eO8oB6Ig6sirN+tnK0ah3dn028k+nHQIMtcc/hE7dQjglp4cGOu+NumUolhdwLdFyW7vfAafxwf9z/SL6M14pg0N8qOmT4KEg4AZQDaKn0wT7VhAvPDHjt4CgPE7QsZhEKFmW7J9LGlcWN4X3ORMkBNPnmqrkVeZEE4Vlcm3CF5kvt59ks0qwEgjpvrqxdZZxa/h9ZLEBBEXMIekA4TSAzP/e/opfry11N1lvqXQ562Jc6oEKS+xWerWSALXyZI4K1T+fkgHTZCWGH4EI3weZY/zSCAZ6a7OpgFQWU9uHlJLMkaWrp78fSPqy6zcjxhXoJnBt8BT1BMRdmZum2YX91hfJ9aRvlEmhtxKgAcPgpJ0ITwB317lKh5VqAfMNZW7pXJEYdLCmUEKXv/beTvNmRIGgu1OjZ3BWchOgh/TwX46+Lrx1zL69sfE+6cBFbC+T2QIv4dxxSQNC1K0JnRVhbD1cOpSXz+amsLS0=
file_glob: true
skip_cleanup: true
file: dist/*.bin
on:
repo: sidoh/esp8266_milight_hub
tags: true
- provider: releases
prerelease: true
api_key:
secure: p1BjM1a/u20EES+pl0+w7B/9600pvpcVYTfMiZhyMOXB0MbNm+uZKYeqiG6Tf3A9duVqMtn0R+ROO+YqL5mlnrVSi74kHMxCIF2GGtK7DIReyEI5JeF5oSi5j9bEsXu8602+1Uez8tInWgzdu2uK2G0FJF/og1Ygnk/L3haYIldIo6kL+Yd6Anlu8L2zqiovC3j3r3eO8oB6Ig6sirN+tnK0ah3dn028k+nHQIMtcc/hE7dQjglp4cGOu+NumUolhdwLdFyW7vfAafxwf9z/SL6M14pg0N8qOmT4KEg4AZQDaKn0wT7VhAvPDHjt4CgPE7QsZhEKFmW7J9LGlcWN4X3ORMkBNPnmqrkVeZEE4Vlcm3CF5kvt59ks0qwEgjpvrqxdZZxa/h9ZLEBBEXMIekA4TSAzP/e/opfry11N1lvqXQ562Jc6oEKS+xWerWSALXyZI4K1T+fkgHTZCWGH4EI3weZY/zSCAZ6a7OpgFQWU9uHlJLMkaWrp78fSPqy6zcjxhXoJnBt8BT1BMRdmZum2YX91hfJ9aRvlEmhtxKgAcPgpJ0ITwB317lKh5VqAfMNZW7pXJEYdLCmUEKXv/beTvNmRIGgu1OjZ3BWchOgh/TwX46+Lrx1zL69sfE+6cBFbC+T2QIv4dxxSQNC1K0JnRVhbD1cOpSXz+amsLS0=
file_glob: true
skip_cleanup: true
file: dist/*.bin
on:
repo: sidoh/esp8266_milight_hub
tags: true
- provider: pages
skip_cleanup: true
local_dir: dist/docs
github_token: $GITHUB_TOKEN
keep_history: true
on:
repo: sidoh/esp8266_milight_hub
tags: true
Loading

0 comments on commit ebacd16

Please sign in to comment.