diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..3311990 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,56 @@ +name: tests + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + sudo apt-get update + sudo apt-get install mingw-w64 -y + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: x86_64-pc-windows-gnu + components: rustfmt + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + sudo apt-get update + sudo apt-get install mingw-w64 -y + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: x86_64-pc-windows-gnu + components: clippy + - name: Run clippy + run: cargo clippy --target x86_64-pc-windows-gnu + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + sudo apt-get update + sudo apt-get install mingw-w64 -y + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: x86_64-pc-windows-gnu + - name: Build + run: cargo build --verbose --release --target x86_64-pc-windows-gnu + - name: Create release + uses: softprops/action-gh-release@v2 + if: startsWith(gitea.ref, 'refs/tags/') + with: + files: | + target/x86_64-pc-windows-gnu/release/space.exe diff --git a/build.rs b/build.rs index 6c03d3a..bb01348 100644 --- a/build.rs +++ b/build.rs @@ -2,4 +2,4 @@ extern crate embed_resource; fn main() { embed_resource::compile("tray-example.rc", embed_resource::NONE); -} \ No newline at end of file +} diff --git a/src/main.rs b/src/main.rs index c9fce07..f17a20a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,16 +85,13 @@ fn tray() { .unwrap(); loop { - match rx.recv() { - Ok(TrayMessage::Quit) => { - break; - } - _ => {} + if let Ok(TrayMessage::Quit) = rx.recv() { + break; } } } fn main() { - thread::spawn(|| play_sound_while_holding_space()); + thread::spawn(play_sound_while_holding_space); tray(); }