Skip to content

Commit

Permalink
init ci
Browse files Browse the repository at this point in the history
  • Loading branch information
myypo committed Jun 19, 2024
1 parent 4e6cd75 commit d4824aa
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 35 deletions.
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Bug Report
description: Open a bug related issue
title: "bug: "
labels: [bug]
body:
- type: markdown
attributes:
value: |
Before reporting an issue, please, make sure to read the [documentation](https://github.com/myypo/compass.nvim) and read through all of the [open and closed issues](https://github.com/myypo/compass.nvim/issues) as well as any existing [discussions](https://github.com/myypo/compass.nvim/discussions)
- type: checkboxes
attributes:
label: Did you check docs and existing issues?
description: Make sure you checked all of the below before submitting an issue
options:
- label: I have read the plugin's documentation
required: true
- label: I have searched through existing issues of the plugin, as well as discussions
required: true
- type: textarea
attributes:
label: Your platform and neovim version
description: The OS where the bug was encountered and the output of `nvim --version`
validations:
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. Please include any related errors you see in Neovim.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1.
2.
3.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Feature Request
description: Suggest a new feature
title: "feature: "
labels: [enhancement]
body:
- type: checkboxes
attributes:
label: Did you check the docs?
options:
- label: I have read all of the plugin's docs
required: true
- type: checkboxes
attributes:
label: Are there no similiar feature requests?
options:
- label: There are no existing requests for this feature
required: true
- type: textarea
validations:
required: true
attributes:
label: Describe the feature and solution you'd like
description: A clear and concise description of what you want to happen.
- type: textarea
validations:
required: false
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run tests

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 10 * * *"

jobs:
test:
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
neovim: [v0.9.5, v0.10.0, nightly]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Install Neovim ${{ matrix.neovim }}
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim }}
- name: Install latest nightly `rustc`
uses: dtolnay/rust-toolchain@nightly
- name: Run unit tests
run: cargo test

clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- run: cargo clippy -- -D warnings

format:
name: format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --check
30 changes: 30 additions & 0 deletions .github/workflows/vimdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Generate vimdoc
on:
push:
branches:
- main
paths:
- README.md

jobs:
docs:
runs-on: ubuntu-latest
permissions:
contents: write
needs: tests
steps:
- uses: actions/checkout@v4
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: compass.nvim
version: "Neovim >= 0.8.0"
demojify: true
treesitter: true
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(build): auto-generate vimdoc"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cargo-features = ["profile-rustflags"]
publish = false

[workspace]
resolver = "2"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Installation
13 changes: 12 additions & 1 deletion compass/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@
name = "compass"
version = "0.1.0"
edition = "2021"
publish = false

[lib]
crate-type = ["cdylib"]

[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[dependencies]
macros = { path = "../macros" }
nvim-oxi = { path = "/home/myypo/code/my/forks/nvim-oxi", features = ["neovim-0-10", "test"] }
Expand Down
11 changes: 2 additions & 9 deletions compass/src/common_types/extmark.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
use std::hash::Hash;

use crate::{
common_types::CursorPosition,
config::get_config,
Result,
};
use crate::{common_types::CursorPosition, config::get_config, Result};

use nvim_oxi::api::{
opts::GetExtmarkByIdOpts,
Buffer,
};
use nvim_oxi::api::{opts::GetExtmarkByIdOpts, Buffer};

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Extmark {
Expand Down
2 changes: 1 addition & 1 deletion compass/src/functions/place/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod opts;
use opts::*;

use crate::{
state::{ChangeTypeRecord, Record, TrackList, SyncTracker, TypeRecord},
state::{ChangeTypeRecord, Record, SyncTracker, TrackList, TypeRecord},
ui::record_mark::RecordMarkTime,
Result,
};
Expand Down
5 changes: 1 addition & 4 deletions compass/src/state/session.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
mod data_session;
pub use data_session::*;

use crate::{
state::Record, state::TrackList,
Result,
};
use crate::{state::Record, state::TrackList, Result};
use std::{
fs::File,
io::{BufReader, BufWriter, Read, Write},
Expand Down
6 changes: 5 additions & 1 deletion compass/src/ui/ensure_buf_loaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use crate::{

use nvim_oxi::api::set_current_buf;

pub fn ensure_buf_loaded(idx: usize, pos_record_list: Option<usize>, record: &Record) -> Result<()> {
pub fn ensure_buf_loaded(
idx: usize,
pos_record_list: Option<usize>,
record: &Record,
) -> Result<()> {
set_current_buf(&record.buf)?;
update_record_mark(
&record.extmark,
Expand Down
15 changes: 8 additions & 7 deletions compass/src/ui/grid.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
use crate::{
common_types::{CursorPosition, Extmark},
config::WindowGridSize,
config::JumpKeymap,
config::WindowGridSize,
state::{ChangeTypeRecord, Record, TypeRecord},
ui::{
record_mark::create_hint_mark,
tab::open_tab,
},
ui::{record_mark::create_hint_mark, tab::open_tab},
InputError, Result,
};

use anyhow::Context;
use nvim_oxi::{
api::{
command, create_augroup, create_autocmd, create_buf, del_augroup_by_id, get_current_win, get_option_value, open_win,
opts::{CreateAugroupOpts, CreateAutocmdOpts, OptionOpts, SetKeymapOpts}, set_current_win, set_option_value,
command, create_augroup, create_autocmd, create_buf, del_augroup_by_id, get_current_win,
get_option_value, open_win,
opts::{CreateAugroupOpts, CreateAutocmdOpts, OptionOpts, SetKeymapOpts},
set_current_win, set_option_value,
types::{Mode, WindowConfig, WindowRelativeTo},
Buffer, Window,
},
Expand Down Expand Up @@ -119,6 +118,8 @@ fn cleanup(
&CreateAugroupOpts::builder().clear(true).build(),
)?;

// TODO: will not close the tab if the hidden window is somehow closed by the user for example with :q
// all what I have tried so far causes nvim instance to freeze
create_autocmd(
["BufLeave"],
&CreateAutocmdOpts::builder()
Expand Down
16 changes: 5 additions & 11 deletions compass/src/ui/record_mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ use crate::{
use std::path::{Component, Path, PathBuf};

use nvim_oxi::api::{
opts::{
SetExtmarkOpts,
SetExtmarkOptsBuilder,
},
types::{ExtmarkHlMode, ExtmarkVirtTextPosition},
Buffer,
};

use super::{
grid::GridLayout,
highlights::RecordHighlightNames,
opts::{SetExtmarkOpts, SetExtmarkOptsBuilder},
types::{ExtmarkHlMode, ExtmarkVirtTextPosition},
Buffer,
};

use super::{grid::GridLayout, highlights::RecordHighlightNames};

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum RecordMarkTime {
Past,
Expand Down

0 comments on commit d4824aa

Please sign in to comment.