Skip to content

Commit

Permalink
Merge pull request #2 from FablabTorino/pkg-fablab
Browse files Browse the repository at this point in the history
Add Github Actions for automatic builds
  • Loading branch information
matjack1 authored Feb 9, 2022
2 parents ffedc37 + 14e6c6e commit 2f8fdad
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 17 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/platformio-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Platformio build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: push

jobs:
build:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/tools-build-lin.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .github/workflows/tools-build-mac.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .github/workflows/tools-build-win.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions tools/webfilesbuilder/bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const builder = require('./gulpfile.js').default;

builder();
14 changes: 9 additions & 5 deletions tools/webfilesbuilder/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 4 additions & 2 deletions tools/webfilesbuilder/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions tools/webfilesbuilder/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -15,5 +15,6 @@
"gulp-htmlmin": "^4.0.0",
"gulp-uglify": "^3.0.2",
"pump": "^3.0.0"
}
},
"bin": "bin.js"
}
5 changes: 3 additions & 2 deletions tools/wsemulator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wsemulator",
"version": "0.0.1",
"version": "1.0.0",
"description": "Emulate websocket communication ",
"main": "wserver.js",
"scripts": {
Expand All @@ -11,5 +11,6 @@
"dependencies": {
"websocket": "^1.0.28",
"ws": "^4.0.0"
}
},
"bin": "wserver.js"
}

0 comments on commit 2f8fdad

Please sign in to comment.