diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b07a4b1..71c5186 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,27 +12,21 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Cache cargo registry + - name: Cache cargo uses: actions/cache@v3 with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache cargo index - uses: actions/cache@v3 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- + ${{ runner.os }}-cargo- - name: Install Rust toolchain and components - run: | - rustup update --no-self-update stable - rustup component add --toolchain stable rustfmt clippy - rustup default stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt, clippy - name: Create .env file run: | @@ -40,9 +34,20 @@ jobs: echo "SERVER_SSL_CERT=${{ secrets.SERVER_SSL_CERT }}" >> .env echo "SERVER_SSL_KEY=${{ secrets.SERVER_SSL_KEY }}" >> .env - - name: Build and Test - run: | - cargo build --verbose - cargo test --verbose - cargo clippy -- -D warnings - cargo fmt -- --check + - name: Build + run: cargo build --verbose + + - name: Test + run: cargo test --verbose + + - name: Lint + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + + - name: Format Check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check diff --git a/src/schema/mod.rs b/src/schema/mod.rs index 38ad2d3..54f61fe 100644 --- a/src/schema/mod.rs +++ b/src/schema/mod.rs @@ -5,7 +5,6 @@ pub struct RelayConfig { pub id: String, pub config: ConfigFile, pub profile_id: Option, - pub state: Option, } #[derive(serde::Serialize, serde::Deserialize, Default, Debug, Clone)] @@ -35,13 +34,11 @@ impl RelayConfig { // Ensure that profile_id and state are not None let id = "self-hosted".to_string(); let profile_id = Some(profile_id.unwrap_or_else(|| "self-hosted".to_string())); - let state: Option = Some(InitiatedState::Stopped); Ok(RelayConfig { id, config: config.with_defaults()?, profile_id, - state, }) } @@ -83,12 +80,6 @@ impl Mqtt { } } -#[derive(Debug, Clone, serde::Deserialize)] -pub enum InitiatedState { - Stopped, - Running, -} - #[derive(serde::Deserialize)] pub struct PublishRequest { pub topic: String, diff --git a/src/services/tagoio.rs b/src/services/tagoio.rs index e5bb775..364aa98 100644 --- a/src/services/tagoio.rs +++ b/src/services/tagoio.rs @@ -198,7 +198,6 @@ mod tests { }, }, profile_id: None, - state: None, } }