Skip to content
Merged
203 changes: 203 additions & 0 deletions .github/workflows/release-lsp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: Release LSP

on:
push:
tags:
- '*'

jobs:
release:
name: Release LSP - ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- os: linux
arch: x64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: ci
asset_name: ci-lsp-linux-x64
- os: linux
arch: arm64
runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary_name: ci
asset_name: ci-lsp-linux-arm64
- os: windows
arch: x64
runner: windows-latest
target: x86_64-pc-windows-msvc
binary_name: ci.exe
asset_name: ci-lsp-windows-x64.exe
- os: windows
arch: arm64
runner: windows-latest
target: aarch64-pc-windows-msvc
binary_name: ci.exe
asset_name: ci-lsp-windows-arm64.exe
- os: darwin
arch: x64
runner: macos-latest
target: x86_64-apple-darwin
binary_name: ci
asset_name: ci-lsp-darwin-x64
- os: darwin
arch: arm64
runner: macos-latest
target: aarch64-apple-darwin
binary_name: ci
asset_name: ci-lsp-darwin-arm64

steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Set variables
id: vars
shell: bash
run: |
echo "package_name=$(sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)" >> $GITHUB_OUTPUT
echo "package_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Configure cross-compilation (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config.toml
echo "linker = \"aarch64-linux-gnu-gcc\"" >> ~/.cargo/config.toml

- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-lsp-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-lsp-

- name: Build release binary with LSP feature
run: cargo build --release --features lsp --target ${{ matrix.target }}

- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: target/${{ matrix.target }}/release/${{ matrix.binary_name }}

create-release:
name: Create LSP Release
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Set variables
id: vars
run: |
echo "package_name=$(sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)" >> $GITHUB_OUTPUT
echo "package_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Remove Same Release
uses: omarabid-forks/action-rollback@stable
continue-on-error: true
with:
tag: ${{ steps.vars.outputs.package_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
id: create-release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.package_version }}
release_name: LSP Server ${{ steps.vars.outputs.package_version }}
body: ${{ steps.vars.outputs.package_name }} LSP Server - ${{ steps.vars.outputs.package_version }}
draft: false
prerelease: false

- name: Upload Linux x64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/ci-lsp-linux-x64/ci
asset_name: ci-lsp-linux-x64
asset_content_type: application/octet-stream

- name: Upload Linux arm64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/ci-lsp-linux-arm64/ci
asset_name: ci-lsp-linux-arm64
asset_content_type: application/octet-stream

- name: Upload Windows x64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/ci-lsp-windows-x64.exe/ci.exe
asset_name: ci-lsp-windows-x64.exe
asset_content_type: application/octet-stream

- name: Upload Windows arm64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/ci-lsp-windows-arm64.exe/ci.exe
asset_name: ci-lsp-windows-arm64.exe
asset_content_type: application/octet-stream

- name: Upload macOS x64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/ci-lsp-darwin-x64/ci
asset_name: ci-lsp-darwin-x64
asset_content_type: application/octet-stream

- name: Upload macOS arm64 binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/ci-lsp-darwin-arm64/ci
asset_name: ci-lsp-darwin-arm64
asset_content_type: application/octet-stream

- name: Purge artifacts
uses: omarabid-forks/purge-artifacts@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0
49 changes: 26 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,42 @@ resolver = "2"

[workspace.dependencies]
# Shared dependencies
rand = { version = "0.9.1", default-features = false }
rayon = "1.10.0"
human-panic = "2.0.2"
rand = { version = "0.10.0", default-features = false }
rayon = "1.11.0"
human-panic = "2.0.6"
better-panic = "0.3.0"
log = "0.4.27"
clap_complete = "4.5.54"
ignore = "0.4.23"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
log = "0.4.29"
clap_complete = "4.5.66"
ignore = "0.4.25"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
bincode = { version = "2.0.1", features = ["serde"] }
git2 = { version = "0.20.2", default-features = false }
git2 = { version = "0.20.4", default-features = false }
sha2 = { version = "0.10.9" }
thiserror = "2.0.12"
backtrace = "0.3.75"
color-backtrace = "0.7.0"
config = "0.15.11"
thiserror = "2.0.18"
backtrace = "0.3.76"
color-backtrace = "0.7.2"
config = "0.15.19"
lazy_static = "1.5.0"
slog = "2.7.0"
slog = "2.8.2"
slog-syslog = "0.13.0"
slog-term = "2.9.1"
slog-scope = "4.4.0"
slog-term = "2.9.2"
slog-scope = "4.4.1"
slog-async = "2.8.0"
slog-stdlog = "4.1.1"
tabled = "0.20.0"
terminal_size = "0.4.2"
clap = { version = "4.5.40", features = ["cargo", "derive"] }
chrono = { version = "0.4.41", features = ["serde"] }
terminal_size = "0.4.3"
clap = { version = "4.5.60", features = ["cargo", "derive"] }
chrono = { version = "0.4.44", features = ["serde"] }
tower-lsp = "0.20"
tokio = { version = "1.49.0", features = ["full"] }
url = "2.5.8"

# Dev dependencies
assert_cmd = "2.0.17"
predicates = "3.1.3"
tempfile = "3.20"
criterion = { version = "0.6.0", features = ["html_reports"] }
assert_cmd = "2.1.2"
predicates = "3.1.4"
tempfile = "3.26.0"
criterion = { version = "0.8.2", features = ["html_reports"] }

[profile.dev]
opt-level = 0
Expand Down
2 changes: 2 additions & 0 deletions ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ default = ["termlog"]
termlog = ["codeinput/termlog"]
journald = ["codeinput/journald"]
syslog = ["codeinput/syslog"]
lsp = ["codeinput/tower-lsp", "codeinput/tokio", "tokio"]

[dependencies]
codeinput = { version = "0.0.4", path = "../codeinput" }
Expand All @@ -34,6 +35,7 @@ thiserror = { workspace = true }
tabled = { workspace = true }
terminal_size = { workspace = true }
clap = { workspace = true }
tokio = { workspace = true, optional = true }

[dev-dependencies]
assert_cmd = { workspace = true }
Expand Down
22 changes: 22 additions & 0 deletions ci/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use codeinput::utils::app_config::AppConfig;
use codeinput::utils::error::Result;
use codeinput::utils::types::LogLevel;


#[derive(Parser, Debug)]
#[command(
name = "codeinput",
Expand Down Expand Up @@ -45,6 +46,10 @@ pub struct Cli {
)]
pub log_level: Option<LogLevel>,

/// Suppress progress output
#[arg(short, long)]
pub quiet: bool,

/// Subcommands
#[clap(subcommand)]
command: Commands,
Expand Down Expand Up @@ -76,6 +81,21 @@ enum Commands {
long_about = None,
)]
Config,
#[cfg(feature = "lsp")]
#[clap(
name = "lsp",
about = "Start LSP server for IDE integration",
long_about = "Starts a Language Server Protocol (LSP) server that provides CODEOWNERS information to supported editors"
)]
Lsp {
/// Use stdio for communication (default, flag exists for client compatibility)
#[arg(long, hide = true)]
stdio: bool,

/// Port for TCP communication (if not specified, uses stdio)
#[arg(long, value_name = "PORT")]
port: Option<u16>,
},
}

#[derive(Subcommand, PartialEq, Debug)]
Expand Down Expand Up @@ -279,6 +299,8 @@ pub fn cli_match() -> Result<()> {
}
}
Commands::Config => commands::config::run()?,
#[cfg(feature = "lsp")]
Commands::Lsp { port, .. } => commands::lsp::run(*port)?,
}

Ok(())
Expand Down
10 changes: 7 additions & 3 deletions codeinput/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ full = [
"clap",
"chrono",
"utoipa",
"url",
]
nightly = []
termlog = ["slog-term"]
Expand All @@ -67,7 +68,7 @@ types = []
[dependencies]
# Core dependencies always needed
serde = { workspace = true }
utoipa = { version = "4.2.3", optional = true }
utoipa = { version = "5.4.0", optional = true }

# Full feature dependencies
rayon = { workspace = true, optional = true }
Expand All @@ -85,14 +86,17 @@ config = { workspace = true, optional = true }
lazy_static = { workspace = true, optional = true }
slog = { workspace = true, optional = true }
slog-syslog = { version = "0.13.0", optional = true }
slog-term = { version = "2.9.1", optional = true }
slog-term = { version = "2.9.2", optional = true }
slog-scope = { workspace = true, optional = true }
slog-async = { workspace = true, optional = true }
slog-stdlog = { workspace = true, optional = true }
tabled = { workspace = true, optional = true }
terminal_size = { workspace = true, optional = true }
clap = { workspace = true, optional = true }
chrono = { version = "0.4.41", features = ["serde"], optional = true }
chrono = { version = "0.4.44", features = ["serde"], optional = true }
tower-lsp = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
url = { workspace = true, optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
slog-journald = { version = "2.2.0", optional = true }
Expand Down
Loading