Skip to content

Commit cb6aeff

Browse files
committed
Merge remote-tracking branch 'sidoh/master' into dev
2 parents a429163 + 23102c7 commit cb6aeff

187 files changed

Lines changed: 21661 additions & 1100 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.build_web.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,27 @@ def is_tool(name):
1717

1818
def build_web():
1919
if is_tool("npm"):
20-
os.chdir("web")
20+
os.chdir("web2")
2121
print("Attempting to build webpage...")
2222
try:
2323
if platform.system() == "Windows":
24-
print check_output(["npm.cmd", "install", "--only=dev"])
25-
print check_output(["node_modules\\.bin\\gulp.cmd"])
24+
print(check_output(["npm.cmd", "install"]))
25+
print(check_output(["npm.cmd", "run", "build"]))
2626
else:
27-
print check_output(["npm", "install"])
28-
print check_output(["node_modules/.bin/gulp"])
29-
copyfile("build/index.html.gz.h", "../dist/index.html.gz.h")
27+
print(check_output(["npm", "install"]))
28+
print(check_output(["npm", "run", "build"]))
3029
except OSError as e:
31-
print "Encountered error OSError building webpage:", e
30+
print("Encountered error OSError building webpage:", e)
3231
if e.filename:
33-
print "Filename is", e.filename
34-
print "WARNING: Failed to build web package. Using pre-built page."
32+
print("Filename is", e.filename)
33+
print("WARNING: Failed to build web package. Using pre-built page.")
3534
except CalledProcessError as e:
36-
print e.output
37-
print "Encountered error CalledProcessError building webpage:", e
38-
print "WARNING: Failed to build web package. Using pre-built page."
35+
print(e.output)
36+
print("Encountered error CalledProcessError building webpage:", e)
37+
print("WARNING: Failed to build web package. Using pre-built page.")
3938
except Exception as e:
40-
print "Encountered error", type(e).__name__, "building webpage:", e
41-
print "WARNING: Failed to build web package. Using pre-built page."
39+
print("Encountered error", type(e).__name__, "building webpage:", e)
40+
print("WARNING: Failed to build web package. Using pre-built page.")
4241
finally:
4342
os.chdir("..");
4443

.get_version.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
def is_tool(name):
1212
cmd = "where" if platform.system() == "Windows" else "which"
1313
try:
14-
check_output([cmd, "git"])
14+
check_output([cmd, name])
1515
return True
1616
except:
17-
return False;
17+
return False
1818

19-
version = "UNKNOWN"
19+
version = "UNKNOWN".encode()
2020

2121
if is_tool("git"):
2222
try:
@@ -28,4 +28,4 @@ def is_tool(name):
2828
pass
2929
pass
3030

31-
sys.stdout.write("-DMILIGHT_HUB_VERSION=%s %s" % (version, ' '.join(sys.argv[1:])))
31+
sys.stdout.write("-DMILIGHT_HUB_VERSION=%s %s" % (version.decode('utf-8'), ' '.join(sys.argv[1:])))
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Bug report
3+
about: Report an issue or unexpected behavior
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
### Describe the bug
11+
12+
<!-- A clear and concise description of what the bug is. -->
13+
14+
### Steps to reproduce
15+
16+
<!-- If you're reporting a bug, please provide a way to reliably reproduce the issue. -->
17+
18+
### Expected behavior
19+
20+
<!-- A clear and concise description of what you expected to happen. -->
21+
22+
### Setup information
23+
24+
#### Firmware version
25+
<!-- e.g. 1.10.0-rc.1, etc. include all versions you've tried -->
26+
27+
#### Output of http://milight-hub.local/about
28+
29+
```json
30+
"... /about output. put between the ```s"
31+
```
32+
33+
#### Output of http://milight-hub.local/settings
34+
35+
<!-- MAKE SURE TO SENSOR ANY PASSWORDS! -->
36+
37+
```json
38+
"... /settings output. put between the ```s"
39+
```
40+
41+
### Additional context
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Feature request or general question
3+
about: Suggest a new idea or ask a question
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Problem with new setup or device compatibility
3+
about: Help troubleshooting a setup that's not working
4+
title: ''
5+
labels: setup-quesetion
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
-- !!! PLEASE READ THIS FIRST !!!
12+
--
13+
-- Before opening an issue for a setup-related question, please make sure you've run through
14+
-- the troubleshooting guide, found here:
15+
--
16+
-- https://github.com/sidoh/esp8266_milight_hub/wiki/Troubleshooting
17+
--
18+
-- If you're still having trouble, please make sure you provide all of the requested information below!
19+
-->
20+
21+
### What is the model number of the device you're trying to control?
22+
<!--
23+
-- Product catalog here:
24+
-- https://github.com/sidoh/esp8266_milight_hub/files/1379131/MiLight-ProductCatalog-2017.pdf
25+
-->
26+
27+
### What firmware version(s) have you tried?
28+
29+
### Which ESP8266 board are you using? (nodemcu, d1_mini, etc.)
30+
31+
### Which radio type are you using? (RGBW, RGB+CCT, etc.)
32+
33+
### Have you tried controlling the device with a physical remote?
34+
35+
<!-- Please provide the model number of the remote if the device you're trying to control works with a remote. -->
36+
37+
### Output of http://milight-hub.local/about and http://milight-hub.local/settings
38+
39+
<!-- MAKE SURE TO SENSOR ANY PASSWORDS IN /settings !!! -->
40+
41+
#### /about
42+
43+
```json
44+
"... /about output. put between the ```s"
45+
```
46+
47+
#### /settings
48+
49+
```json
50+
"... /settings output. put between the ```s"
51+
```

.github/workflows/build.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/cache@v3
12+
with:
13+
path: |
14+
~/.cache/pip
15+
~/.platformio/.cache
16+
.pio/build
17+
key: ${{ runner.os }}-pio
18+
- uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.9'
21+
- name: Install PlatformIO Core
22+
run: pip install --upgrade platformio
23+
24+
- name: Build PlatformIO Project
25+
run: pio run
26+
27+
- name: Build docs
28+
run: |
29+
npm install -g swagger-cli redoc-cli
30+
swagger-cli validate ./docs/openapi.yaml

.github/workflows/release.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- run: git fetch --tags --force origin
17+
- uses: actions/cache@v3
18+
with:
19+
path: |
20+
~/.cache/pip
21+
~/.platformio/.cache
22+
.pio/build
23+
key: ${{ runner.os }}-pio
24+
- uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.9'
27+
28+
- name: Validate docs
29+
run: |
30+
npm install -g redoc-cli
31+
redoc-cli validate ./docs/openapi.yaml
32+
33+
- name: Install PlatformIO Core
34+
run: pip install --upgrade platformio
35+
36+
- name: Build PlatformIO Project
37+
run: pio run
38+
39+
- name: Prepare release
40+
run: |
41+
./.prepare_release
42+
./.prepare_docs
43+
44+
- name: Upload production artifact
45+
uses: actions/upload-artifact@master
46+
with:
47+
name: dist
48+
path: dist
49+
50+
release:
51+
needs: build
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- name: Download production artifact
56+
uses: actions/download-artifact@master
57+
with:
58+
name: dist
59+
path: dist
60+
61+
- name: Create Release
62+
uses: actions/github-script@v2
63+
with:
64+
github-token: ${{secrets.GITHUB_TOKEN}}
65+
script: |
66+
console.log('environment', process.versions);
67+
68+
const fs = require('fs').promises;
69+
70+
const { repo: { owner, repo }, sha } = context;
71+
console.log({ owner, repo, sha });
72+
73+
const release = await github.repos.createRelease({
74+
owner, repo,
75+
name: process.env.GITHUB_REF_NAME,
76+
body: await fs.readFile('./dist/release-notes.txt', 'utf8'),
77+
tag_name: process.env.GITHUB_REF,
78+
draft: true,
79+
target_commitish: sha
80+
});
81+
82+
console.log('created release', { release });
83+
84+
for (let file of await fs.readdir('dist')) {
85+
if (file.endsWith('.bin')) {
86+
console.log('uploading', file);
87+
88+
await github.repos.uploadReleaseAsset({
89+
owner, repo,
90+
release_id: release.data.id,
91+
name: file,
92+
data: await fs.readFile(`./dist/${file}`)
93+
});
94+
}
95+
}
96+
97+
publish_docs:
98+
needs: build
99+
runs-on: ubuntu-latest
100+
101+
# Deploy to the github-pages environment
102+
environment:
103+
name: github-pages
104+
url: ${{ steps.deployment.outputs.page_url }}
105+
106+
permissions:
107+
contents: write
108+
109+
steps:
110+
- uses: actions/checkout@v3
111+
112+
- name: Download production artifact
113+
uses: actions/download-artifact@master
114+
with:
115+
name: dist
116+
path: dist
117+
118+
- name: Release docs
119+
uses: JamesIves/github-pages-deploy-action@v4
120+
with:
121+
folder: dist/docs # The folder the action should deploy.

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
/web/package-lock.json
1010
/dist/*.bin
1111
/dist/docs
12+
/web2/node_modules
13+
/web2/dist/build
14+
/web2/dist/compiled
1215
.vscode/
1316
.vscode/.browse.c_cpp.db*
1417
.vscode/c_cpp_properties.json
1518
.vscode/launch.json
1619
/test/remote/settings.json
1720
/test/remote/espmh.env
18-
19-
web/package-lock\.json
21+
lib/Environment/wifi_credentials.h
22+
.idea

.prepare_docs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ DOCS_DIR="./docs"
3030
DIST_DIR="./dist/docs"
3131
BRANCHES_DIR="${DIST_DIR}/branches"
3232
API_SPEC_FILE="${DOCS_DIR}/openapi.yaml"
33+
ARTIFACT_PATH="./dist/github-pages.tar.gz"
3334

3435
rm -rf "${DIST_DIR}"
3536

@@ -69,4 +70,6 @@ ln -s "${git_ref_version}" "${BRANCHES_DIR}/latest"
6970

7071
# Create a JSON file containing a list of all branches with docs (we'll
7172
# have an index page that renders the list).
72-
ls "${BRANCHES_DIR}" | jq -Rc '.' | jq -sc '.' > "${DIST_DIR}/branches.json"
73+
ls "${BRANCHES_DIR}" | jq -Rc '.' | jq -sc '.' > "${DIST_DIR}/branches.json"
74+
75+
tar cf "${ARTIFACT_PATH}" "${DIST_DIR}"

.prepare_release

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ for file in $(ls ${firmware_prefix}/**/firmware.bin); do
2929

3030
cp "$file" "dist/esp8266_milight_hub_${env}-${VERSION}.bin"
3131
done
32+
33+
git tag -l --format="%(contents:lines=100)" "${VERSION}" > dist/release-notes.txt

0 commit comments

Comments
 (0)