Skip to content

Commit

Permalink
Build artifact and use it for the release
Browse files Browse the repository at this point in the history
PR #171 

- Build artifact and use it for the release
- Fix and add remote messages logs
  • Loading branch information
haimkastner authored Oct 7, 2020
2 parents 10bfd7b + 7c5f786 commit 218cc82
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 35 deletions.
58 changes: 26 additions & 32 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: casanet server BE+FE CI
name: casanet server CI CD

on: [push]

Expand All @@ -8,23 +8,35 @@ jobs:
strategy:
matrix:
node-version: [12.x]
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build backend
run: |
cd backend
npm ci
npm run build
- name: build frontend
- name: Bundle packages
run: |
mkdir casanet_bin
mkdir .pkg-cache
cd .pkg-cache
export PKG_CACHE_PATH=$(pwd)
echo $PKG_CACHE_PATH
mkdir v2.6
cd v2.6
curl -L https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v12.2.0-linux-armv7 --output fetched-v12.18.1-linux-armv7
chmod 777 fetched-v12.18.1-linux-armv7
cd ../../
cd frontend
npm ci
npm run build:internal
cd ../
cd backend
npm ci
npm run bundle
cp -v bundle/* ../casanet_bin
- uses: actions/upload-artifact@v2
with:
name: casanet_bin
path: casanet_bin

tests:
runs-on: ubuntu-latest
Expand All @@ -44,37 +56,19 @@ jobs:
npm ci
npm run test
bundle:
bundle:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
- uses: actions/download-artifact@master
with:
node-version: ${{ matrix.node-version }}
- name: Bundle packages
run: |
mkdir casanet_bin
mkdir .pkg-cache
cd .pkg-cache
export PKG_CACHE_PATH=$(pwd)
echo $PKG_CACHE_PATH
mkdir v2.6
cd v2.6
curl -L https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v12.2.0-linux-armv7 --output fetched-v12.18.1-linux-armv7
chmod 777 fetched-v12.18.1-linux-armv7
cd ../../
cd frontend
npm ci
cd ../
cd backend
npm ci
npm run bundle
cp -v bundle/* ../casanet_bin
name: casanet_bin
path: casanet_bin
- name: Get the version
id: get_version
run: |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ Let's create a smart home, without giving anyone access to our house 😊.
## CASA-NET.
Open-source server to control IoT devices in a local home network.


[![CI CD Status](https://github.com/casanet/casanet-server/workflows/casanet%20server%20CI%20CD/badge.svg?branch=master)](https://github.com/casanet/casanet-server/actions)
[![Build Status](https://travis-ci.org/casanet/casanet-server.svg?branch=master)](https://travis-ci.org/casanet/casanet-server)
[![Coverage Status](https://coveralls.io/repos/github/casanet/casanet-server/badge.svg?branch=master)](https://coveralls.io/github/casanet/casanet-server?branch=master)

The latest release binaries available to download from [casanet-server releases](https://github.com/casanet/casanet-server/releases)

## Philosophy.
In this project, I wanted to solve a number of troubles. first of all, anyone who uses a number of smart devices (smart IR, smart socket, or anything of that kind) of different companies is familiar with the problem of dealing with a number of different applications;
Expand Down
19 changes: 17 additions & 2 deletions backend/src/business-layer/remoteConnectionBl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export class RemoteConnectionBl {

/** Subscribe to minions feed, to forward remote server */
this.minionsBl.minionFeed.subscribe((minionFeed: MinionFeed) => {
if (this.remoteConnectionStatus !== 'connectionOK') {
return;
}

const localMessage: LocalMessage = {
localMessagesType: 'feed',
message: {
Expand All @@ -92,6 +96,10 @@ export class RemoteConnectionBl {

/** Subscribe to timings feed, to forward remote server */
this.timingsBl.timingFeed.subscribe((timingFeed: TimingFeed) => {
if (this.remoteConnectionStatus !== 'connectionOK') {
return;
}

const localMessage: LocalMessage = {
localMessagesType: 'feed',
message: {
Expand Down Expand Up @@ -302,10 +310,14 @@ export class RemoteConnectionBl {
*/
private sendMessage(localMessage: LocalMessage) {
if (this.remoteConnectionStatus !== 'connectionOK' && this.remoteConnectionStatus !== 'cantReachRemoteServer') {
logger.debug(`[RemoteConnection.sendMessage] cant send message "${localMessage.localMessagesType}" to remote since remote status is "${this.remoteConnectionStatus}"`);
return;
}
try {
logger.debug(`[RemoteConnection.sendMessage] sending message to remote server "${localMessage.localMessagesType}"`);
// Don't log al ack messages...
if (localMessage.localMessagesType !== 'ack') {
logger.debug(`[RemoteConnection.sendMessage] sending message to remote server "${localMessage.localMessagesType}"`);
}
this.webSocketClient.sendData(JSON.stringify(localMessage));
} catch (error) {
logger.error(`[RemoteConnection.sendMessage] sending message to remote server "${localMessage.localMessagesType}" failed, ${error.message}`);
Expand Down Expand Up @@ -373,7 +385,10 @@ export class RemoteConnectionBl {
private async onRemoteServerMessage(rawRemoteMessage: string) {
/** Parse message and send to correct method handle */
const remoteMessage: RemoteMessage = JSON.parse(rawRemoteMessage);
logger.debug(`[RemoteServerBl] message arrived "${remoteMessage.remoteMessagesType}"`);
// Don't log all ack messages...
if (remoteMessage.remoteMessagesType !== 'ackOk') {
logger.debug(`[RemoteServerBl] message arrived "${remoteMessage.remoteMessagesType}"`);
}
switch (remoteMessage.remoteMessagesType) {
case 'readyToInitialization':
await this.onInitReady();
Expand Down

0 comments on commit 218cc82

Please sign in to comment.