Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INAV 8.0 updates and house keeping #107

Merged
merged 24 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: Build Configurator
# Don't enable CI on push, just on PR. If you
# are working on the main repo and want to trigger
# a CI build submit a draft PR.
on:
pull_request:

workflow_call:
#inputs:
# release_build:
# description: 'Specifies if it is a build that should include commit hash in hex file names or not'
# default: false
# required: false
# type: boolean

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAME=inav-configurator_linux_x64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
mkdir ./apps/
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y install dpkg fakeroot rpm build-essential libudev-dev
- name: Install deps
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
command: npm install
timeout_minutes: 10
- name: Build Linux
run: npm run gulp release -- --platform="linux64" --installer
- name: Upload Linux deb
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}_DEB
path: ./apps/*amd64.deb
- name: Upload Linux rpm
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}_RPM
path: ./apps/*.rpm
- name: Upload Linux zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}_ZIP
path: ./apps/*.zip
- name: Upload Linux tgz
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}_TGZ
path: ./apps/*.tar.gz

build-mac:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAMEx64=inav-configurator_darwin_x64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
mkdir ./apps/
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
# Workaround due to a bug in node-gyp: https://github.com/electron/rebuild/issues/1116
- name: Install Setuptools
run: python3 -m pip install --break-system-packages setuptools
- name: Install deps
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
command: arch -arch x86_64 npm install
timeout_minutes: 10
- name: Bad bodge hack to fix nw-builder
run: perl -pi -e 's/semver.satisfies\(self._version.version, "<=0.12.3"\)/false/g' node_modules/nw-builder/lib/index.cjs
- name: Build MacOS x64
run: arch -arch x86_64 npm run gulp release -- --platform="osx64" --installer
- name: Upload MacOS x64 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_ZIP
path: ./apps/*.zip
- name: Upload MacOS x64 dmg
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_DMG
path: ./apps/*.dmg

build-windows-win64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install linux utils
run: choco install --force -y awk grep sed
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAMEx64=inav-configurator_win64_x64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
mkdir ./apps/
shell: bash
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- uses: engineerd/[email protected]
with:
name: "Wix Toolset 3.1.4"
url: "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip"
pathInArchive: "/"
- name: Install deps
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
command: npm install
timeout_minutes: 10
- name: Build windows
run: npm run gulp release -- --platform="win64" --installer
- name: Upload Windows x64 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_ZIP
path: ./apps/*.zip
- name: Upload Windows x64 msi
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_MSI
path: ./apps/*.msi

39 changes: 14 additions & 25 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ var minimist = require('minimist');

var archiver = require('archiver');
var del = require('del');
var NwBuilder = require('nw-builder');
var semver = require('semver');

const NwBuilder = require('nw-builder');
const semver = require('semver');

var gulp = require('gulp');
var concat = require('gulp-concat');
Expand All @@ -37,10 +38,10 @@ function getArguments() {

// Get platform from commandline args
// #
// # gulp <task> [<platform>]+ Run only for platform(s) (with <platform> one of --linux64, --osx64, or --win32 --chromeos)
// # gulp <task> [<platform>]+ Run only for platform(s) (with <platform> one of --linux64, --osx64, or --win64 --chromeos)
// #
function getPlatforms() {
const defaultPlatforms = ['win32', 'osx64', 'linux64'];
const defaultPlatforms = ['win64', 'osx64', 'linux64'];
const platform = getArguments().platform;
if (platform) {
if (defaultPlatforms.indexOf(platform) < 0) {
Expand Down Expand Up @@ -70,8 +71,8 @@ function getRunDebugAppCommand() {
return path.join(debugDir, pkg.name, 'linux64', pkg.name);

break;
case 'win32':
return path.join(debugDir, pkg.name, 'win32', pkg.name + '.exe');
case 'win64':
return path.join(debugDir, pkg.name, 'win64', pkg.name + '.exe');

break;

Expand Down Expand Up @@ -217,10 +218,9 @@ gulp.task('apps', gulp.series(['dist', 'clean-apps'], function (done) {
winIco: './images/inav_icon.ico',
version: get_nw_version()
});
builder.on('log', console.log);
builder.build(function (err) {
if (err) {
console.log('Error building NW apps: ' + err);
console.log('Error building NW apps: ' + err + "\n" + err.stack);
// done();
// return;
gulp.series(['clean-apps'], function() {
Expand Down Expand Up @@ -250,7 +250,7 @@ gulp.task('debug', gulp.series(['dist', 'clean-debug'], function (done) {
version: get_nw_version()
});

builder.on('log', console.log);
//builder.on('log', console.log);
builder.build(function (err) {
if (err) {
console.log('Error building NW apps: ' + err);
Expand Down Expand Up @@ -309,8 +309,8 @@ function build_win_iss(arch) {
// Extra parameters to replace inside the iss file
parameters.push(`/Dversion=${pkg.version}`);
parameters.push(`/DarchName=${arch}`);
parameters.push(`/DarchAllowed=${(arch === 'win32') ? 'x86 x64' : 'x64'}`);
parameters.push(`/DarchInstallIn64bit=${(arch === 'win32') ? '' : 'x64'}`);
parameters.push(`/DarchAllowed=x64`);
parameters.push(`/DarchInstallIn64bit=x64`);
parameters.push(`/DsourceFolder=${APPS_DIR}`);
parameters.push(`/DtargetFolder=${APPS_DIR}`);

Expand All @@ -332,8 +332,7 @@ function build_win_iss(arch) {
}
}

gulp.task('release-win32', gulp.series(build_win_zip('win32'), build_win_iss('win32')));
//gulp.task('release-win64', gulp.series(build_win_zip('win64'), build_win_iss('win64')));
gulp.task('release-win64', gulp.series(build_win_zip('win64'), build_win_iss('win64')));

gulp.task('release-osx64', function(done) {
var pkg = require('./package.json');
Expand Down Expand Up @@ -535,6 +534,7 @@ function release_deb(arch) {

console.log(`Generating deb package for ${arch}`);

console.log("Metadata Version: "+metadata.version);
return gulp.src([path.join(appsDir, metadata.name, arch, '*')])
.pipe(deb({
package: metadata.name,
Expand Down Expand Up @@ -567,18 +567,6 @@ function post_release_deb(arch) {
done();
return null;
}
if ((arch === 'linux32') || (arch === 'linux64')) {
var rename = require("gulp-rename");
const metadata = require('./package.json');
const renameFrom = path.join(appsDir, metadata.name + '_' + metadata.version + '_' + getLinuxPackageArch('.deb', arch) + '.deb');
const renameTo = path.join(appsDir, get_release_filename_base(arch) + '_' + metadata.version + '.deb');
// Rename .deb build to common naming
console.log(`Renaming .deb installer ${renameFrom} to ${renameTo}`);
return gulp.src(renameFrom)
.pipe(rename(renameTo))
.pipe(gulp.dest("."));
}

return done();
}
}
Expand Down Expand Up @@ -669,6 +657,7 @@ function releaseLinux(bits) {
var pkg = require('./package.json');
var src = path.join(appsDir, pkg.name, dirname);
var output = fs.createWriteStream(path.join(appsDir, get_release_filename(dirname, 'tar.gz')));
console.log("Writting to " + path.join(appsDir, get_release_filename(dirname, 'tar.gz')));
var archive = archiver('tar', {
zlib: { level: 9 },
gzip: true
Expand Down
18 changes: 18 additions & 0 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,24 @@ function FlightLogFieldPresenter() {
case 'servo[13]':
case 'servo[14]':
case 'servo[15]':
case 'servo[16]':
case 'servo[17]':
case 'servo[18]':
case 'servo[19]':
case 'servo[20]':
case 'servo[21]':
case 'servo[22]':
case 'servo[23]':
case 'servo[24]':
case 'servo[25]':
case 'servo[26]':
case 'servo[27]':
case 'servo[28]':
case 'servo[29]':
case 'servo[30]':
case 'servo[31]':
case 'servo[32]':
case 'servo[33]':
return value.toFixed(0) + "us";

/*
Expand Down
10 changes: 6 additions & 4 deletions js/graph_spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
canvasCtx.lineTo(x, HEIGHT);

canvasCtx.stroke();

if (label != null) drawAxisLabel(label + ' ' + (frequency.toFixed(0)) + "Hz", (x + 2), OFFSET, 'left');
if (label != null && isFinite(frequency) && !isNaN(frequency)) drawAxisLabel(label + ' ' + (frequency.toFixed(0)) + "Hz", (x + 2), OFFSET, 'left');

};

Expand All @@ -337,7 +336,10 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {

canvasCtx.stroke();
var textAlign = (i == 0) ? 'left' : ((i == ticks) ? 'right' : 'center');
drawAxisLabel((frequency.toFixed(0)) + "Hz", i * (WIDTH / ticks), HEIGHT + MARGIN, textAlign);

if(isFinite(frequency)) {
drawAxisLabel((frequency.toFixed(0)) + "Hz", i * (WIDTH / ticks), HEIGHT + MARGIN, textAlign);
}
frequency += frequencyInterval;
}
};
Expand Down Expand Up @@ -423,4 +425,4 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
}
}

}
}
10 changes: 6 additions & 4 deletions js/grapher.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,10 +1054,12 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
// Draw Analyser
if (options.drawAnalyser && graphConfig.selectedFieldName) {
try{ // If we do not select a graph/field, then the analyser is hidden
var graph = graphs[graphConfig.selectedGraphIndex];
var field = graph.fields[graphConfig.selectedFieldIndex];
analyser.plotSpectrum(field.index, field.curve, graphConfig.selectedFieldName);
} catch(err) {console.log('Cannot plot analyser');}
var graph = graphs[graphConfig.selectedGraphIndex];
var field = graph.fields[graphConfig.selectedFieldIndex];
analyser.plotSpectrum(field.index, field.curve, graphConfig.selectedFieldName);
} catch(err) {
console.log('Cannot plot analyser' + err);
}
}

//Draw Watermark
Expand Down
Loading
Loading