Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
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: "Setup pnpm"
uses: pnpm/action-setup@v4
with:
version: 10.26.2

- 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_linux_x86_64:
name: "Test Linux x86_64"
if: github.repository == 'errmayank/ryuk'
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Install Linux dependencies"
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"
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: "Test 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: "Test 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: "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: "Test 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

- name: "Install Nextest"
uses: taiki-e/install-action@nextest

- name: "Run tests"
run: cargo nextest run --workspace --no-fail-fast
12 changes: 6 additions & 6 deletions crates/editor/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions script/clippy
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 27 additions & 0 deletions script/clippy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$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
}

if (Get-Command typos -ErrorAction Ignore) {
& typos
}
2 changes: 1 addition & 1 deletion script/prettier
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -euo pipefail

Expand Down