Skip to content
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
1 change: 1 addition & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ rustflags = [

[alias]
fileio = "run --bin fileio --no-default-features --features env_logger,indicatif --"
settings = "run --bin piksi-settings --no-default-features --features env_logger --"
84 changes: 62 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ jobs:
strategy:
matrix:
os:
- {name: ubuntu-18.04, exe_suffix: "" }
- {name: macos-10.15, exe_suffix: "" }
- {name: windows-2019, exe_suffix: ".exe" }
- {name: ubuntu-18.04, exe_suffix: "", short_name: "linux"}
- {name: macos-10.15, exe_suffix: "", short_name: "macos"}
- {name: windows-2019, exe_suffix: ".exe", short_name: "windows"}

runs-on: ${{ matrix.os.name }}

Expand Down Expand Up @@ -319,6 +319,19 @@ jobs:
LIBCLANG_PATH: ${{ env.LIBCLANG_PATH_WIN }}
if: matrix.os.name == 'windows-2019'

- name: Build ${{ runner.os }} piksi-settings binary.
run: |
cargo build --bin piksi-settings --features="env_logger" --release
# Building on Mac currently not working (DEVINFRA-612)
if: matrix.os.name != 'windows-2019' && matrix.os.name != 'macos-10.15'

- name: Build ${{ runner.os }} piksi-settings binary.
run: |
cargo build --bin piksi-settings --features="env_logger" --release
env:
LIBCLANG_PATH: ${{ env.LIBCLANG_PATH_WIN }}
if: matrix.os.name == 'windows-2019'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not uploading any artifact just simply building it. So we should add an artifact upload. The fileio also only uploads artifacts to builds. So when we create a release it still only shows the installers. Maybe you could add this and the fileio binaries to the release stage as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you think it is groovy you can push a test tag to see if it is working

Copy link
Contributor Author

@notoriaga notoriaga Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh good catch. I can do that. Is the intent have one big "swift-toolbox" zip that contains everything, or should we have separate downloads for each tool? Or perhaps we can have both?

Copy link
Collaborator

@john-michaelburke john-michaelburke Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having separate files makes more sense. Not sure if we want to sign these as well though. Was this done for the old app @silverjam ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh good catch. I can do that. Is the intent have one big "swift-toolbox" zip that contains everything, or should we have separate downloads for each tool? Or perhaps we can have both?

I think having both would be great. Having it in console installer would mean you automatically have them if you have the console and a separate download for just the CLI tools in the release would allow people on bandwidth constrained environments to grab just the command line tools.

I think having separate files makes more sense. Not sure if we want to sign these as well though. Was this done for the old app @silverjam ?

We should probably sign the command line tools for the "CLI only" zip, or sign the zip file itself

- name: Pull Git LFS objects
run: git lfs pull
env:
Expand Down Expand Up @@ -350,17 +363,12 @@ jobs:
release-archive.filename
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-fileio
path: |
./target/release/fileio${{ matrix.os.exe_suffix}}

name: fileio_${{ matrix.os.short_name }}
path: ./target/release/fileio${{ matrix.os.exe_suffix }}
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-installer
path: |
${{ env.INSTALLER_ARCHIVE }}
installer-archive.filename
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
name: piksi-settings_${{ matrix.os.short_name }}
path: ./target/release/piksi-settings${{ matrix.os.exe_suffix }}
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-artifacts-debug
Expand All @@ -379,6 +387,13 @@ jobs:
shell: bash
run: |
cargo make disk-usage-bench
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-installer
path: |
${{ env.INSTALLER_ARCHIVE }}
installer-archive.filename
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')

frontend_bench:
name: Run Frontend Benchmarks
Expand Down Expand Up @@ -488,7 +503,7 @@ jobs:
run: |
set /p executable=<installer-archive.filename
"${{ env.CODE_SIGNER_PATH_WIN }}" sign /debug /v /n "Swift Navigation, Inc." /a /tr http://rfc3161timestamp.globalsign.com/advanced /td SHA256 %executable%

- name: Add archive to path.
shell: bash
run: |
Expand All @@ -500,7 +515,6 @@ jobs:
path: |
${{ env.INSTALLER_ARCHIVE }}
installer-archive.filename


release:
name: Create Release
Expand All @@ -514,27 +528,49 @@ jobs:
DATE="$(date '+%Y-%m-%d')";
echo "DATE=${DATE}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Pull Windows Artifacts
- name: Pull Windows Installer
uses: actions/download-artifact@v2
with:
name: Windows-installer-signed
path: |
windows
- name: Pull Linux Artifacts
path: windows
- name: Pull Windows fileio
uses: actions/download-artifact@v2
with:
name: fileio_windows
path: windows
- name: Pull Windows piksi-settings
uses: actions/download-artifact@v2
with:
name: piksi-settings_windows
path: windows
- name: Pull Linux Installer
uses: actions/download-artifact@v2
with:
name: Linux-installer
path: |
linux
- name: Pull macOS Artifacts
path: linux
- name: Pull Linux fileio
uses: actions/download-artifact@v2
with:
name: fileio_linux
path: linux
- name: Pull Linux piksi-settings
uses: actions/download-artifact@v2
with:
name: piksi-settings_linux
path: linux
- name: Pull macOS Installer
uses: actions/download-artifact@v2
with:
name: macOS-installer
path: |
macos
- name: Store Env Vars
- name: Prepare Release
shell: bash
run: |
mv linux/fileio linux/fileio_${{ env.VERSION }}_linux
mv linux/piksi-settings linux/piksi-settings_${{ env.VERSION }}_linux
mv windows/fileio.exe windows/fileio_${{ env.VERSION }}_windows.exe
mv windows/piksi-settings.exe windows/piksi-settings_${{ env.VERSION }}_windows.exe
echo "WINDOWS_ARCHIVE=$(cat windows/installer-archive.filename)" >>$GITHUB_ENV
echo "LINUX_ARCHIVE=$(cat linux/installer-archive.filename)" >>$GITHUB_ENV
echo "MACOS_ARCHIVE=$(cat macos/installer-archive.filename)" >>$GITHUB_ENV
Expand All @@ -544,7 +580,11 @@ jobs:
name: "${{ env.VERSION }}-${{ env.DATE }}"
files: |
windows/${{ env.WINDOWS_ARCHIVE }}
windows/fileio_${{ env.VERSION }}_windows.exe
windows/piksi-settings_${{ env.VERSION }}_windows.exe
linux/${{ env.LINUX_ARCHIVE }}
linux/fileio_${{ env.VERSION }}_linux
linux/piksi-settings_${{ env.VERSION }}_linux
macos/${{ env.MACOS_ARCHIVE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions console_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ bench = false
name = "cpu_benches"
harness = false

[[bin]]
name = "piksi-settings"
path = "src/bin/settings.rs"
bench = false
required-features = ["env_logger"]

[[bin]]
name = "fileio"
path = "src/bin/fileio.rs"
Expand Down
41 changes: 5 additions & 36 deletions console_backend/src/bin/fileio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ use std::{
use anyhow::{anyhow, Context};
use clap::{
AppSettings::{ArgRequiredElseHelp, DeriveDisplayOrder},
Args, Parser,
Parser,
};
use indicatif::{ProgressBar, ProgressStyle};
use sbp::{link::LinkSource, SbpIterExt};

use console_backend::{
cli_options::is_baudrate,
connection::{SerialConnection, TcpConnection},
cli_options::ConnectionOpts,
connection::Connection,
fileio::Fileio,
types::{FlowControl, MsgSender, Result},
types::{MsgSender, Result},
};

fn main() -> Result<()> {
Expand Down Expand Up @@ -95,26 +95,6 @@ struct Opts {
conn: ConnectionOpts,
}

#[derive(Args)]
struct ConnectionOpts {
/// The port to use when connecting via TCP
#[clap(long, default_value = "55555", conflicts_with_all = &["baudrate", "flow-control"])]
port: u16,

/// The baudrate for processing packets when connecting via serial
#[clap(
long,
default_value = "115200",
validator(is_baudrate),
conflicts_with = "port"
)]
baudrate: u32,

/// The flow control spec to use when connecting via serial
#[clap(long, default_value = "None", conflicts_with = "port")]
flow_control: FlowControl,
}

fn list(target: Target, conn: ConnectionOpts) -> Result<()> {
let remote = target
.into_remote()
Expand Down Expand Up @@ -228,18 +208,7 @@ struct Remote {

impl Remote {
fn connect(&self, conn: ConnectionOpts) -> Result<Fileio> {
let (reader, writer) = match File::open(&self.host) {
Err(e) if e.kind() == io::ErrorKind::PermissionDenied => return Err(e.into()),
Ok(_) => {
log::debug!("connecting via serial");
SerialConnection::new(self.host.clone(), conn.baudrate, conn.flow_control)
.try_connect(None)?
}
Err(_) => {
log::debug!("connecting via tcp");
TcpConnection::new(self.host.clone(), conn.port)?.try_connect(None)?
}
};
let (reader, writer) = Connection::discover(self.host.clone(), conn)?.try_connect(None)?;
let source = LinkSource::new();
let link = source.link();
std::thread::spawn(move || {
Expand Down
Loading