diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a1d4043 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + branches: [ "main" ] + tags: + - v* + - pre-rel-* + pull_request: + branches: [ "main" ] +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: windows-latest + + steps: + - name: Check lockfile + uses: actions-rs/cargo@v1 + with: + command: tree + args: --locked + + - name: Check formatting + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - uses: actions/checkout@v3 + + - name: Build + run: cargo build --verbose + + - name: Check clippy lints + uses: actions-rs/cargo@v1 + with: + command: Clippy + args: --all-targets --all-features --workspace -- -D warnings + + - name: Run tests + run: cargo test --verbose + + - uses: actions/checkout@v3 + + - name: Build Release + if: startsWith(github.ref, 'refs/tags/') + run: cargo build --release + + - name: Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + files: target/release/*.exe + prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-rel-v') }} diff --git a/src/cli.rs b/src/cli.rs index 35cb55c..a3fc781 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -63,19 +63,3 @@ pub struct RunArgs { #[arg(long, short)] pub cache_dir: Option, } - -#[cfg(test)] -mod test { - use super::*; - use std::path::Path; - - #[test] - fn test_args() { - let cli = Cli::parse_from(["-b", "/tmp/false-runtime", "offer-template"]); - assert_eq!( - cli.binary, - Some(PathBuf::from(Path::new("/tmp/false-runtime"))) - ); - assert!(matches!(cli.command, Command::OfferTemplate)); - } -} diff --git a/src/process/win.rs b/src/process/win.rs index cbb480f..8b229ed 100644 --- a/src/process/win.rs +++ b/src/process/win.rs @@ -7,8 +7,6 @@ use winapi::um::handleapi::INVALID_HANDLE_VALUE; #[cfg(target_os = "windows")] use winapi::um::winnt::HANDLE; -use std::{mem, ptr}; - #[cfg(target_os = "windows")] #[derive(Clone, Debug)] pub struct JobObject {