-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fgalan-patch-1
- Loading branch information
Showing
49 changed files
with
1,884 additions
and
662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
insert_final_newline = true | ||
|
||
[*.{json,yml,md,babelrc,eslintrc,remarkrc}] | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{js}] | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "tamia", | ||
"parserOptions": { | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"no-shadow": 0, | ||
"valid-jsdoc": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: CI | ||
'on': | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
lint-dockerfile: | ||
name: Lint Dockerfile | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: Run Hadolint Dockerfile Linter | ||
uses: burdzwastaken/hadolint-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
HADOLINT_ACTION_DOCKERFILE_FOLDER: docker | ||
|
||
lint-markdown: | ||
name: Lint Markdown | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- name: Run Remark Markdown Linter | ||
run: | | ||
npm install | ||
npm run lint:md | ||
- name: Run Textlint Markdown Linter | ||
run: npm run lint:text | ||
|
||
lint-code: | ||
name: Lint JavaScript | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- name: Run EsLint Node.js Linter | ||
run: | | ||
npm install | ||
npm run lint | ||
unit-test: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
services: | ||
mongodb: | ||
image: mongo:3.6 | ||
ports: | ||
- 27017:27017 | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 10.x | ||
- 12.x | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: 'Install Node.js ${{ matrix.node-version }}' | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '${{ matrix.node-version }}' | ||
- name: 'Unit Tests with Node.js ${{ matrix.node-version }}' | ||
run: | | ||
npm install | ||
npm test | ||
code-coverage: | ||
name: Coveralls Code Coverage | ||
runs-on: ubuntu-latest | ||
needs: unit-test | ||
services: | ||
mongodb: | ||
image: mongo:3.6 | ||
ports: | ||
- 27017:27017 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: 'Test Coverage with Node.js 12.x' | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- run: | | ||
npm install | ||
npm run test:coverage | ||
- name: Push to Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,4 +195,4 @@ | |
] | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- Update Docker security practices (Add HEALTHCHECK, Use Anonymous User, Use two-stage build) | ||
- Overall update of dev package dependencies | ||
- Update codebase to use ES6 | ||
- Remove JSHint and jshint overrides | ||
- Add esLint using standard tamia presets | ||
- Replace var with let/const | ||
- Fix or disable eslint errors | ||
- Set Nodejs 10 as minimum version in packages.json (effectively removing Nodev8 from supported versions) | ||
- Allow to configure id field in received callbacks from Sigfox | ||
- Use nock lib to mock exchanges with a context broker during tests (and avoid depending on a running one) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
|
||
/* | ||
* Copyright 2020 Telefonica Investigación y Desarrollo, S.A.U | ||
* | ||
* This file is part of sigfox-iotagent | ||
* | ||
* sigfox-iotagent is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* sigfox-iotagent is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with sigfox-iotagent. | ||
* If not, seehttp://www.gnu.org/licenses/. | ||
* | ||
* For those usages not covered by the GNU Affero General Public License | ||
* please contact with::[daniel.moranjimenez at telefonica.com] | ||
*/ | ||
|
||
const http = require('http'); | ||
const port = process.env.IOTA_NORTH_PORT || '4041'; | ||
const path = process.env.HEALTHCHECK_PATH || '/iot/about'; | ||
const httpCode = process.env.HEALTHCHECK_CODE || 200; | ||
|
||
const options = { | ||
host: 'localhost', | ||
port, | ||
timeout: 2000, | ||
method: 'GET', | ||
path | ||
}; | ||
|
||
const request = http.request(options, (result) => { | ||
// eslint-disable-next-line no-console | ||
console.info(`Performed health check, result ${result.statusCode}`); | ||
if (result.statusCode === httpCode) { | ||
process.exit(0); | ||
} else { | ||
process.exit(1); | ||
} | ||
}); | ||
|
||
request.on('error', (err) => { | ||
// eslint-disable-next-line no-console | ||
console.error(`An error occurred while performing health check, error: ${err}`); | ||
process.exit(1); | ||
}); | ||
|
||
request.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.