From ce0676718f24db5f344449bcbc3e836def6c0ef3 Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 19:58:04 +0530 Subject: [PATCH 1/9] Setup CI with clippy and tests for Linux, macOS & Windows --- .github/workflows/run_tests.yml | 75 +++++++++++++++++++++++++++++++++ script/clippy.ps1 | 23 ++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .github/workflows/run_tests.yml create mode 100644 script/clippy.ps1 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 0000000..09a48ce --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -0,0 +1,75 @@ +name: "Run Tests" + +on: + pull_request: + branches: + - "**" + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: "1" + +jobs: + check_style: + name: "Check Style" + if: github.repository == 'errmayank/ryuk' + runs-on: ubuntu-latest + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Check Prettier formatting" + run: ./script/prettier + shell: bash + + - name: "Check Rust formatting" + run: cargo fmt --all -- --check + + - name: "Check for typos" + uses: crate-ci/typos@v1.40.0 + + run_tests: + name: "Run Tests (${{ matrix.name }})" + if: github.repository == 'errmayank/ryuk' + strategy: + fail-fast: false + matrix: + include: + - name: "Linux x86_64" + platform: ubuntu-latest + + - name: "macOS ARM64" + platform: macos-latest + + - name: "macOS Intel" + platform: macos-15-intel + + - name: "Windows x86_64" + platform: windows-latest + runs-on: ${{ matrix.platform }} + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Run Clippy (Unix)" + if: runner.os != 'Windows' + run: ./script/clippy + shell: bash + + - name: "Run Clippy (Windows)" + if: runner.os == 'Windows' + run: ./script/clippy.ps1 + shell: pwsh + + - name: "Install Nextest" + uses: taiki-e/install-action@nextest + + - name: "Run tests" + run: cargo nextest run --workspace --no-fail-fast diff --git a/script/clippy.ps1 b/script/clippy.ps1 new file mode 100644 index 0000000..a102d81 --- /dev/null +++ b/script/clippy.ps1 @@ -0,0 +1,23 @@ +$ErrorActionPreference = 'Stop' + +$Cargo = if ($env:CARGO) { + $env:CARGO +} +elseif ($cmd = Get-Command cargo -ErrorAction Ignore) { + $cmd.Source +} +else { + throw 'Could not find cargo in path.' +} + +$needAddWorkspace = $false +if ($args -notcontains "-p" -and $args -notcontains "--package") { + $needAddWorkspace = $true +} + +if ($needAddWorkspace) { + & $Cargo clippy --workspace --release --all-targets --all-features -- --deny warnings +} +else { + & $Cargo clippy --release --all-targets --all-features -- --deny warnings +} From 1747f754cc41eca43722d5f9f993567822d17bfd Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 19:59:38 +0530 Subject: [PATCH 2/9] Remove unnecessary --- .github/workflows/run_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 09a48ce..493e3f0 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -36,7 +36,7 @@ jobs: uses: crate-ci/typos@v1.40.0 run_tests: - name: "Run Tests (${{ matrix.name }})" + name: "${{ matrix.name }}" if: github.repository == 'errmayank/ryuk' strategy: fail-fast: false From f392e49ef39ef5c2e0a82e30d4278b6e986d0ea7 Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 20:00:49 +0530 Subject: [PATCH 3/9] Add pnpm --- .github/workflows/run_tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 493e3f0..d3e4360 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -25,6 +25,11 @@ jobs: - name: "Checkout repository" uses: actions/checkout@v4 + - name: "Setup pnpm" + uses: pnpm/action-setup@v4 + with: + version: 10.26.2 + - name: "Check Prettier formatting" run: ./script/prettier shell: bash From 73754629cbea2fd6e8d94253f9fd5b05b34e2d87 Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 20:13:54 +0530 Subject: [PATCH 4/9] Add typos check --- script/clippy | 3 +++ script/clippy.ps1 | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/script/clippy b/script/clippy index 28548b7..8d08728 100755 --- a/script/clippy +++ b/script/clippy @@ -9,3 +9,6 @@ fi set -x "${CARGO:-cargo}" clippy "$@" --release --all-targets --all-features -- --deny warnings + +which typos >/dev/null 2>&1 || exit 0 +typos diff --git a/script/clippy.ps1 b/script/clippy.ps1 index a102d81..2bbeb4b 100644 --- a/script/clippy.ps1 +++ b/script/clippy.ps1 @@ -21,3 +21,7 @@ if ($needAddWorkspace) { else { & $Cargo clippy --release --all-targets --all-features -- --deny warnings } + +if (Get-Command typos -ErrorAction Ignore) { + & typos +} From 91541eb6675e178c9c9a52e7b200017d4d74330a Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 20:14:51 +0530 Subject: [PATCH 5/9] Use bash from PATH --- script/prettier | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/prettier b/script/prettier index 28b7375..6665066 100755 --- a/script/prettier +++ b/script/prettier @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail From 59fc91605749d8185c0305ecf6ad72f132266a8e Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 20:15:01 +0530 Subject: [PATCH 6/9] Update to fix typos --- crates/editor/src/tests.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/tests.rs b/crates/editor/src/tests.rs index 5dbc501..4e4d454 100644 --- a/crates/editor/src/tests.rs +++ b/crates/editor/src/tests.rs @@ -239,37 +239,37 @@ fn test_toggle_formatting(cx: &mut TestAppContext) { cx.editor(|editor, _, cx| { let buffer = editor.buffer().read(cx); - // At "qui[c]k" + // At 'c' in "quick" let fmt = formatting_at(buffer, 7); assert_eq!(fmt.bold, Some(true)); assert_eq!(fmt.italic, None); assert_eq!(fmt.underline, None); - // At "bro[w]n" + // At 'w' in "brown" let fmt = formatting_at(buffer, 13); assert_eq!(fmt.bold, Some(true)); assert_eq!(fmt.italic, Some(true)); assert_eq!(fmt.underline, None); - // At "fo[x]" + // At 'x' in "fox" let fmt = formatting_at(buffer, 18); assert_eq!(fmt.bold, Some(true)); assert_eq!(fmt.italic, Some(true)); assert_eq!(fmt.underline, Some(true)); - // At "ju[m]ps" + // At 'm' in "jumps" let fmt = formatting_at(buffer, 22); assert_eq!(fmt.bold, None); assert_eq!(fmt.italic, Some(true)); assert_eq!(fmt.underline, Some(true)); - // At "o[v]er" + // At 'v' in "over" let fmt = formatting_at(buffer, 27); assert_eq!(fmt.bold, None); assert_eq!(fmt.italic, None); assert_eq!(fmt.underline, Some(true)); - // At "over t[h]e lazy" + // At 'h' in "over the lazy" let fmt = formatting_at(buffer, 32); assert_eq!(fmt.bold, None); assert_eq!(fmt.italic, None); From f4534604c8ee9d40fd152582408fef47a999bf35 Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 20:16:49 +0530 Subject: [PATCH 7/9] Install Linux dependencies --- .github/workflows/run_tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index d3e4360..5e26708 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -63,6 +63,18 @@ jobs: - name: "Checkout repository" uses: actions/checkout@v4 + - name: "Install Linux dependencies" + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y \ + libx11-xcb-dev \ + libxkbcommon-x11-dev \ + libwayland-dev \ + libfontconfig-dev \ + libasound2-dev \ + libssl-dev + - name: "Run Clippy (Unix)" if: runner.os != 'Windows' run: ./script/clippy From 679be1d1a914e3e7bd5c9fb35fb115077aaa870a Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 22:01:28 +0530 Subject: [PATCH 8/9] Remove matrix --- .github/workflows/run_tests.yml | 78 +++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 5e26708..dd8e1d4 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -40,31 +40,15 @@ jobs: - name: "Check for typos" uses: crate-ci/typos@v1.40.0 - run_tests: - name: "${{ matrix.name }}" + run_tests_linux_x86_64: + name: "Run tests / Linux x86_64" if: github.repository == 'errmayank/ryuk' - strategy: - fail-fast: false - matrix: - include: - - name: "Linux x86_64" - platform: ubuntu-latest - - - name: "macOS ARM64" - platform: macos-latest - - - name: "macOS Intel" - platform: macos-15-intel - - - name: "Windows x86_64" - platform: windows-latest - runs-on: ${{ matrix.platform }} + runs-on: ubuntu-latest steps: - name: "Checkout repository" uses: actions/checkout@v4 - name: "Install Linux dependencies" - if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y \ @@ -75,13 +59,61 @@ jobs: libasound2-dev \ libssl-dev - - name: "Run Clippy (Unix)" - if: runner.os != 'Windows' + - name: "Run Clippy" + run: ./script/clippy + shell: bash + + - name: "Install Nextest" + uses: taiki-e/install-action@nextest + + - name: "Run tests" + run: cargo nextest run --workspace --no-fail-fast + + run_tests_macos_arm64: + name: "Run tests / macOS ARM64" + if: github.repository == 'errmayank/ryuk' + runs-on: macos-latest + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Run Clippy" + run: ./script/clippy + shell: bash + + - name: "Install Nextest" + uses: taiki-e/install-action@nextest + + - name: "Run tests" + run: cargo nextest run --workspace --no-fail-fast + + run_tests_macos_x86_64: + name: "Run tests / macOS x86_64" + if: github.repository == 'errmayank/ryuk' + runs-on: macos-15-intel + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Run Clippy" run: ./script/clippy shell: bash - - name: "Run Clippy (Windows)" - if: runner.os == 'Windows' + - name: "Install Nextest" + uses: taiki-e/install-action@nextest + + - name: "Run tests" + run: cargo nextest run --workspace --no-fail-fast + + run_tests_windows_x86_64: + name: "Run tests / Windows x86_64" + if: github.repository == 'errmayank/ryuk' + runs-on: windows-latest + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Run Clippy" run: ./script/clippy.ps1 shell: pwsh From f0dab002b96a6e28a879416367d04d8d844959e0 Mon Sep 17 00:00:00 2001 From: Mayank Verma Date: Fri, 26 Dec 2025 22:02:40 +0530 Subject: [PATCH 9/9] Double "Run tests / " --- .github/workflows/run_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index dd8e1d4..9a71208 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -41,7 +41,7 @@ jobs: uses: crate-ci/typos@v1.40.0 run_tests_linux_x86_64: - name: "Run tests / Linux x86_64" + name: "Test Linux x86_64" if: github.repository == 'errmayank/ryuk' runs-on: ubuntu-latest steps: @@ -70,7 +70,7 @@ jobs: run: cargo nextest run --workspace --no-fail-fast run_tests_macos_arm64: - name: "Run tests / macOS ARM64" + name: "Test macOS ARM64" if: github.repository == 'errmayank/ryuk' runs-on: macos-latest steps: @@ -88,7 +88,7 @@ jobs: run: cargo nextest run --workspace --no-fail-fast run_tests_macos_x86_64: - name: "Run tests / macOS x86_64" + name: "Test macOS x86_64" if: github.repository == 'errmayank/ryuk' runs-on: macos-15-intel steps: @@ -106,7 +106,7 @@ jobs: run: cargo nextest run --workspace --no-fail-fast run_tests_windows_x86_64: - name: "Run tests / Windows x86_64" + name: "Test Windows x86_64" if: github.repository == 'errmayank/ryuk' runs-on: windows-latest steps: