diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000000..56a1f41c3961 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,44 @@ +name: PR Check + +on: + pull_request: + branches: + - main + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + steps: + # The Windows runners have autocrlf enabled by default. + - name: Disable git autocrlf + run: git config --global core.autocrlf false + if: matrix.os == 'windows-latest' + - name: Checkout + uses: actions/checkout@v4 + # https://github.com/actions/cache/blob/main/examples.md#rust---cargo + # Depends on `Cargo.lock` --> Has to be after checkout. + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rust + run: rustup toolchain install nightly --no-self-update --profile minimal --component rust-src,rustfmt,clippy + - name: Check formatting + run: cargo fmt --all -- --check + - name: Run tests + run: cargo test --all-features --all-targets + - name: Run clippy + run: cargo clippy --all-features --all-targets -- --deny warnings diff --git a/Cargo.toml b/Cargo.toml index cbc43b5eba98..e3349970eca6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ name = "lib" harness = false [features] -debug-layout = [] debug-latency = [] # We use `opt-level = "s"` as it significantly reduces binary size. diff --git a/src/bin/edit/draw_statusbar.rs b/src/bin/edit/draw_statusbar.rs index 0eba7de36245..474d7dd383b0 100644 --- a/src/bin/edit/draw_statusbar.rs +++ b/src/bin/edit/draw_statusbar.rs @@ -155,7 +155,7 @@ pub fn draw_statusbar(ctx: &mut Context, state: &mut State) { ), ); - #[cfg(any(feature = "debug-layout", feature = "debug-latency"))] + #[cfg(feature = "debug-latency")] ctx.label( "stats", &arena_format!(ctx.arena(), "{}/{}", tb.logical_line_count(), tb.visual_line_count(),), diff --git a/src/bin/edit/main.rs b/src/bin/edit/main.rs index e01764330628..0f625b2c6e12 100644 --- a/src/bin/edit/main.rs +++ b/src/bin/edit/main.rs @@ -158,12 +158,6 @@ fn run() -> apperr::Result<()> { draw(&mut ctx, &mut state); - #[cfg(feature = "debug-layout")] - { - drop(ctx); - state.buffer.buffer.copy_from_str(&tui.debug_layout()); - } - #[cfg(feature = "debug-latency")] { passes += 1;