Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
release:
types: [published]

env:
CARGO_TERM_COLOR: always

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
Comment thread
greptile-apps[bot] marked this conversation as resolved.
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Extract version from tag
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error::Tag must be in vX.Y.Z format, got: $GITHUB_REF_NAME"
exit 1
fi
echo "value=$VERSION" >> "$GITHUB_OUTPUT"

- name: Patch Cargo.toml version
run: sed -i "0,/^version = /{s/^version = .*/version = \"${{ steps.version.outputs.value }}\"/}" Cargo.toml

- name: Run tests
run: cargo test

- name: Publish to crates.io
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "looper"
version = "0.1.0"
name = "looper-cli"
version = "0.0.1"
edition = "2021"
description = "Static analysis tool that discovers implicit shadow dependencies in JavaScript/TypeScript codebases"
license = "MIT"
Expand All @@ -10,6 +10,10 @@ homepage = "https://github.com/Danite/looper"
readme = "README.md"
keywords = ["static-analysis", "shadow-dependencies", "javascript", "typescript", "devops"]
categories = ["command-line-utilities", "development-tools"]
exclude = [".beads/", ".cursor/", ".github/", "sandbox/", "working/"]

[lib]
name = "looper"

[[bin]]
name = "looper"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ looper v0.1.0 — scanned 142 files in 48ms
## Install

```bash
cargo install looper
cargo install looper-cli
```

## What It Finds
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install looper
- run: cargo install looper-cli
- run: looper check
- run: looper drift --fail-on-missing
```
Expand Down
4 changes: 2 additions & 2 deletions tests/json_output_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn json_output_is_valid() {
let parsed: serde_json::Value = serde_json::from_str(&json_str).unwrap();

assert_eq!(parsed["schema_version"], "1");
assert_eq!(parsed["tool_version"], "0.1.0");
assert_eq!(parsed["tool_version"], env!("CARGO_PKG_VERSION"));
assert_eq!(parsed["root"], ".");
assert_eq!(parsed["files_scanned"], 142);
assert_eq!(parsed["scan_duration_ms"], 48);
Expand Down Expand Up @@ -87,8 +87,8 @@ fn json_output_snapshot() {
let json_str = format_json(&manifest).unwrap();
let mut parsed: serde_json::Value = serde_json::from_str(&json_str).unwrap();

// Redact dynamic field for stable snapshots
parsed["scanned_at"] = serde_json::Value::String("[timestamp]".into());
parsed["tool_version"] = serde_json::Value::String("[version]".into());

insta::assert_json_snapshot!("json_manifest", parsed);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/sarif_output_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn sarif_has_tool_info() {

let driver = &parsed["runs"][0]["tool"]["driver"];
assert_eq!(driver["name"], "looper");
assert_eq!(driver["version"], "0.1.0");
assert_eq!(driver["version"], env!("CARGO_PKG_VERSION"));
}

#[test]
Expand Down Expand Up @@ -135,8 +135,9 @@ fn sarif_properties_include_metadata() {
fn sarif_snapshot() {
let manifest = build_manifest(".", 10, 5, sample_deps());
let sarif_str = format_sarif(&manifest).unwrap();
let parsed: serde_json::Value = serde_json::from_str(&sarif_str).unwrap();
let mut parsed: serde_json::Value = serde_json::from_str(&sarif_str).unwrap();

parsed["runs"][0]["tool"]["driver"]["version"] = serde_json::Value::String("[version]".into());
insta::assert_json_snapshot!("sarif_output", parsed);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/json_output_test__json_manifest.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ expression: parsed
"scan_duration_ms": 48,
"scanned_at": "[timestamp]",
"schema_version": "1",
"tool_version": "0.1.0"
"tool_version": "[version]"
}
2 changes: 1 addition & 1 deletion tests/snapshots/sarif_output_test__sarif_output.snap
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ expression: parsed
}
}
],
"version": "0.1.0"
"version": "[version]"
}
}
}
Expand Down
Loading