Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
👷 Add Continuous Integration Pipeline (#2)
Browse files Browse the repository at this point in the history
* chore(ci): Add dependabot

* chore(ci): Add Continuous Integration Pipeline

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

---------

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
  • Loading branch information
rodneyosodo authored Jul 13, 2024
1 parent 88b934a commit 6508661
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "."
schedule:
interval: "monthly"
day: "monday"
groups:
rs-dependencies:
patterns:
- "*"

- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "monthly"
day: "monday"
groups:
gh-dependency:
patterns:
- "*"
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Continuous Integration

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check Dependencies
run: cargo check --release --all-targets --locked --verbose

- name: Check formatting
run: cargo fmt --all -- --check --verbose

- name: Run linter
run: cargo clippy -- -D warnings

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run tests
run: cargo test --verbose

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: cargo build --release --verbose
13 changes: 8 additions & 5 deletions src/wakatime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ impl WakatimeExtension {
}

zed::set_language_server_installation_status(
&language_server_id,
language_server_id,
&zed_extension_api::LanguageServerInstallationStatus::CheckingForUpdate,
);

let release = zed::latest_github_release(
"mrnossiom/wakatime-lsp",
zed::GithubReleaseOptions {
Expand Down Expand Up @@ -60,12 +60,15 @@ impl WakatimeExtension {
.ok_or_else(|| format!("no asset found matching {:?}", asset_name))?;

let version_dir = format!("wakatime-lsp-{}", release.version);
let asset_name = asset_name.split('.').next().expect("failed to split asset name");
let asset_name = asset_name
.split('.')
.next()
.expect("failed to split asset name");
let binary_path: String = format!("{version_dir}/{asset_name}/wakatime-lsp");

if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
zed::set_language_server_installation_status(
&language_server_id,
language_server_id,
&zed::LanguageServerInstallationStatus::Downloading,
);

Expand All @@ -86,7 +89,7 @@ impl WakatimeExtension {
for entry in entries {
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
if entry.file_name().to_str() != Some(&version_dir) {
fs::remove_dir_all(&entry.path()).ok();
fs::remove_dir_all(entry.path()).ok();
}
}
}
Expand Down

0 comments on commit 6508661

Please sign in to comment.