Skip to content

Commit

Permalink
Cleanup. CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pwalski committed Oct 24, 2023
1 parent 3f05d0e commit 8c321b3
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 18 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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') }}
16 changes: 0 additions & 16 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,3 @@ pub struct RunArgs {
#[arg(long, short)]
pub cache_dir: Option<PathBuf>,
}

#[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));
}
}
2 changes: 0 additions & 2 deletions src/process/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8c321b3

Please sign in to comment.