Skip to content

Commit

Permalink
chore: Add CI (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko authored May 28, 2024
1 parent ae05b28 commit eb2582b
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 6 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI

on:
pull_request:
push:
branches:
- main
tags:
- "v*.*.*"

jobs:
cli-precheck:
runs-on: ubuntu-latest
env:
WORKING_DIRECTORY: ./subdirectory_path
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
cli/
shared/
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: beta

- uses: Swatinem/rust-cache@v2
with:
workspaces: ./cli -> target
prefix-key: "v0-check-rust"
cache-on-failure: true

- name: Check formatting
working-directory: cli
run: cargo fmt --all -- --check

- name: Clippy
working-directory: cli
run: cargo clippy --all-targets --all-features -- -D warnings

cli-build:
needs: [cli-precheck]
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
rust: [stable, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
cli/
shared/
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}

- uses: Swatinem/rust-cache@v2
with:
workspaces: ./cli -> target
prefix-key: "v0-build-${{ matrix.rust }}-rust"
cache-on-failure: true

- name: Build
working-directory: cli
run: cargo build --verbose

iot-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Build Core Sensor
working-directory: core
run: pio run
2 changes: 2 additions & 0 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ uuid = "1.3.2"
regex = "1.10.4"
btleplug = { package = "btleplug-goose-fixed", version = "0.11.5" }

[target.'cfg(target_os = "linux")'.dependencies]
dbus = { version = "0.9.7", features = ["vendored"] }

[build-dependencies]
cc = "1.0"
bindgen = "0.69.4"
1 change: 0 additions & 1 deletion cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ fn main() {
.write_to_file("src/config/raw_bindings.rs")
.expect("Couldn't write bindings!");
}

3 changes: 1 addition & 2 deletions cli/src/bluetooth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ pub async fn connect_to(
if peripheral
.services()
.iter()
.find(|service| service.uuid == service_uuid)
.is_some()
.any(|service| service.uuid == service_uuid)
{
return Ok(Connection {
peripheral,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/reactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ macro_rules! define_reactions {
};
}

define_reactions!(WindowState);
define_reactions!(WindowState);
1 change: 0 additions & 1 deletion cli/src/tui_app/chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,3 @@ pub fn render_chart<'a, TMeasure: Display>(

frame.render_widget(chart, area);
}

2 changes: 1 addition & 1 deletion cli/src/tui_app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl TerminalUi {
.split(main_layout[0]);

self.render_overview(&latest_climate_data, f, top_layout[1]);
if let Some(advice_layout) = top_layout.get(0) {
if let Some(advice_layout) = top_layout.first() {
render_dumb_advice_block(&latest_climate_data, advice_layout, f)
}

Expand Down

0 comments on commit eb2582b

Please sign in to comment.