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: 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/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/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" } 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" }