Skip to content

Commit a8182ea

Browse files
Merge branch 'main' of github.com:swift-nav/console_pp into john-michaelburke/realtime
2 parents 68e1868 + bfc32e0 commit a8182ea

File tree

6 files changed

+289
-210
lines changed

6 files changed

+289
-210
lines changed

.github/workflows/main.yml

Lines changed: 98 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
name: Backend Benchmarks
1616

1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
os:
2021
- ubuntu-20.04
@@ -45,19 +46,20 @@ jobs:
4546
& "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa"
4647
if: matrix.os == 'windows-2019'
4748

48-
- name: Install LLVM and Clang
49+
- name: Install LLVM and Clang (Windows)
4950
uses: KyleMayes/install-llvm-action@v1
5051
with:
5152
version: "10.0"
5253
directory: ${{ runner.temp }}/llvm
54+
if: matrix.os == 'windows-2019'
5355

5456
- name: Install ${{ runner.os }} Dependencies.
5557
shell: bash
5658
run: |
5759
if [ "$RUNNER_OS" == "Linux" ]; then
5860
sudo apt-get install -y capnproto git-lfs libudev-dev
5961
elif [ "$RUNNER_OS" == "macOS" ]; then
60-
brew install capnp git-lfs
62+
brew install capnp llvm
6163
elif [ "$RUNNER_OS" == "Windows" ]; then
6264
choco install -y capnproto git-lfs
6365
fi
@@ -82,21 +84,57 @@ jobs:
8284
activate-environment: console_pp
8385
environment-file: conda.yml
8486

87+
- name: Cache pip
88+
uses: actions/cache@v2
89+
with:
90+
path: ~/Library/Caches/pip
91+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
92+
restore-keys: |
93+
${{ runner.os }}-pip-
94+
${{ runner.os }}-
95+
if: matrix.os == 'macos-10.15'
96+
97+
- name: Cache pip
98+
uses: actions/cache@v2
99+
with:
100+
path: ~/AppData/Local/pip/Cache
101+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
102+
restore-keys: |
103+
${{ runner.os }}-pip-
104+
${{ runner.os }}-
105+
if: matrix.os == 'windows-2019'
106+
107+
- name: Cache pip
108+
uses: actions/cache@v2
109+
with:
110+
path: ~/.cache/pip
111+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
112+
restore-keys: |
113+
${{ runner.os }}-pip-
114+
${{ runner.os }}-
115+
if: matrix.os == 'ubuntu-20.04'
116+
85117
- name: Run Pip Install
86118
run: |
87119
cargo make pip-install-dev
88-
89-
- name: Run Backend Benchmarks
120+
121+
- name: Run Backend Benchmarks (Windows)
90122
env:
91123
LIBCLANG_PATH: ${{ runner.temp }}/llvm/bin
92124
run: |
93125
cargo make backend-benches
126+
if: matrix.os == 'windows-2019'
127+
128+
- name: Run Backend Benchmarks
129+
run: |
130+
cargo make backend-benches
131+
if: matrix.os != 'windows-2019'
94132

95133
checks:
96134

97135
name: Code Quality Checks
98136

99-
runs-on: ubuntu-latest
137+
runs-on: ubuntu-20.04
100138

101139
steps:
102140

@@ -141,6 +179,16 @@ jobs:
141179
cargo make poetry-export
142180
git diff --exit-code
143181
182+
- name: Cache pip
183+
uses: actions/cache@v2
184+
with:
185+
path: ~/.cache/pip
186+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
187+
restore-keys: |
188+
${{ runner.os }}-pip-
189+
${{ runner.os }}-
190+
if: matrix.os == 'ubuntu-20.04'
191+
144192
- name: Run Pip Install
145193
run: |
146194
cargo make pip-install-dev
@@ -200,25 +248,25 @@ jobs:
200248
& "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa"
201249
if: matrix.os == 'windows-2019'
202250

203-
- name: Install LLVM and Clang for Windows
204-
uses: KyleMayes/install-llvm-action@v1
205-
with:
206-
version: "10.0"
207-
directory: ${{ runner.temp }}/llvm
208-
if: matrix.os == 'windows-2019'
209-
210251
- name: Install ${{ runner.os }} Dependencies.
211252
shell: bash
212253
run: |
213254
if [ "$RUNNER_OS" == "Linux" ]; then
214255
sudo apt-get install -y capnproto libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 ruby ruby-dev rubygems build-essential libudev-dev
215256
sudo gem install --no-document fpm
216257
elif [ "$RUNNER_OS" == "macOS" ]; then
217-
brew install capnp
258+
brew install capnp llvm
218259
elif [ "$RUNNER_OS" == "Windows" ]; then
219260
choco install capnproto nsis
220261
fi
221262
263+
- name: Install LLVM and Clang (Windows)
264+
uses: KyleMayes/install-llvm-action@v1
265+
with:
266+
version: "10.0"
267+
directory: ${{ runner.temp }}/llvm
268+
if: matrix.os == 'windows-2019'
269+
222270
- name: Install stable Rust
223271
uses: actions-rs/toolchain@v1
224272
with:
@@ -235,10 +283,47 @@ jobs:
235283
activate-environment: console_pp
236284
environment-file: conda.yml
237285

286+
- name: Cache pip
287+
uses: actions/cache@v2
288+
with:
289+
path: ~/Library/Caches/pip
290+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
291+
restore-keys: |
292+
${{ runner.os }}-pip-
293+
${{ runner.os }}-
294+
if: matrix.os == 'macos-10.15'
295+
296+
- name: Cache pip
297+
uses: actions/cache@v2
298+
with:
299+
path: ~/AppData/Local/pip/Cache
300+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
301+
restore-keys: |
302+
${{ runner.os }}-pip-
303+
${{ runner.os }}-
304+
if: matrix.os == 'windows-2019'
305+
306+
- name: Cache pip
307+
uses: actions/cache@v2
308+
with:
309+
path: ~/.cache/pip
310+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
311+
restore-keys: |
312+
${{ runner.os }}-pip-
313+
${{ runner.os }}-
314+
if: matrix.os == 'ubuntu-20.04'
315+
238316
- name: Run Pip Install
239317
run: |
240318
cargo make pip-install-dev
241319
320+
- name: Build ${{ runner.os }} Binaries.
321+
env:
322+
LIBCLANG_PATH: ${{ runner.temp }}/llvm/bin
323+
run: |
324+
cargo make prod-installer
325+
if: matrix.os == 'windows-2019'
326+
242327
- name: Build ${{ runner.os }} Binaries.
243328
env:
244329
OS_NAME: ${{ runner.os }}

Makefile.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ init_task = "init"
3030

3131
# Create 'test' alias
3232
[tasks.test]
33-
dependencies = ["tests"]
33+
run_task = "tests"
3434

3535
[tasks.poetry-export-dev]
3636
script_runner = "@shell"
@@ -255,6 +255,7 @@ args = ["clippy", "--all-targets", "--", "--deny", "warnings"]
255255
[tasks.rust-tests]
256256
dependencies = ["copy-capnp"]
257257
command = "cargo"
258+
cwd = "console_backend"
258259
args = ["test", "--features", "tests", "--", "--nocapture"]
259260

260261
[tasks.rust-type-check]

console_backend/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ pub mod observation_tab;
1111
pub mod output;
1212
pub mod piksi_tools_constants;
1313
pub mod process_messages;
14+
#[cfg(not(test))]
15+
#[cfg(all(not(feature = "benches"), not(feature = "tests")))]
1416
pub mod server;
1517
pub mod solution_tab;
1618
pub mod solution_velocity_tab;

console_backend/src/server.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
#![allow(dead_code)]
2-
#![allow(unused_imports)]
3-
#![cfg(not(feature = "benches"))]
4-
#![cfg(not(feature = "tests"))]
5-
use capnp::message::Builder;
61
use capnp::serialize;
72

83
use pyo3::exceptions;
94
use pyo3::prelude::*;
105
use pyo3::types::PyBytes;
116

12-
use async_logger::Writer;
137
use async_logger_log::Logger;
14-
use log::{debug, Record};
158

16-
use std::fs;
179
use std::io::{BufReader, Cursor};
18-
use std::net::TcpStream;
19-
use std::sync::{mpsc, Arc, Mutex};
20-
use std::{thread, time::Duration};
10+
use std::sync::mpsc;
11+
use std::thread;
2112

22-
use crate::common_constants as cc;
2313
use crate::console_backend_capnp as m;
2414
use crate::constants::LOG_WRITER_BUFFER_MESSAGE_COUNT;
2515
use crate::log_panel::{splitable_log_formatter, LogPanelWriter};
26-
use crate::process_messages::process_messages;
27-
use crate::types::{ClientSender, MessageSender, ServerState, SharedState, VelocityUnits};
16+
use crate::types::{ClientSender, ServerState, SharedState};
2817
use crate::utils::refresh_ports;
2918

3019
/// The backend server
@@ -38,7 +27,6 @@ struct ServerEndpoint {
3827
server_send: Option<mpsc::Sender<Vec<u8>>>,
3928
}
4029

41-
#[cfg(not(test))]
4230
#[pymethods]
4331
impl ServerEndpoint {
4432
#[new]
@@ -61,7 +49,6 @@ impl ServerEndpoint {
6149
}
6250
}
6351

64-
#[cfg(not(test))]
6552
#[pymethods]
6653
impl Server {
6754
#[new]

console_backend/tests/log.rs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
#![allow(dead_code)]
2-
#![allow(unused_imports)]
3-
use log::Level;
4-
use logtest::Logger;
1+
#[cfg(feature = "tests")]
2+
mod log_test_impl {
53

6-
use console_backend::utils::compute_doppler;
4+
use log::Level;
5+
use logtest::Logger;
76

8-
#[test]
9-
#[cfg(feature = "tests")]
10-
fn log_test() {
11-
// Start the logger.
7+
use console_backend::utils::compute_doppler;
8+
9+
#[test]
10+
fn log_test() {
11+
// Start the logger.
1212

13-
let mut logger = Logger::start();
13+
let mut logger = Logger::start();
1414

15-
compute_doppler(
16-
123438650.3359375,
17-
123438590.203125,
18-
251746.8,
19-
251746.8,
20-
false,
21-
);
15+
compute_doppler(
16+
123438650.3359375,
17+
123438590.203125,
18+
251746.8,
19+
251746.8,
20+
false,
21+
);
2222

23-
let log_msg = logger.pop().unwrap();
24-
assert_eq!(
25-
log_msg.args(),
26-
"Received two complete observation sets with identical TOW"
27-
);
28-
assert_eq!(log_msg.level(), Level::Warn);
23+
let log_msg = logger.pop().unwrap();
24+
assert_eq!(
25+
log_msg.args(),
26+
"Received two complete observation sets with identical TOW"
27+
);
28+
assert_eq!(log_msg.level(), Level::Warn);
29+
}
2930
}

0 commit comments

Comments
 (0)