diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6e4956d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI +on: [push, pull_request] + +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - run: cargo clippy -- -D warnings + + rustfmt: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain with rustfmt available + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt + + - run: cargo fmt --check + + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Rust env + uses: "./.github/actions/setup-rust-env" + + - name: Rust test + run: cargo test --workspace diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8463918..4691aa5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,11 +91,16 @@ jobs: shell: bash run: | RELEASE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) - OLD_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' <<< "$(git show HEAD~1:Cargo.toml)") - - echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + latest=$(curl https://api.github.com/repos/ThePrimeagen/htmx-lsp/releases/latest) + # no releases, default to 0.0.0 + if [[ "$latest" == *"Not Found"* ]]; then + OLD_VERSION="0.0.0" + else + OLD_VERSION=$( echo $latest | grep "tag_name" | cut -d'"' -f4 ) + fi + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV echo "$OLD_VERSION -> $RELEASE_VERSION" if [[ "$RELEASE_VERSION" == "$OLD_VERSION" ]]; then diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index c73f7bf..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Test - -on: - push: - branches: ["master"] - pull_request: - -jobs: - test: - name: Test - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup Rust env - uses: "./.github/actions/setup-rust-env" - - - name: Rust test - run: cargo test --workspace diff --git a/lsp/src/htmx/mod.rs b/lsp/src/htmx/mod.rs index 1a745d4..6f0d3b6 100644 --- a/lsp/src/htmx/mod.rs +++ b/lsp/src/htmx/mod.rs @@ -4,6 +4,7 @@ use lsp_types::TextDocumentPositionParams; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, path::PathBuf}; + use crate::tree_sitter::Position; #[derive(Clone, Debug, Serialize, Deserialize)]