From 8e7c337fe4215ddc019d63c5f7954e59a978eca8 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Sun, 6 Feb 2022 15:28:18 -0800 Subject: [PATCH 01/15] add settings cli --- .cargo/config | 1 + console_backend/Cargo.toml | 6 + console_backend/src/bin/fileio.rs | 41 +----- console_backend/src/bin/settings.rs | 185 ++++++++++++++++++++++++++++ console_backend/src/cli_options.rs | 22 +++- console_backend/src/connection.rs | 16 +++ console_backend/src/settings_tab.rs | 35 ++++-- 7 files changed, 259 insertions(+), 47 deletions(-) create mode 100644 console_backend/src/bin/settings.rs diff --git a/.cargo/config b/.cargo/config index 03a0de7d8..8a4c28771 100644 --- a/.cargo/config +++ b/.cargo/config @@ -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 --" diff --git a/console_backend/Cargo.toml b/console_backend/Cargo.toml index e5a476ff0..ef431a399 100644 --- a/console_backend/Cargo.toml +++ b/console_backend/Cargo.toml @@ -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" diff --git a/console_backend/src/bin/fileio.rs b/console_backend/src/bin/fileio.rs index 6c17c06d7..d33521a28 100644 --- a/console_backend/src/bin/fileio.rs +++ b/console_backend/src/bin/fileio.rs @@ -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<()> { @@ -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() @@ -228,18 +208,7 @@ struct Remote { impl Remote { fn connect(&self, conn: ConnectionOpts) -> Result { - 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 || { diff --git a/console_backend/src/bin/settings.rs b/console_backend/src/bin/settings.rs new file mode 100644 index 000000000..f60d75fca --- /dev/null +++ b/console_backend/src/bin/settings.rs @@ -0,0 +1,185 @@ +use std::{convert::Infallible, path::PathBuf, str::FromStr, sync::Arc}; + +use anyhow::anyhow; +use clap::{AppSettings::DeriveDisplayOrder, Parser}; +use sbp::SbpIterExt; + +use console_backend::{ + cli_options::ConnectionOpts, + client_sender::TestSender, + connection::Connection, + settings_tab::SettingsTab, + shared_state::SharedState, + types::{MsgSender, Result}, +}; + +fn main() -> Result<()> { + if std::env::var("RUST_LOG").is_err() { + std::env::set_var("RUST_LOG", "info"); + } + env_logger::init(); + let opts = Opts::parse(); + let settings = connect(&opts)?; + + log::info!("Loading settings..."); + settings.refresh(); + + if let Some(path) = opts.export { + settings.export(&path)?; + log::info!("Exported settings to {}", path.display()); + } else if let Some(path) = opts.import { + settings.import(&path)?; + log::info!("Imported settings from {}", path.display()); + } else if let Some(read_cmd) = opts.read { + read(read_cmd, &settings)?; + } else if let Some(write_cmds) = opts.write { + write(&write_cmds, &settings)?; + } else if opts.reset { + log::info!("Reseting settings to factory defaults"); + settings.reset(true)?; + } else { + return Err(anyhow!("No command specified")); + } + + if opts.save { + log::info!("Saving settings to flash"); + settings.save()?; + } + + Ok(()) +} + +fn read(read_cmd: ReadCmd, settings: &SettingsTab) -> Result<()> { + let settings = if let Some(name) = read_cmd.name { + vec![settings.get(&read_cmd.group, &name)?] + } else { + settings.group(&read_cmd.group)? + }; + for entry in settings { + println!( + "{}.{}={}", + entry.setting.group, + entry.setting.name, + entry.value.map(|s| s.to_string()).unwrap_or_default() + ) + } + Ok(()) +} + +fn write(write_cmds: &[WriteCmd], settings: &SettingsTab) -> Result<()> { + for cmd in write_cmds { + log::debug!("{cmd:?}"); + settings.write_setting(&cmd.group, &cmd.name, &cmd.value)?; + log::info!("Wrote {}.{}={}", cmd.group, cmd.name, cmd.value); + } + Ok(()) +} + +/// Piksi settings operations. +#[derive(Parser)] +#[clap( + name = "piksi-settings", + version = include_str!("../version.txt"), + setting = DeriveDisplayOrder, +)] +struct Opts { + /// The serial port or TCP stream + device: String, + + /// Read a setting value + #[clap(long, conflicts_with_all = &["write", "import", "export"])] + read: Option, + + /// Write a setting value + #[clap( + long, + conflicts_with_all = &["read", "import", "export"] + )] + write: Option>, + + /// Export the devices settings + #[clap(long, conflicts_with_all = &["import", "read", "write"])] + export: Option, + + /// Import an ini file + #[clap(long, conflicts_with_all = &["read", "write", "export"])] + import: Option, + + /// Save settings to flash + #[clap(long, conflicts_with_all = &["read", "export"])] + save: bool, + + /// Reset settings to factory defaults + #[clap(long, conflicts_with_all = &["read", "write", "import", "export", "save"])] + reset: bool, + + #[clap(flatten)] + conn: ConnectionOpts, +} + +fn connect(opts: &Opts) -> Result> { + let (reader, writer) = + Connection::discover(opts.device.clone(), opts.conn)?.try_connect(None)?; + let sender = MsgSender::new(writer); + let shared_state = SharedState::new(); + let settings = Arc::new(SettingsTab::new(shared_state, TestSender::boxed(), sender)); + std::thread::spawn({ + let settings = Arc::clone(&settings); + move || { + let messages = sbp::iter_messages(reader).log_errors(log::Level::Debug); + for msg in messages { + settings.handle_msg(msg); + } + } + }); + Ok(settings) +} + +struct ReadCmd { + group: String, + name: Option, +} + +impl FromStr for ReadCmd { + type Err = Infallible; + + fn from_str(s: &str) -> std::result::Result { + if let Some(idx) = s.find('.') { + let (group, name) = s.split_at(idx); + Ok(ReadCmd { + group: group.to_owned(), + name: Some(name[1..].to_owned()), + }) + } else { + Ok(ReadCmd { + group: s.to_owned(), + name: None, + }) + } + } +} + +#[derive(Debug)] +struct WriteCmd { + group: String, + name: String, + value: String, +} + +impl FromStr for WriteCmd { + type Err = &'static str; + + fn from_str(s: &str) -> std::result::Result { + const ERROR: &str = "write arguments must be of the form .="; + + let eq_idx = s.find('=').ok_or(ERROR)?; + let (setting, value) = s.split_at(eq_idx); + let dot_idx = setting.find('.').ok_or(ERROR)?; + let (group, name) = setting.split_at(dot_idx); + Ok(WriteCmd { + group: group.to_owned(), + name: name[1..].to_owned(), + value: value[1..].to_owned(), + }) + } +} diff --git a/console_backend/src/cli_options.rs b/console_backend/src/cli_options.rs index 00f5666b6..f782590b2 100644 --- a/console_backend/src/cli_options.rs +++ b/console_backend/src/cli_options.rs @@ -4,7 +4,7 @@ use std::{ str::FromStr, }; -use clap::{AppSettings::DeriveDisplayOrder, Parser}; +use clap::{AppSettings::DeriveDisplayOrder, Args, Parser}; use log::{debug, error}; use strum::VariantNames; @@ -251,6 +251,26 @@ impl Input { } } +#[derive(Clone, Copy, Args)] +pub struct ConnectionOpts { + /// The port to use when connecting via TCP + #[clap(long, default_value = "55555", conflicts_with_all = &["baudrate", "flow-control"])] + pub port: u16, + + /// The baudrate for processing packets when connecting via serial + #[clap( + long, + default_value = "115200", + validator(is_baudrate), + conflicts_with = "port" + )] + pub baudrate: u32, + + /// The flow control spec to use when connecting via serial + #[clap(long, default_value = "None", conflicts_with = "port")] + pub flow_control: FlowControl, +} + /// Validation for the refresh-rate cli option. /// /// # Parameters diff --git a/console_backend/src/connection.rs b/console_backend/src/connection.rs index c1c48a4e8..4492095b3 100644 --- a/console_backend/src/connection.rs +++ b/console_backend/src/connection.rs @@ -13,6 +13,7 @@ use std::{ use crossbeam::channel::Sender; use log::{error, info}; +use crate::cli_options::ConnectionOpts; use crate::client_sender::BoxedClientSender; use crate::constants::*; use crate::process_messages::{process_messages, Messages}; @@ -278,6 +279,21 @@ impl Connection { )) } + /// Connect via a serial port or tcp + pub fn discover(host: String, opts: ConnectionOpts) -> Result { + match fs::File::open(&host) { + Err(e) if e.kind() == io::ErrorKind::PermissionDenied => Err(e.into()), + Ok(_) => { + log::debug!("connecting via serial"); + Ok(Connection::serial(host, opts.baudrate, opts.flow_control)) + } + Err(_) => { + log::debug!("connecting via tcp"); + Connection::tcp(host, opts.port) + } + } + } + pub fn name(&self) -> String { match self { Connection::Tcp(conn) => conn.name(), diff --git a/console_backend/src/settings_tab.rs b/console_backend/src/settings_tab.rs index 3c28b412d..2f006b2b5 100644 --- a/console_backend/src/settings_tab.rs +++ b/console_backend/src/settings_tab.rs @@ -149,14 +149,28 @@ impl SettingsTab { self.shared_state.reset_settings_state(); } - fn refresh(&self) { + pub fn get(&self, group: &str, name: &str) -> Result { + self.settings.lock().get(group, name).map(Clone::clone) + } + + pub fn group(&self, group: &str) -> Result> { + let group = self + .settings + .lock() + .group(group)? + .map(Clone::clone) + .collect(); + Ok(group) + } + + pub fn refresh(&self) { (*self.settings.lock()) = Settings::new(); self.send_table_data(); self.read_all_settings(); self.send_table_data(); } - fn export(&self, path: &Path) -> Result<()> { + pub fn export(&self, path: &Path) -> Result<()> { let mut f = fs::File::create(path)?; let settings = self.settings.lock(); let groups = settings.groups(); @@ -172,7 +186,7 @@ impl SettingsTab { Ok(()) } - fn import(&self, path: &Path) -> Result<()> { + pub fn import(&self, path: &Path) -> Result<()> { let mut f = fs::File::open(path)?; let conf = Ini::read_from(&mut f)?; let old_ethernet = self.set_if_group_changes( @@ -244,7 +258,7 @@ impl SettingsTab { .send_data(serialize_capnproto_builder(builder)); } - fn reset(&self, reset_settings: bool) -> Result<()> { + pub fn reset(&self, reset_settings: bool) -> Result<()> { let flags = if reset_settings { 1 } else { 0 }; self.msg_sender.send(MsgReset { flags, @@ -252,7 +266,7 @@ impl SettingsTab { }) } - fn save(&self) -> Result<()> { + pub fn save(&self) -> Result<()> { self.msg_sender.send(MsgSettingsSave { sender_id: None }) } @@ -359,7 +373,7 @@ impl SettingsTab { .send_data(serialize_capnproto_builder(builder)); } - fn write_setting(&self, group: &str, name: &str, value: &str) -> Result<()> { + pub fn write_setting(&self, group: &str, name: &str, value: &str) -> Result<()> { { let settings = self.settings.lock(); if let Ok(e) = settings.get(group, name) { @@ -614,6 +628,7 @@ pub struct SaveRequest { pub value: String, } +#[derive(Clone)] struct Settings { inner: IndexMap>, default: SettingValue, @@ -705,8 +720,8 @@ impl Settings { } /// A reference to a particular setting and its value if it has been fetched -#[derive(Debug)] -struct SettingsEntry { - setting: Cow<'static, Setting>, - value: Option, +#[derive(Debug, Clone)] +pub struct SettingsEntry { + pub setting: Cow<'static, Setting>, + pub value: Option, } From 40151b8ed6c941beb0de85d997efd963f4d731a0 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Sun, 6 Feb 2022 15:34:18 -0800 Subject: [PATCH 02/15] cleanup --- console_backend/src/bin/settings.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/console_backend/src/bin/settings.rs b/console_backend/src/bin/settings.rs index f60d75fca..8f7062ff1 100644 --- a/console_backend/src/bin/settings.rs +++ b/console_backend/src/bin/settings.rs @@ -1,6 +1,5 @@ use std::{convert::Infallible, path::PathBuf, str::FromStr, sync::Arc}; -use anyhow::anyhow; use clap::{AppSettings::DeriveDisplayOrder, Parser}; use sbp::SbpIterExt; @@ -37,8 +36,6 @@ fn main() -> Result<()> { } else if opts.reset { log::info!("Reseting settings to factory defaults"); settings.reset(true)?; - } else { - return Err(anyhow!("No command specified")); } if opts.save { From 8167fc6bfd06ef0084fe69f646157db5d82cfa85 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 09:41:13 -0800 Subject: [PATCH 03/15] build settings binary --- .github/workflows/main.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a897cac5..ec4bceb6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -319,6 +319,18 @@ 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 + if: matrix.os.name != 'windows-2019' + + - 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' + - name: Pull Git LFS objects run: git lfs pull env: @@ -488,7 +500,7 @@ jobs: run: | set /p executable= Date: Mon, 7 Feb 2022 09:48:01 -0800 Subject: [PATCH 04/15] typo --- console_backend/src/bin/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console_backend/src/bin/settings.rs b/console_backend/src/bin/settings.rs index 8f7062ff1..cb5d90217 100644 --- a/console_backend/src/bin/settings.rs +++ b/console_backend/src/bin/settings.rs @@ -34,7 +34,7 @@ fn main() -> Result<()> { } else if let Some(write_cmds) = opts.write { write(&write_cmds, &settings)?; } else if opts.reset { - log::info!("Reseting settings to factory defaults"); + log::info!("Resetting settings to factory defaults"); settings.reset(true)?; } From 5460249fd9f948d035d5594b813f4ae2a5eefecc Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 10:14:07 -0800 Subject: [PATCH 05/15] custom usage --- console_backend/src/bin/settings.rs | 54 ++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/console_backend/src/bin/settings.rs b/console_backend/src/bin/settings.rs index cb5d90217..b782829e5 100644 --- a/console_backend/src/bin/settings.rs +++ b/console_backend/src/bin/settings.rs @@ -78,36 +78,74 @@ fn write(write_cmds: &[WriteCmd], settings: &SettingsTab) -> Result<()> { name = "piksi-settings", version = include_str!("../version.txt"), setting = DeriveDisplayOrder, + override_usage = "\ + piksi-settings [OPTIONS] + + Examples: + - Read a setting: + piksi-settings /dev/ttyUSB0 --read imu.acc_range + - Read a group of settings: + piksi-settings /dev/ttyUSB0 --read imu + - Write a setting value: + piksi-settings /dev/ttyUSB0 --write imu.acc_range=2g + - Write multiple settings and save to flash: + piksi-settings /dev/ttyUSB0 -w imu.acc_range=2g -w imu.imu_rate=100 --save + - Export a device's settings + piksi-settings /dev/ttyUSB0 --export ./config.ini + - Import a device's settings + piksi-settings /dev/ttyUSB0 --import ./config.ini + " )] struct Opts { /// The serial port or TCP stream device: String, - /// Read a setting value - #[clap(long, conflicts_with_all = &["write", "import", "export"])] + /// Read a setting or a group of settings + #[clap( + long, + short, + value_name = "GROUP[.SETTING]", + conflicts_with_all = &["write", "import", "export", "reset"] + )] read: Option, /// Write a setting value #[clap( long, - conflicts_with_all = &["read", "import", "export"] + short, + value_name = "GROUP.SETTING=VALUE", + conflicts_with_all = &["read", "import", "export", "reset"] )] write: Option>, /// Export the devices settings - #[clap(long, conflicts_with_all = &["import", "read", "write"])] + #[clap( + long, + value_name = "PATH", + conflicts_with_all = &["import", "read", "write", "reset"] + )] export: Option, /// Import an ini file - #[clap(long, conflicts_with_all = &["read", "write", "export"])] + #[clap( + long, + value_name = "PATH", + conflicts_with_all = &["read", "write", "export", "reset"] + )] import: Option, - /// Save settings to flash - #[clap(long, conflicts_with_all = &["read", "export"])] + /// Save settings to flash. Can be combined with --write or --import to save after writing + #[clap( + long, + conflicts_with_all = &["read", "export", "reset"] + )] save: bool, /// Reset settings to factory defaults - #[clap(long, conflicts_with_all = &["read", "write", "import", "export", "save"])] + #[clap( + long, + conflicts_with_all = &["read", "write", "export", "import", "save"] + )] reset: bool, #[clap(flatten)] From 1287576bc1ee0dbfdd85b7d44522a0fb06ba17e1 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 11:38:06 -0800 Subject: [PATCH 06/15] add release --- .github/workflows/main.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec4bceb6e..7a24c4e17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -322,7 +322,8 @@ jobs: - name: Build ${{ runner.os }} piksi-settings binary. run: | cargo build --bin piksi-settings --features="env_logger" --release - if: matrix.os.name != 'windows-2019' + # 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: | @@ -368,11 +369,9 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: ${{ runner.os }}-installer + name: ${{ runner.os }}-piksi-settings path: | - ${{ env.INSTALLER_ARCHIVE }} - installer-archive.filename - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + ./target/release/piksi-settings${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: name: ${{ runner.os }}-artifacts-debug @@ -391,6 +390,25 @@ jobs: shell: bash run: | cargo make disk-usage-bench + - uses: actions/upload-artifact@v2 + with: + name: ${{ runner.os }}-fileio + path: | + ./target/release/fileio${{ matrix.os.exe_suffix}} + if: matrix.os.name != 'macos-10.15' && github.event_name == 'push' && contains(github.ref, 'refs/tags') + - uses: actions/upload-artifact@v2 + with: + name: ${{ runner.os }}-piksi-settings + path: | + ./target/release/piksi-settings${{ matrix.os.exe_suffix}} + if: matrix.os.name != 'macos-10.15' && github.event_name == 'push' && contains(github.ref, 'refs/tags') + - 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 From 1571bc0de0f49d7197eade807621e0ef78621673 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 12:45:41 -0800 Subject: [PATCH 07/15] add files to release --- .github/workflows/main.yml | 51 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a24c4e17..06874c0e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -363,15 +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-${{RUNNER_OS,,}} + path: ./target/release/fileio${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: - name: ${{ runner.os }}-piksi-settings - path: | - ./target/release/piksi-settings${{ matrix.os.exe_suffix}} + name: piksi-settings-${{RUNNER_OS,,}} + path: ./target/release/piksi-settings${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: name: ${{ runner.os }}-artifacts-debug @@ -390,18 +387,6 @@ jobs: shell: bash run: | cargo make disk-usage-bench - - uses: actions/upload-artifact@v2 - with: - name: ${{ runner.os }}-fileio - path: | - ./target/release/fileio${{ matrix.os.exe_suffix}} - if: matrix.os.name != 'macos-10.15' && github.event_name == 'push' && contains(github.ref, 'refs/tags') - - uses: actions/upload-artifact@v2 - with: - name: ${{ runner.os }}-piksi-settings - path: | - ./target/release/piksi-settings${{ matrix.os.exe_suffix}} - if: matrix.os.name != 'macos-10.15' && github.event_name == 'push' && contains(github.ref, 'refs/tags') - uses: actions/upload-artifact@v2 with: name: ${{ runner.os }}-installer @@ -544,18 +529,32 @@ 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 + path: windows + - name: Pull Windows fileio + uses: actions/download-artifact@v2 + with: + name: fileio-windows + - name: Pull Windows piksi-settings + uses: actions/download-artifact@v2 + with: + name: piksi-settings-windows - name: Pull Linux Artifacts uses: actions/download-artifact@v2 with: name: Linux-installer - path: | - linux + path: linux + - name: Pull Linux fileio + uses: actions/download-artifact@v2 + with: + name: fileio-linux + - name: Pull Linux piksi-settings + uses: actions/download-artifact@v2 + with: + name: piksi-settings-linux - name: Pull macOS Artifacts uses: actions/download-artifact@v2 with: @@ -576,5 +575,9 @@ jobs: windows/${{ env.WINDOWS_ARCHIVE }} linux/${{ env.LINUX_ARCHIVE }} macos/${{ env.MACOS_ARCHIVE }} + fileio-windows + piksi-settings-windows + fileio-linux + piksi-settings-linux env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8abab1604f687ac8a3d748e28b143fd9ce621932 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 12:57:32 -0800 Subject: [PATCH 08/15] consistent names --- .github/workflows/main.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06874c0e2..c0e320776 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -363,11 +363,11 @@ jobs: release-archive.filename - uses: actions/upload-artifact@v2 with: - name: fileio-${{RUNNER_OS,,}} + name: fileio_${{RUNNER_OS,,}} path: ./target/release/fileio${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: - name: piksi-settings-${{RUNNER_OS,,}} + name: piksi-settings_${{RUNNER_OS,,}} path: ./target/release/piksi-settings${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: @@ -537,11 +537,13 @@ jobs: - name: Pull Windows fileio uses: actions/download-artifact@v2 with: - name: fileio-windows + name: fileio_windows + path: fileio_${{ env.VERSION }}_windows.exe - name: Pull Windows piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings-windows + name: piksi-settings_windows + path: piksi-settings_${{ env.VERSION }}_windows.exe - name: Pull Linux Artifacts uses: actions/download-artifact@v2 with: @@ -550,11 +552,13 @@ jobs: - name: Pull Linux fileio uses: actions/download-artifact@v2 with: - name: fileio-linux + name: fileio_linux + path: fileio_${{ env.VERSION }}_linux - name: Pull Linux piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings-linux + name: piksi-settings_linux + path: piksi-settings_${{ env.VERSION }}_linux - name: Pull macOS Artifacts uses: actions/download-artifact@v2 with: @@ -575,9 +579,9 @@ jobs: windows/${{ env.WINDOWS_ARCHIVE }} linux/${{ env.LINUX_ARCHIVE }} macos/${{ env.MACOS_ARCHIVE }} - fileio-windows - piksi-settings-windows - fileio-linux - piksi-settings-linux + fileio_${{ env.VERSION }}_windows.exe + fileio_${{ env.VERSION }}_linux + piksi-settings_${{ env.VERSION }}_windows.exe + piksi-settings_${{ env.VERSION }}_linux env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 01ea5ea48a224fd3ea56a5694df5725ad37399e2 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 13:27:39 -0800 Subject: [PATCH 09/15] fix --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0e320776..7769eb60c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -363,11 +363,11 @@ jobs: release-archive.filename - uses: actions/upload-artifact@v2 with: - name: fileio_${{RUNNER_OS,,}} + name: ${{ runner.os }}-fileio path: ./target/release/fileio${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: - name: piksi-settings_${{RUNNER_OS,,}} + name: ${{ runner.os }}-piksi-settings path: ./target/release/piksi-settings${{ matrix.os.exe_suffix}} - uses: actions/upload-artifact@v2 with: @@ -537,12 +537,12 @@ jobs: - name: Pull Windows fileio uses: actions/download-artifact@v2 with: - name: fileio_windows + name: Windows-fileio path: fileio_${{ env.VERSION }}_windows.exe - name: Pull Windows piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings_windows + name: Windows-piksi-settings path: piksi-settings_${{ env.VERSION }}_windows.exe - name: Pull Linux Artifacts uses: actions/download-artifact@v2 @@ -552,12 +552,12 @@ jobs: - name: Pull Linux fileio uses: actions/download-artifact@v2 with: - name: fileio_linux + name: Linux-fileio path: fileio_${{ env.VERSION }}_linux - name: Pull Linux piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings_linux + name: Linux-piksi-settings path: piksi-settings_${{ env.VERSION }}_linux - name: Pull macOS Artifacts uses: actions/download-artifact@v2 From e0b4262417207692b373a0754f49814258a60067 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 14:46:27 -0800 Subject: [PATCH 10/15] use glob --- .github/workflows/main.yml | 44 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7769eb60c..cbfa0bc84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} @@ -363,12 +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 }}${{ matrix.os.exe_suffix }} + path: ./target/release/fileio${{ matrix.os.exe_suffix }} - uses: actions/upload-artifact@v2 with: - name: ${{ runner.os }}-piksi-settings - path: ./target/release/piksi-settings${{ matrix.os.exe_suffix}} + name: piksi-settings_${{ matrix.os.short_name }}${{ matrix.os.exe_suffix }} + path: ./target/release/piksi-settings${{ matrix.os.exe_suffix }} - uses: actions/upload-artifact@v2 with: name: ${{ runner.os }}-artifacts-debug @@ -537,13 +537,13 @@ jobs: - name: Pull Windows fileio uses: actions/download-artifact@v2 with: - name: Windows-fileio - path: fileio_${{ env.VERSION }}_windows.exe + name: fileio_${{ env.VERSION }}_windows.exe + path: windows - name: Pull Windows piksi-settings uses: actions/download-artifact@v2 with: - name: Windows-piksi-settings - path: piksi-settings_${{ env.VERSION }}_windows.exe + name: piksi-settings_${{ env.VERSION }}_windows.exe + path: windows - name: Pull Linux Artifacts uses: actions/download-artifact@v2 with: @@ -552,22 +552,26 @@ jobs: - name: Pull Linux fileio uses: actions/download-artifact@v2 with: - name: Linux-fileio - path: fileio_${{ env.VERSION }}_linux + name: fileio_${{ env.VERSION }}_linux + path: linux - name: Pull Linux piksi-settings uses: actions/download-artifact@v2 with: - name: Linux-piksi-settings - path: piksi-settings_${{ env.VERSION }}_linux + name: piksi-settings_${{ env.VERSION }}_linux + path: linux - name: Pull macOS Artifacts 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 linux/fileio_${{ env.VERSION }}_linux + mv linux/piksi-settings_linux linux/piksi-settings_${{ env.VERSION }}_linux + mv windows/fileio_windows.exe windows/fileio_${{ env.VERSION }}_windows.exe + mv windows/piksi-settings_windows.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 @@ -577,11 +581,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 }} - fileio_${{ env.VERSION }}_windows.exe - fileio_${{ env.VERSION }}_linux - piksi-settings_${{ env.VERSION }}_windows.exe - piksi-settings_${{ env.VERSION }}_linux env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b8b0a279a08aef52b0b235f80e9cf3b0bc937cb0 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 19:38:14 -0800 Subject: [PATCH 11/15] fix --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cbfa0bc84..304d306cd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -537,12 +537,12 @@ jobs: - name: Pull Windows fileio uses: actions/download-artifact@v2 with: - name: fileio_${{ env.VERSION }}_windows.exe + name: fileio_windows.exe path: windows - name: Pull Windows piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings_${{ env.VERSION }}_windows.exe + name: piksi-settings_windows.exe path: windows - name: Pull Linux Artifacts uses: actions/download-artifact@v2 @@ -552,12 +552,12 @@ jobs: - name: Pull Linux fileio uses: actions/download-artifact@v2 with: - name: fileio_${{ env.VERSION }}_linux + name: fileio_linux path: linux - name: Pull Linux piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings_${{ env.VERSION }}_linux + name: piksi-settings_linux path: linux - name: Pull macOS Artifacts uses: actions/download-artifact@v2 From b9cccd7364b4eb053fc6ab86d9c26bd99365d16d Mon Sep 17 00:00:00 2001 From: notoriaga Date: Mon, 7 Feb 2022 20:45:15 -0800 Subject: [PATCH 12/15] hmm --- .github/workflows/main.yml | 610 ++++++++++++++++++------------------- 1 file changed, 305 insertions(+), 305 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 304d306cd..245e93707 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,170 +20,170 @@ env: jobs: - backend_bench: - - name: Backend Benchmarks - - strategy: - matrix: - os: - - ubuntu-18.04 - - macos-10.15 - - windows-2019 - - runs-on: ${{ matrix.os }} - - steps: - - - name: Checkout source - uses: actions/checkout@v2 - with: - submodules: recursive - ssh-key: ${{ secrets.SSH_KEY }} - ssh-strict: false - - - uses: webfactory/ssh-agent@v0.5.0 - with: - ssh-private-key: ${{ secrets.SSH_KEY }} - - - name: Run ssh-keyscan - run: ssh-keyscan github.com >> ~/.ssh/known_hosts - - - name: Setup SSH for Windows Git LFS - run: | - & "C:\\Program Files\\Git\\bin\\sh.exe" -c "ssh-keyscan github.com >> ~/.ssh/known_hosts" - & "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa" - if: matrix.os == 'windows-2019' - - - name: Install ${{ runner.os }} Dependencies. - shell: bash - run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt-get update && sudo apt-get install -y capnproto libudev-dev - elif [ "$RUNNER_OS" == "macOS" ]; then - brew install capnp llvm - elif [ "$RUNNER_OS" == "Windows" ]; then - choco install -y capnproto - fi - - - name: Pull Git LFS objects - run: git lfs pull - env: - GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - - uses: Swatinem/rust-cache@v1 - with: - key: ${{ secrets.CACHE_VERSION }} - - - uses: davidB/rust-cargo-make@v1 - with: - version: ${{ env.CARGO_MAKE_VERSION }} - - - name: Cache pip - uses: actions/cache@v2 - with: - path: ${{ env.PIP_CACHE_DIR }} - key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} - - - name: Set up python builder - shell: bash - run: | - cargo make setup-builder - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Run Backend Benchmarks (Windows) - env: - LIBCLANG_PATH: ${{ env.LIBCLANG_PATH_WIN }} - run: | - cargo make backend-benches - if: matrix.os == 'windows-2019' - - - name: Run Backend Benchmarks - run: | - cargo make backend-benches - if: matrix.os != 'windows-2019' - - checks: - - name: Code Quality Checks - - runs-on: ubuntu-18.04 - - steps: - - - name: Checkout source - uses: actions/checkout@v2 - with: - submodules: recursive - ssh-key: ${{ secrets.SSH_KEY }} - ssh-strict: false - - - uses: webfactory/ssh-agent@v0.5.0 - with: - ssh-private-key: ${{ secrets.SSH_KEY }} - - - name: Pull Git LFS objects - run: git lfs pull - env: - GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no - - - name: Install stable Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rustfmt, clippy - - - uses: Swatinem/rust-cache@v1 - with: - key: ${{ secrets.CACHE_VERSION }} - - - uses: davidB/rust-cargo-make@v1 - with: - version: ${{ env.CARGO_MAKE_VERSION }} - - - name: Install Dependencies. - run: | - sudo apt-get update && sudo apt-get install -y capnproto libudev-dev - - - name: Cache pip - uses: actions/cache@v2 - with: - path: ${{ env.PIP_CACHE_DIR }} - key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} - - - name: Set up python builder - shell: bash - run: | - cargo make setup-builder - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Run Checks - run: | - cargo make check-all - - - name: Run Tests - uses: nick-invision/retry@v2 - with: - timeout_minutes: 5 - max_attempts: 3 - retry_on: error - command: cargo make tests + # backend_bench: + + # name: Backend Benchmarks + + # strategy: + # matrix: + # os: + # - ubuntu-18.04 + # - macos-10.15 + # - windows-2019 + + # runs-on: ${{ matrix.os }} + + # steps: + + # - name: Checkout source + # uses: actions/checkout@v2 + # with: + # submodules: recursive + # ssh-key: ${{ secrets.SSH_KEY }} + # ssh-strict: false + + # - uses: webfactory/ssh-agent@v0.5.0 + # with: + # ssh-private-key: ${{ secrets.SSH_KEY }} + + # - name: Run ssh-keyscan + # run: ssh-keyscan github.com >> ~/.ssh/known_hosts + + # - name: Setup SSH for Windows Git LFS + # run: | + # & "C:\\Program Files\\Git\\bin\\sh.exe" -c "ssh-keyscan github.com >> ~/.ssh/known_hosts" + # & "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa" + # if: matrix.os == 'windows-2019' + + # - name: Install ${{ runner.os }} Dependencies. + # shell: bash + # run: | + # if [ "$RUNNER_OS" == "Linux" ]; then + # sudo apt-get update && sudo apt-get install -y capnproto libudev-dev + # elif [ "$RUNNER_OS" == "macOS" ]; then + # brew install capnp llvm + # elif [ "$RUNNER_OS" == "Windows" ]; then + # choco install -y capnproto + # fi + + # - name: Pull Git LFS objects + # run: git lfs pull + # env: + # GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no + + # - uses: actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: stable + + # - uses: Swatinem/rust-cache@v1 + # with: + # key: ${{ secrets.CACHE_VERSION }} + + # - uses: davidB/rust-cargo-make@v1 + # with: + # version: ${{ env.CARGO_MAKE_VERSION }} + + # - name: Cache pip + # uses: actions/cache@v2 + # with: + # path: ${{ env.PIP_CACHE_DIR }} + # key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} + + # - name: Set up python builder + # shell: bash + # run: | + # cargo make setup-builder + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Run Backend Benchmarks (Windows) + # env: + # LIBCLANG_PATH: ${{ env.LIBCLANG_PATH_WIN }} + # run: | + # cargo make backend-benches + # if: matrix.os == 'windows-2019' + + # - name: Run Backend Benchmarks + # run: | + # cargo make backend-benches + # if: matrix.os != 'windows-2019' + + # checks: + + # name: Code Quality Checks + + # runs-on: ubuntu-18.04 + + # steps: + + # - name: Checkout source + # uses: actions/checkout@v2 + # with: + # submodules: recursive + # ssh-key: ${{ secrets.SSH_KEY }} + # ssh-strict: false + + # - uses: webfactory/ssh-agent@v0.5.0 + # with: + # ssh-private-key: ${{ secrets.SSH_KEY }} + + # - name: Pull Git LFS objects + # run: git lfs pull + # env: + # GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no + + # - name: Install stable Rust + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # override: true + # components: rustfmt, clippy + + # - uses: Swatinem/rust-cache@v1 + # with: + # key: ${{ secrets.CACHE_VERSION }} + + # - uses: davidB/rust-cargo-make@v1 + # with: + # version: ${{ env.CARGO_MAKE_VERSION }} + + # - name: Install Dependencies. + # run: | + # sudo apt-get update && sudo apt-get install -y capnproto libudev-dev + + # - name: Cache pip + # uses: actions/cache@v2 + # with: + # path: ${{ env.PIP_CACHE_DIR }} + # key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} + + # - name: Set up python builder + # shell: bash + # run: | + # cargo make setup-builder + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Run Checks + # run: | + # cargo make check-all + + # - name: Run Tests + # uses: nick-invision/retry@v2 + # with: + # timeout_minutes: 5 + # max_attempts: 3 + # retry_on: error + # command: cargo make tests build: name: Build Binaries - needs: - - checks - - backend_bench + # needs: + # - checks + # - backend_bench strategy: matrix: @@ -363,11 +363,11 @@ jobs: release-archive.filename - uses: actions/upload-artifact@v2 with: - name: fileio_${{ matrix.os.short_name }}${{ 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: piksi-settings_${{ matrix.os.short_name }}${{ matrix.os.exe_suffix }} + name: piksi-settings_${{ matrix.os.short_name }} path: ./target/release/piksi-settings${{ matrix.os.exe_suffix }} - uses: actions/upload-artifact@v2 with: @@ -395,132 +395,132 @@ jobs: installer-archive.filename if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - frontend_bench: - name: Run Frontend Benchmarks - timeout-minutes: 30 - needs: - - build - strategy: - matrix: - os: - - macOS - - Windows - - Linux - runs-on: [self-hosted, '${{ matrix.os }}', bench] - steps: - - name: Remove previous build. - shell: bash - run: | - rm -rf ${{ env.APP_NAME }} - rm -rf bench - - - uses: actions/download-artifact@v2 - with: - name: ${{ matrix.os }}-artifacts - path: | - ${{ env.APP_NAME }} - - - uses: actions/download-artifact@v2 - with: - name: ${{ matrix.os }}-artifacts-bench - path: | - bench - - - name: Extract binary and data. - shell: bash - run: | - cd ${{ env.APP_NAME }} - archive=$(cat release-archive.filename) - 7z x $archive -aoa - 7z x ${archive%.xz} -aoa - echo "extracted release-archive" - mv ../bench/${{ matrix.os }}.zip . - 7z x ${{ matrix.os }}.zip -aoa - echo "extracted bench data" - - - name: Run CPU Frontend Benchmark. - uses: nick-invision/retry@v2 - with: - shell: bash - timeout_minutes: 3 - max_attempts: 3 - retry_on: error - command: | - cd ${{ env.APP_NAME }} - if [ "$RUNNER_OS" == "Windows" ]; then - python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" - elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then - chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - else - echo "Invalid platform" - exit 1 - fi - - - name: Run MEM Frontend Benchmark. - uses: nick-invision/retry@v2 - with: - shell: bash - timeout_minutes: 3 - max_attempts: 3 - retry_on: error - command: | - cd ${{ env.APP_NAME }} - if [ "$RUNNER_OS" == "Windows" ]; then - python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" - elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then - chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - else - echo "Invalid platform" - exit 1 - fi - - sign_installer: - name: Sign Installers - timeout-minutes: 30 - needs: - - frontend_bench - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - strategy: - matrix: - os: - - Windows - runs-on: [self-hosted, '${{ matrix.os }}', code-signer] - steps: - - - name: Remove previous build. - shell: bash - run: | - rm -r * - - - uses: actions/download-artifact@v2 - with: - name: ${{ matrix.os }}-installer - - - name: Sign Installer. - shell: cmd - run: | - set /p executable=>$GITHUB_ENV - - - uses: actions/upload-artifact@v2 - with: - name: ${{ runner.os }}-installer-signed - path: | - ${{ env.INSTALLER_ARCHIVE }} - installer-archive.filename + # frontend_bench: + # name: Run Frontend Benchmarks + # timeout-minutes: 30 + # needs: + # - build + # strategy: + # matrix: + # os: + # - macOS + # - Windows + # - Linux + # runs-on: [self-hosted, '${{ matrix.os }}', bench] + # steps: + # - name: Remove previous build. + # shell: bash + # run: | + # rm -rf ${{ env.APP_NAME }} + # rm -rf bench + + # - uses: actions/download-artifact@v2 + # with: + # name: ${{ matrix.os }}-artifacts + # path: | + # ${{ env.APP_NAME }} + + # - uses: actions/download-artifact@v2 + # with: + # name: ${{ matrix.os }}-artifacts-bench + # path: | + # bench + + # - name: Extract binary and data. + # shell: bash + # run: | + # cd ${{ env.APP_NAME }} + # archive=$(cat release-archive.filename) + # 7z x $archive -aoa + # 7z x ${archive%.xz} -aoa + # echo "extracted release-archive" + # mv ../bench/${{ matrix.os }}.zip . + # 7z x ${{ matrix.os }}.zip -aoa + # echo "extracted bench data" + + # - name: Run CPU Frontend Benchmark. + # uses: nick-invision/retry@v2 + # with: + # shell: bash + # timeout_minutes: 3 + # max_attempts: 3 + # retry_on: error + # command: | + # cd ${{ env.APP_NAME }} + # if [ "$RUNNER_OS" == "Windows" ]; then + # python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" + # elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then + # chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + # python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + # else + # echo "Invalid platform" + # exit 1 + # fi + + # - name: Run MEM Frontend Benchmark. + # uses: nick-invision/retry@v2 + # with: + # shell: bash + # timeout_minutes: 3 + # max_attempts: 3 + # retry_on: error + # command: | + # cd ${{ env.APP_NAME }} + # if [ "$RUNNER_OS" == "Windows" ]; then + # python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" + # elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then + # chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + # python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + # else + # echo "Invalid platform" + # exit 1 + # fi + + # sign_installer: + # name: Sign Installers + # timeout-minutes: 30 + # needs: + # - frontend_bench + # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + # strategy: + # matrix: + # os: + # - Windows + # runs-on: [self-hosted, '${{ matrix.os }}', code-signer] + # steps: + + # - name: Remove previous build. + # shell: bash + # run: | + # rm -r * + + # - uses: actions/download-artifact@v2 + # with: + # name: ${{ matrix.os }}-installer + + # - name: Sign Installer. + # shell: cmd + # run: | + # set /p executable=>$GITHUB_ENV + + # - uses: actions/upload-artifact@v2 + # with: + # name: ${{ runner.os }}-installer-signed + # path: | + # ${{ env.INSTALLER_ARCHIVE }} + # installer-archive.filename release: name: Create Release needs: - - sign_installer + - build if: github.event_name == 'push' && contains(github.ref, 'refs/tags') runs-on: ubuntu-20.04 steps: @@ -529,21 +529,19 @@ jobs: DATE="$(date '+%Y-%m-%d')"; echo "DATE=${DATE}" >> $GITHUB_ENV echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV - - name: Pull Windows Installer - uses: actions/download-artifact@v2 - with: - name: Windows-installer-signed - path: windows + # - name: Pull Windows Installer + # uses: actions/download-artifact@v2 + # with: + # name: Windows-installer-signed + # path: windows - name: Pull Windows fileio uses: actions/download-artifact@v2 with: - name: fileio_windows.exe - path: windows + name: fileio_windows - name: Pull Windows piksi-settings uses: actions/download-artifact@v2 with: - name: piksi-settings_windows.exe - path: windows + name: piksi-settings_windows - name: Pull Linux Artifacts uses: actions/download-artifact@v2 with: @@ -553,34 +551,36 @@ jobs: 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 Artifacts - uses: actions/download-artifact@v2 - with: - name: macOS-installer - path: | - macos + # - name: Pull macOS Artifacts + # uses: actions/download-artifact@v2 + # with: + # name: macOS-installer + # path: | + # macos + - name: Display structure of downloaded files + run: ls -R - name: Prepare Release shell: bash run: | - mv linux/fileio_linux linux/fileio_${{ env.VERSION }}_linux - mv linux/piksi-settings_linux linux/piksi-settings_${{ env.VERSION }}_linux - mv windows/fileio_windows.exe windows/fileio_${{ env.VERSION }}_windows.exe - mv windows/piksi-settings_windows.exe windows/piksi-settings_${{ env.VERSION }}_windows.exe - echo "WINDOWS_ARCHIVE=$(cat windows/installer-archive.filename)" >>$GITHUB_ENV + mv fileio_linux linux/fileio_${{ env.VERSION }}_linux + mv piksi-settings_linux linux/piksi-settings_${{ env.VERSION }}_linux + mv fileio_windows windows/fileio_${{ env.VERSION }}_windows.exe + mv piksi-settings_windows 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 + - name: Display structure of downloaded files + run: ls -R - name: Release uses: softprops/action-gh-release@v1 with: name: "${{ env.VERSION }}-${{ env.DATE }}" files: | - windows/${{ env.WINDOWS_ARCHIVE }} + # windows/${{ env.WINDOWS_ARCHIVE }} windows/fileio_${{ env.VERSION }}_windows.exe windows/piksi-settings_${{ env.VERSION }}_windows.exe linux/${{ env.LINUX_ARCHIVE }} From b80da32e5c4874792790104f0acaa1d225e66bca Mon Sep 17 00:00:00 2001 From: notoriaga Date: Tue, 8 Feb 2022 09:54:16 -0800 Subject: [PATCH 13/15] fix --- .github/workflows/main.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 245e93707..63819ff9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -538,10 +538,12 @@ jobs: 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 Artifacts uses: actions/download-artifact@v2 with: @@ -551,10 +553,12 @@ jobs: 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 Artifacts # uses: actions/download-artifact@v2 # with: @@ -566,10 +570,10 @@ jobs: - name: Prepare Release shell: bash run: | - mv fileio_linux linux/fileio_${{ env.VERSION }}_linux - mv piksi-settings_linux linux/piksi-settings_${{ env.VERSION }}_linux - mv fileio_windows windows/fileio_${{ env.VERSION }}_windows.exe - mv piksi-settings_windows windows/piksi-settings_${{ env.VERSION }}_windows.exe + mv linux/fileio linux/fileio_${{ env.VERSION }}_linux + mv linux/piksi-settings linux/piksi-settings_${{ env.VERSION }}_linux + mv windows/fileio windows/fileio_${{ env.VERSION }}_windows.exe + mv windows/piksi-settings 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 From 45e92c34191cadbc0943ef36f5218831243aaed1 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Tue, 8 Feb 2022 10:32:29 -0800 Subject: [PATCH 14/15] fix --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63819ff9b..dc99784b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -572,8 +572,8 @@ jobs: run: | mv linux/fileio linux/fileio_${{ env.VERSION }}_linux mv linux/piksi-settings linux/piksi-settings_${{ env.VERSION }}_linux - mv windows/fileio windows/fileio_${{ env.VERSION }}_windows.exe - mv windows/piksi-settings windows/piksi-settings_${{ env.VERSION }}_windows.exe + 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 From 67e833ac86553ac9a3523e94e5d3962fe2070f74 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Tue, 8 Feb 2022 10:36:27 -0800 Subject: [PATCH 15/15] add back in full workflow --- .github/workflows/main.yml | 591 ++++++++++++++++++------------------- 1 file changed, 293 insertions(+), 298 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dc99784b5..c13cd915e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,170 +20,170 @@ env: jobs: - # backend_bench: - - # name: Backend Benchmarks - - # strategy: - # matrix: - # os: - # - ubuntu-18.04 - # - macos-10.15 - # - windows-2019 - - # runs-on: ${{ matrix.os }} - - # steps: - - # - name: Checkout source - # uses: actions/checkout@v2 - # with: - # submodules: recursive - # ssh-key: ${{ secrets.SSH_KEY }} - # ssh-strict: false - - # - uses: webfactory/ssh-agent@v0.5.0 - # with: - # ssh-private-key: ${{ secrets.SSH_KEY }} - - # - name: Run ssh-keyscan - # run: ssh-keyscan github.com >> ~/.ssh/known_hosts - - # - name: Setup SSH for Windows Git LFS - # run: | - # & "C:\\Program Files\\Git\\bin\\sh.exe" -c "ssh-keyscan github.com >> ~/.ssh/known_hosts" - # & "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa" - # if: matrix.os == 'windows-2019' - - # - name: Install ${{ runner.os }} Dependencies. - # shell: bash - # run: | - # if [ "$RUNNER_OS" == "Linux" ]; then - # sudo apt-get update && sudo apt-get install -y capnproto libudev-dev - # elif [ "$RUNNER_OS" == "macOS" ]; then - # brew install capnp llvm - # elif [ "$RUNNER_OS" == "Windows" ]; then - # choco install -y capnproto - # fi - - # - name: Pull Git LFS objects - # run: git lfs pull - # env: - # GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no - - # - uses: actions-rs/toolchain@v1 - # with: - # profile: minimal - # toolchain: stable - - # - uses: Swatinem/rust-cache@v1 - # with: - # key: ${{ secrets.CACHE_VERSION }} - - # - uses: davidB/rust-cargo-make@v1 - # with: - # version: ${{ env.CARGO_MAKE_VERSION }} - - # - name: Cache pip - # uses: actions/cache@v2 - # with: - # path: ${{ env.PIP_CACHE_DIR }} - # key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} - - # - name: Set up python builder - # shell: bash - # run: | - # cargo make setup-builder - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Run Backend Benchmarks (Windows) - # env: - # LIBCLANG_PATH: ${{ env.LIBCLANG_PATH_WIN }} - # run: | - # cargo make backend-benches - # if: matrix.os == 'windows-2019' - - # - name: Run Backend Benchmarks - # run: | - # cargo make backend-benches - # if: matrix.os != 'windows-2019' - - # checks: - - # name: Code Quality Checks - - # runs-on: ubuntu-18.04 - - # steps: - - # - name: Checkout source - # uses: actions/checkout@v2 - # with: - # submodules: recursive - # ssh-key: ${{ secrets.SSH_KEY }} - # ssh-strict: false - - # - uses: webfactory/ssh-agent@v0.5.0 - # with: - # ssh-private-key: ${{ secrets.SSH_KEY }} - - # - name: Pull Git LFS objects - # run: git lfs pull - # env: - # GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no - - # - name: Install stable Rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # override: true - # components: rustfmt, clippy - - # - uses: Swatinem/rust-cache@v1 - # with: - # key: ${{ secrets.CACHE_VERSION }} - - # - uses: davidB/rust-cargo-make@v1 - # with: - # version: ${{ env.CARGO_MAKE_VERSION }} - - # - name: Install Dependencies. - # run: | - # sudo apt-get update && sudo apt-get install -y capnproto libudev-dev - - # - name: Cache pip - # uses: actions/cache@v2 - # with: - # path: ${{ env.PIP_CACHE_DIR }} - # key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} - - # - name: Set up python builder - # shell: bash - # run: | - # cargo make setup-builder - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Run Checks - # run: | - # cargo make check-all - - # - name: Run Tests - # uses: nick-invision/retry@v2 - # with: - # timeout_minutes: 5 - # max_attempts: 3 - # retry_on: error - # command: cargo make tests + backend_bench: + + name: Backend Benchmarks + + strategy: + matrix: + os: + - ubuntu-18.04 + - macos-10.15 + - windows-2019 + + runs-on: ${{ matrix.os }} + + steps: + + - name: Checkout source + uses: actions/checkout@v2 + with: + submodules: recursive + ssh-key: ${{ secrets.SSH_KEY }} + ssh-strict: false + + - uses: webfactory/ssh-agent@v0.5.0 + with: + ssh-private-key: ${{ secrets.SSH_KEY }} + + - name: Run ssh-keyscan + run: ssh-keyscan github.com >> ~/.ssh/known_hosts + + - name: Setup SSH for Windows Git LFS + run: | + & "C:\\Program Files\\Git\\bin\\sh.exe" -c "ssh-keyscan github.com >> ~/.ssh/known_hosts" + & "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa" + if: matrix.os == 'windows-2019' + + - name: Install ${{ runner.os }} Dependencies. + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get update && sudo apt-get install -y capnproto libudev-dev + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install capnp llvm + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install -y capnproto + fi + + - name: Pull Git LFS objects + run: git lfs pull + env: + GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - uses: Swatinem/rust-cache@v1 + with: + key: ${{ secrets.CACHE_VERSION }} + + - uses: davidB/rust-cargo-make@v1 + with: + version: ${{ env.CARGO_MAKE_VERSION }} + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ${{ env.PIP_CACHE_DIR }} + key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} + + - name: Set up python builder + shell: bash + run: | + cargo make setup-builder + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run Backend Benchmarks (Windows) + env: + LIBCLANG_PATH: ${{ env.LIBCLANG_PATH_WIN }} + run: | + cargo make backend-benches + if: matrix.os == 'windows-2019' + + - name: Run Backend Benchmarks + run: | + cargo make backend-benches + if: matrix.os != 'windows-2019' + + checks: + + name: Code Quality Checks + + runs-on: ubuntu-18.04 + + steps: + + - name: Checkout source + uses: actions/checkout@v2 + with: + submodules: recursive + ssh-key: ${{ secrets.SSH_KEY }} + ssh-strict: false + + - uses: webfactory/ssh-agent@v0.5.0 + with: + ssh-private-key: ${{ secrets.SSH_KEY }} + + - name: Pull Git LFS objects + run: git lfs pull + env: + GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no + + - name: Install stable Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt, clippy + + - uses: Swatinem/rust-cache@v1 + with: + key: ${{ secrets.CACHE_VERSION }} + + - uses: davidB/rust-cargo-make@v1 + with: + version: ${{ env.CARGO_MAKE_VERSION }} + + - name: Install Dependencies. + run: | + sudo apt-get update && sudo apt-get install -y capnproto libudev-dev + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ${{ env.PIP_CACHE_DIR }} + key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }} + + - name: Set up python builder + shell: bash + run: | + cargo make setup-builder + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run Checks + run: | + cargo make check-all + + - name: Run Tests + uses: nick-invision/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 3 + retry_on: error + command: cargo make tests build: name: Build Binaries - # needs: - # - checks - # - backend_bench + needs: + - checks + - backend_bench strategy: matrix: @@ -395,132 +395,131 @@ jobs: installer-archive.filename if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - # frontend_bench: - # name: Run Frontend Benchmarks - # timeout-minutes: 30 - # needs: - # - build - # strategy: - # matrix: - # os: - # - macOS - # - Windows - # - Linux - # runs-on: [self-hosted, '${{ matrix.os }}', bench] - # steps: - # - name: Remove previous build. - # shell: bash - # run: | - # rm -rf ${{ env.APP_NAME }} - # rm -rf bench - - # - uses: actions/download-artifact@v2 - # with: - # name: ${{ matrix.os }}-artifacts - # path: | - # ${{ env.APP_NAME }} - - # - uses: actions/download-artifact@v2 - # with: - # name: ${{ matrix.os }}-artifacts-bench - # path: | - # bench - - # - name: Extract binary and data. - # shell: bash - # run: | - # cd ${{ env.APP_NAME }} - # archive=$(cat release-archive.filename) - # 7z x $archive -aoa - # 7z x ${archive%.xz} -aoa - # echo "extracted release-archive" - # mv ../bench/${{ matrix.os }}.zip . - # 7z x ${{ matrix.os }}.zip -aoa - # echo "extracted bench data" - - # - name: Run CPU Frontend Benchmark. - # uses: nick-invision/retry@v2 - # with: - # shell: bash - # timeout_minutes: 3 - # max_attempts: 3 - # retry_on: error - # command: | - # cd ${{ env.APP_NAME }} - # if [ "$RUNNER_OS" == "Windows" ]; then - # python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" - # elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then - # chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - # python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - # else - # echo "Invalid platform" - # exit 1 - # fi - - # - name: Run MEM Frontend Benchmark. - # uses: nick-invision/retry@v2 - # with: - # shell: bash - # timeout_minutes: 3 - # max_attempts: 3 - # retry_on: error - # command: | - # cd ${{ env.APP_NAME }} - # if [ "$RUNNER_OS" == "Windows" ]; then - # python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" - # elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then - # chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - # python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" - # else - # echo "Invalid platform" - # exit 1 - # fi - - # sign_installer: - # name: Sign Installers - # timeout-minutes: 30 - # needs: - # - frontend_bench - # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - # strategy: - # matrix: - # os: - # - Windows - # runs-on: [self-hosted, '${{ matrix.os }}', code-signer] - # steps: - - # - name: Remove previous build. - # shell: bash - # run: | - # rm -r * - - # - uses: actions/download-artifact@v2 - # with: - # name: ${{ matrix.os }}-installer - - # - name: Sign Installer. - # shell: cmd - # run: | - # set /p executable=>$GITHUB_ENV - - # - uses: actions/upload-artifact@v2 - # with: - # name: ${{ runner.os }}-installer-signed - # path: | - # ${{ env.INSTALLER_ARCHIVE }} - # installer-archive.filename + frontend_bench: + name: Run Frontend Benchmarks + timeout-minutes: 30 + needs: + - build + strategy: + matrix: + os: + - macOS + - Windows + - Linux + runs-on: [self-hosted, '${{ matrix.os }}', bench] + steps: + - name: Remove previous build. + shell: bash + run: | + rm -rf ${{ env.APP_NAME }} + rm -rf bench + + - uses: actions/download-artifact@v2 + with: + name: ${{ matrix.os }}-artifacts + path: | + ${{ env.APP_NAME }} + + - uses: actions/download-artifact@v2 + with: + name: ${{ matrix.os }}-artifacts-bench + path: | + bench + + - name: Extract binary and data. + shell: bash + run: | + cd ${{ env.APP_NAME }} + archive=$(cat release-archive.filename) + 7z x $archive -aoa + 7z x ${archive%.xz} -aoa + echo "extracted release-archive" + mv ../bench/${{ matrix.os }}.zip . + 7z x ${{ matrix.os }}.zip -aoa + echo "extracted bench data" + + - name: Run CPU Frontend Benchmark. + uses: nick-invision/retry@v2 + with: + shell: bash + timeout_minutes: 3 + max_attempts: 3 + retry_on: error + command: | + cd ${{ env.APP_NAME }} + if [ "$RUNNER_OS" == "Windows" ]; then + python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" + elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then + chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + python ./bench_runner.py --frontend_cpu --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + else + echo "Invalid platform" + exit 1 + fi + + - name: Run MEM Frontend Benchmark. + uses: nick-invision/retry@v2 + with: + shell: bash + timeout_minutes: 3 + max_attempts: 3 + retry_on: error + command: | + cd ${{ env.APP_NAME }} + if [ "$RUNNER_OS" == "Windows" ]; then + python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}.exe" + elif [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then + chmod +x "${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + python ./bench_runner.py --frontend_mem --executable="${GITHUB_WORKSPACE}/${{ env.APP_NAME }}/${{ env.APP_NAME }}" + else + echo "Invalid platform" + exit 1 + fi + + sign_installer: + name: Sign Installers + timeout-minutes: 30 + needs: + - frontend_bench + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + strategy: + matrix: + os: + - Windows + runs-on: [self-hosted, '${{ matrix.os }}', code-signer] + steps: + - name: Remove previous build. + shell: bash + run: | + rm -r * + + - uses: actions/download-artifact@v2 + with: + name: ${{ matrix.os }}-installer + + - name: Sign Installer. + shell: cmd + run: | + set /p executable=>$GITHUB_ENV + + - uses: actions/upload-artifact@v2 + with: + name: ${{ runner.os }}-installer-signed + path: | + ${{ env.INSTALLER_ARCHIVE }} + installer-archive.filename release: name: Create Release needs: - - build + - sign_installer if: github.event_name == 'push' && contains(github.ref, 'refs/tags') runs-on: ubuntu-20.04 steps: @@ -529,11 +528,11 @@ jobs: DATE="$(date '+%Y-%m-%d')"; echo "DATE=${DATE}" >> $GITHUB_ENV echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV - # - name: Pull Windows Installer - # uses: actions/download-artifact@v2 - # with: - # name: Windows-installer-signed - # path: windows + - name: Pull Windows Installer + uses: actions/download-artifact@v2 + with: + name: Windows-installer-signed + path: windows - name: Pull Windows fileio uses: actions/download-artifact@v2 with: @@ -544,7 +543,7 @@ jobs: with: name: piksi-settings_windows path: windows - - name: Pull Linux Artifacts + - name: Pull Linux Installer uses: actions/download-artifact@v2 with: name: Linux-installer @@ -559,14 +558,12 @@ jobs: with: name: piksi-settings_linux path: linux - # - name: Pull macOS Artifacts - # uses: actions/download-artifact@v2 - # with: - # name: macOS-installer - # path: | - # macos - - name: Display structure of downloaded files - run: ls -R + - name: Pull macOS Installer + uses: actions/download-artifact@v2 + with: + name: macOS-installer + path: | + macos - name: Prepare Release shell: bash run: | @@ -574,17 +571,15 @@ jobs: 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 "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 - - name: Display structure of downloaded files - run: ls -R - name: Release uses: softprops/action-gh-release@v1 with: name: "${{ env.VERSION }}-${{ env.DATE }}" files: | - # windows/${{ env.WINDOWS_ARCHIVE }} + windows/${{ env.WINDOWS_ARCHIVE }} windows/fileio_${{ env.VERSION }}_windows.exe windows/piksi-settings_${{ env.VERSION }}_windows.exe linux/${{ env.LINUX_ARCHIVE }}