From 68284d570c649c931463a091123f45fd9e42d00b Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Fri, 4 Feb 2022 12:35:58 +0100 Subject: [PATCH 1/6] Create platformio-build.yml --- .github/workflows/platformio-build.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/platformio-build.yml diff --git a/.github/workflows/platformio-build.yml b/.github/workflows/platformio-build.yml new file mode 100644 index 00000000..9998cebd --- /dev/null +++ b/.github/workflows/platformio-build.yml @@ -0,0 +1,27 @@ +name: Platformio build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install platformio + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + platformio run -e generic -e relayboard -e debug From 8fc4a1539ce0ef579f4d4415b43eaf3fa52f1fcd Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Fri, 4 Feb 2022 12:52:39 +0100 Subject: [PATCH 2/6] Save artifacts --- .github/workflows/platformio-build.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/platformio-build.yml b/.github/workflows/platformio-build.yml index 9998cebd..20fe23d7 100644 --- a/.github/workflows/platformio-build.yml +++ b/.github/workflows/platformio-build.yml @@ -17,11 +17,19 @@ jobs: uses: actions/setup-python@v2 with: python-version: "3.10" - - name: Install dependencies + - name: Install Platformio run: | python -m pip install --upgrade pip pip install platformio if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + - name: Run Platformio builds run: | platformio run -e generic -e relayboard -e debug + - name: Export bins + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + bin/generic.bin + bin/forV2Board.bin + bin/debug.bin From f02be3cc60d46b09813ad2af8b0c1ae725ecb9fb Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Fri, 4 Feb 2022 12:53:13 +0100 Subject: [PATCH 3/6] Remove Travis --- .travis.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 75aee2bb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: python -python: -- '2.7' -install: -- pip install -U platformio -script: -- pio --version -- pio run -e generic -e relayboard -e debug -before_deploy: -- cd .. -- zip -r -j ${TRAVIS_BUILD_DIR}-${TRAVIS_TAG}.zip ${TRAVIS_BUILD_DIR}/bin -deploy: - provider: releases - api_key: - secure: "x6aQFDa+61A2lyBC5eVOrRaXm/Y5d0y0rp8nU4n56iuI938qmrmwlM9wObazXCIbZy70/7a5UjRi+yYwG3+pXuguX6n15aAQO7ngQKeuaOOl+UFbDAw57ytud+vQReM4J8vwDh4hwJo8EATc8VH2Ua27DsrLp5AxszBu+HEiBLSEVoyHxxWsp9POnVWMV9VZzdGQmHYR9ZvafXYrONPLK3VrXyPRT0DhTtelpB+bICLqDVOOawilHNEXIRfUt0Chp3/I1ArFJyq0EkDrn4USawEKceu8eTkp3zShjcsT03XMkW41tNrdmJC6BdfeNhw4gkj67ZZN247voWdOMgadrixtMaM7u98HVVFXa/YioKHXYCpSxqAZumnzLe6kEfYl5aKraNAh/SEkFDXNULvCyDpfzLnJ3JyYRg6CSeY4EvRvCwz17nn8LoeqdAUjrHYja2tMxwcnRlxPirw5E5wIosJlxfgV5FiMz3MlTgKEOxsxQDFS1usZmFr2QWb45ayqCWDuGyeD5VLY1Yhe7QT6fxHGDW4cKnD1dDrngbuhCvz0juL+GpAfgDhn6DYJNC+ZNBnmMVY9dUSgDBeHMmOtdQOfz22TxlLfGFE2pzAQcqyR3kMHjdH5nRji56Lz9kuNasPpR8VZa5O/bah5N3Hho0X9EWIu2ZziFyVBqwUpSao=" - file: "${TRAVIS_BUILD_DIR}-${TRAVIS_TAG}.zip" - skip_cleanup: true - on: - repo: esprfid/esp-rfid - all_branches: true - condition: $TRAVIS_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ \ No newline at end of file From 8b388fbcfa9f706a59c027f86c82f179abe41d74 Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Fri, 4 Feb 2022 13:11:19 +0100 Subject: [PATCH 4/6] Build on every push --- .github/workflows/platformio-build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/platformio-build.yml b/.github/workflows/platformio-build.yml index 20fe23d7..bf9f6985 100644 --- a/.github/workflows/platformio-build.yml +++ b/.github/workflows/platformio-build.yml @@ -1,10 +1,6 @@ name: Platformio build -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +on: push jobs: build: From 842f617f0930e72c89b157e449bdc51e9be909dd Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Tue, 8 Feb 2022 23:09:57 +0100 Subject: [PATCH 5/6] Github action to generate webfilesbuilder binaries --- .github/workflows/webfilesbuilder-build.yml | 41 +++++++++++++++++++++ tools/webfilesbuilder/bin.js | 3 ++ tools/webfilesbuilder/gulpfile.js | 14 ++++--- tools/webfilesbuilder/package-lock.json | 6 ++- tools/webfilesbuilder/package.json | 7 ++-- 5 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/webfilesbuilder-build.yml create mode 100644 tools/webfilesbuilder/bin.js diff --git a/.github/workflows/webfilesbuilder-build.yml b/.github/workflows/webfilesbuilder-build.yml new file mode 100644 index 00000000..13776268 --- /dev/null +++ b/.github/workflows/webfilesbuilder-build.yml @@ -0,0 +1,41 @@ +name: webfilesbuilder build + +on: push + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Generate binaries + run: | + cd tools/webfilesbuilder + npm install + npm i -g pkg + pkg . + + - name: Export Linux binary + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + tools/webfilesbuilder/webfilesbuilder-linux + + - name: Export MacOS binary + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + tools/webfilesbuilder/webfilesbuilder-macos + + - name: Export Windows binary + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + tools/webfilesbuilder/webfilesbuilder-win.exe diff --git a/tools/webfilesbuilder/bin.js b/tools/webfilesbuilder/bin.js new file mode 100644 index 00000000..3592af82 --- /dev/null +++ b/tools/webfilesbuilder/bin.js @@ -0,0 +1,3 @@ +const builder = require('./gulpfile.js').default; + +builder(); \ No newline at end of file diff --git a/tools/webfilesbuilder/gulpfile.js b/tools/webfilesbuilder/gulpfile.js index 0845f549..d978642c 100644 --- a/tools/webfilesbuilder/gulpfile.js +++ b/tools/webfilesbuilder/gulpfile.js @@ -206,9 +206,13 @@ function htmls() { })); } -const scriptTasks = gulp.series(espRfidJsMinify, espRfidJsGz, espRfidJsGzh, scriptsConcat, scripts); -const styleTasks = gulp.series(stylesConcat, styles); -const fontTasks = gulp.series(fontgz, fonts); -const htmlTasks = gulp.series(htmlsGz, htmlsPrep, htmls); +async function runner() { + const scriptTasks = gulp.series(espRfidJsMinify, espRfidJsGz, espRfidJsGzh, scriptsConcat, scripts); + const styleTasks = gulp.series(stylesConcat, styles); + const fontTasks = gulp.series(fontgz, fonts); + const htmlTasks = gulp.series(htmlsGz, htmlsPrep, htmls); + const parallel = await gulp.parallel(scriptTasks, styleTasks, fontTasks, htmlTasks); + return await parallel(); +} -exports.default = gulp.parallel(scriptTasks, styleTasks, fontTasks, htmlTasks); +exports.default = runner; diff --git a/tools/webfilesbuilder/package-lock.json b/tools/webfilesbuilder/package-lock.json index d903f158..304dfdcd 100644 --- a/tools/webfilesbuilder/package-lock.json +++ b/tools/webfilesbuilder/package-lock.json @@ -15,8 +15,10 @@ "gulp-gzip": "^1.4.2", "gulp-htmlmin": "^4.0.0", "gulp-uglify": "^3.0.2", - "pump": "^3.0.0", - "uglify-js": "^3.14.5" + "pump": "^3.0.0" + }, + "bin": { + "gulp": "node_modules/.bin/gulp" } }, "node_modules/ansi-colors": { diff --git a/tools/webfilesbuilder/package.json b/tools/webfilesbuilder/package.json index f890b236..facc71ba 100644 --- a/tools/webfilesbuilder/package.json +++ b/tools/webfilesbuilder/package.json @@ -1,6 +1,6 @@ { - "name": "uglifier", - "version": "0.0.1", + "name": "webfilesbuilder", + "version": "1.0.0", "description": "Combine all js and css files into one and gzip them for the ESP-RFID project", "scripts": { "start": "gulp" @@ -15,5 +15,6 @@ "gulp-htmlmin": "^4.0.0", "gulp-uglify": "^3.0.2", "pump": "^3.0.0" - } + }, + "bin": "bin.js" } From 9136cd0a7e4cf66d9c890cefafa1affa1a7ff7cc Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Wed, 9 Feb 2022 17:52:20 +0100 Subject: [PATCH 6/6] Automatically build tools on every commit --- .github/workflows/tools-build-lin.yml | 32 ++++++++++++++++ .github/workflows/tools-build-mac.yml | 32 ++++++++++++++++ .github/workflows/tools-build-win.yml | 32 ++++++++++++++++ .github/workflows/webfilesbuilder-build.yml | 41 --------------------- tools/README.md | 11 ++++++ tools/wsemulator/package.json | 5 ++- 6 files changed, 110 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/tools-build-lin.yml create mode 100644 .github/workflows/tools-build-mac.yml create mode 100644 .github/workflows/tools-build-win.yml delete mode 100644 .github/workflows/webfilesbuilder-build.yml create mode 100644 tools/README.md diff --git a/.github/workflows/tools-build-lin.yml b/.github/workflows/tools-build-lin.yml new file mode 100644 index 00000000..17a57f10 --- /dev/null +++ b/.github/workflows/tools-build-lin.yml @@ -0,0 +1,32 @@ +name: Tools build for Linux + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Install pkg + run: npm i -g pkg + - name: Generate webfilesbuilder binaries + run: | + cd tools/webfilesbuilder + npm install + pkg -t node16-linux -C GZip . + - name: Generate wsemulator binaries + run: | + cd tools/wsemulator + npm install + pkg -t node16-linux -C GZip . + + - name: Export Linux binary + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + tools/webfilesbuilder/webfilesbuilder + tools/wsemulator/wsemulator diff --git a/.github/workflows/tools-build-mac.yml b/.github/workflows/tools-build-mac.yml new file mode 100644 index 00000000..3832dac3 --- /dev/null +++ b/.github/workflows/tools-build-mac.yml @@ -0,0 +1,32 @@ +name: Tools build for Mac + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Install pkg + run: npm i -g pkg + - name: Generate webfilesbuilder binaries + run: | + cd tools/webfilesbuilder + npm install + pkg -t node16-mac -C GZip . + - name: Generate wsemulator binaries + run: | + cd tools/wsemulator + npm install + pkg -t node16-mac -C GZip . + + - name: Export Mac binary + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + tools/webfilesbuilder/webfilesbuilder + tools/wsemulator/wsemulator diff --git a/.github/workflows/tools-build-win.yml b/.github/workflows/tools-build-win.yml new file mode 100644 index 00000000..c17dedf5 --- /dev/null +++ b/.github/workflows/tools-build-win.yml @@ -0,0 +1,32 @@ +name: Tools build for Windows + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: Install pkg + run: npm i -g pkg + - name: Generate webfilesbuilder binaries + run: | + cd tools/webfilesbuilder + npm install + pkg -t node16-win -C GZip . + - name: Generate wsemulator binaries + run: | + cd tools/wsemulator + npm install + pkg -t node16-win -C GZip . + + - name: Export Windows binary + uses: actions/upload-artifact@v2 + with: + name: bins + path: | + tools/webfilesbuilder/webfilesbuilder.exe + tools/wsemulator/wsemulator.exe diff --git a/.github/workflows/webfilesbuilder-build.yml b/.github/workflows/webfilesbuilder-build.yml deleted file mode 100644 index 13776268..00000000 --- a/.github/workflows/webfilesbuilder-build.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: webfilesbuilder build - -on: push - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '16' - - name: Generate binaries - run: | - cd tools/webfilesbuilder - npm install - npm i -g pkg - pkg . - - - name: Export Linux binary - uses: actions/upload-artifact@v2 - with: - name: bins - path: | - tools/webfilesbuilder/webfilesbuilder-linux - - - name: Export MacOS binary - uses: actions/upload-artifact@v2 - with: - name: bins - path: | - tools/webfilesbuilder/webfilesbuilder-macos - - - name: Export Windows binary - uses: actions/upload-artifact@v2 - with: - name: bins - path: | - tools/webfilesbuilder/webfilesbuilder-win.exe diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 00000000..546333d6 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,11 @@ +# Tools + +Both tools can be found already built in the Github releases, if you don't want to install all the needed dependencies. + +If you want to modify the tools instead you need to install all the Node dependencies and hack your way around. + +On every push the binaries are generated by Github actions and if needed a new release should be published with the binaries. + +## webfilesbuilder + +The `webfilesbuilder` executable that you can get from the releases should be copied in the `tools/webfilesbuilder/` folder and run from there as it looks for files in specific folders relative to that location. \ No newline at end of file diff --git a/tools/wsemulator/package.json b/tools/wsemulator/package.json index 61182614..12e98df6 100644 --- a/tools/wsemulator/package.json +++ b/tools/wsemulator/package.json @@ -1,6 +1,6 @@ { "name": "wsemulator", - "version": "0.0.1", + "version": "1.0.0", "description": "Emulate websocket communication ", "main": "wserver.js", "scripts": { @@ -11,5 +11,6 @@ "dependencies": { "websocket": "^1.0.28", "ws": "^4.0.0" - } + }, + "bin": "wserver.js" }