From f7cbcbddfab7a80b8374b35592a3b929548b9fbc Mon Sep 17 00:00:00 2001 From: techmetx11 Date: Fri, 9 Aug 2024 15:09:05 +0100 Subject: [PATCH] GitHub workflow: Test the player script extractor every 2 hours --- .github/workflows/rust.yml | 7 +++++-- src/main.rs | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 000bb2c..6f422c4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,6 +5,9 @@ on: branches: [ "master" ] pull_request: branches: [ "master" ] + schedule: + # every 2 hours + - cron: "0 */2 * * *" env: CARGO_TERM_COLOR: always @@ -18,5 +21,5 @@ jobs: - uses: actions/checkout@v4 - name: Build run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Test server + run: target/debug/inv_sig_helper_rust --test diff --git a/src/main.rs b/src/main.rs index 8d7d556..8d916f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,6 +65,13 @@ async fn main() { } }; loop_main!(tcp_socket, state); + } else if socket_url == "--test" { + // TODO: test the API aswell, this only tests the player script extractor + println!("Fetching player"); + match fetch_update(state.clone()).await { + Ok(()) => std::process::exit(0), + Err(_x) => std::process::exit(-1), + } } else { let unix_socket = match UnixListener::bind(socket_url) { Ok(x) => x,