chore: Add Windows CI (#789)

This commit is contained in:
Jason Lee 2025-04-14 20:46:32 +08:00 committed by GitHub
parent aa44fd3a43
commit 71b79cf1b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 54 additions and 39 deletions

View file

@ -3,20 +3,32 @@ on:
pull_request:
push:
branches:
- '*'
- "*"
tags:
- '*'
- "*"
jobs:
test:
name: Test
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
run_on: macos-latest
- target: x86_64-linux-gnu
run_on: ubuntu-latest
- target: x86_64-windows-msvc
run_on: windows-latest
runs-on: ${{ matrix.run_on }}
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
if: ${{ matrix.run_on != 'windows-latest' }}
run: script/bootstrap
- name: Machete
if: ${{ matrix.run_on == 'macos-latest' }}
uses: bnjbvr/cargo-machete@main
- name: Setup | Cache Cargo
uses: actions/cache@v4
@ -27,13 +39,16 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Tools
run: cargo install typos-cli || echo "typos-cli already installed"
key: test-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
- name: Typo check
if: ${{ matrix.run_on == 'macos-latest' }}
run: |
cargo install typos-cli || echo "typos-cli already installed"
typos
- name: Lint
if: ${{ matrix.run_on == 'macos-latest' }}
run: |
cargo clippy -- --deny warnings
typos
- name: Build test
run: |
cargo test --all

View file

@ -212,38 +212,7 @@ mod tests {
use super::Kbd;
use gpui::Keystroke;
if cfg!(target_os = "windows") {
assert_eq!(Kbd::format(&Keystroke::parse("a").unwrap()), "A");
assert_eq!(Kbd::format(&Keystroke::parse("ctrl-a").unwrap()), "Ctrl+A");
assert_eq!(
Kbd::format(&Keystroke::parse("shift-space").unwrap()),
"Shift+Space"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-alt-a").unwrap()),
"Ctrl+Alt+A"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-alt-shift-a").unwrap()),
"Ctrl+Alt+Shift+A"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-alt-shift-win-a").unwrap()),
"Ctrl+Alt+Shift+Win+A"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-shift-backspace").unwrap()),
"Ctrl+Shift+Backspace"
);
assert_eq!(
Kbd::format(&Keystroke::parse("alt-delete").unwrap()),
"Alt+Delete"
);
assert_eq!(
Kbd::format(&Keystroke::parse("alt-tab").unwrap()),
"Alt+Tab"
);
} else {
if cfg!(target_os = "macos") {
assert_eq!(Kbd::format(&Keystroke::parse("cmd-a").unwrap()), "⌘A");
assert_eq!(Kbd::format(&Keystroke::parse("cmd-enter").unwrap()), "⌘⏎");
assert_eq!(
@ -279,6 +248,37 @@ mod tests {
Kbd::format(&Keystroke::parse("cmd-ctrl-shift-alt-a").unwrap()),
"⌃⌥⇧⌘A"
);
} else {
assert_eq!(Kbd::format(&Keystroke::parse("a").unwrap()), "A");
assert_eq!(Kbd::format(&Keystroke::parse("ctrl-a").unwrap()), "Ctrl+A");
assert_eq!(
Kbd::format(&Keystroke::parse("shift-space").unwrap()),
"Shift+Space"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-alt-a").unwrap()),
"Ctrl+Alt+A"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-alt-shift-a").unwrap()),
"Ctrl+Alt+Shift+A"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-alt-shift-win-a").unwrap()),
"Ctrl+Alt+Shift+Win+A"
);
assert_eq!(
Kbd::format(&Keystroke::parse("ctrl-shift-backspace").unwrap()),
"Ctrl+Shift+Backspace"
);
assert_eq!(
Kbd::format(&Keystroke::parse("alt-delete").unwrap()),
"Alt+Delete"
);
assert_eq!(
Kbd::format(&Keystroke::parse("alt-tab").unwrap()),
"Alt+Tab"
);
}
}
}