Skip to content

Commit

Permalink
ci: split long running steps into separate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Jul 25, 2023
1 parent 7ce25af commit 5874981
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 15 deletions.
50 changes: 39 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,26 @@ on:
- pyproject.toml

jobs:
install:
type-check:
runs-on: windows-latest

steps:
- name: Install KeyWin
run: pip install git+https://github.com/winstxnhdw/KeyWin
- name: Checkout repository
uses: actions/checkout@v3

- name: Mini smoke test
run: python -c "from keywin import keyboard; keyboard.press(0x5B, 0x44)"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip

test:
- name: Install the development dependencies
run: pip install -r requirements.txt

- name: Run typechecker
run: pyright

lint:
runs-on: windows-latest

steps:
Expand All @@ -36,14 +45,33 @@ jobs:
- name: Install the development dependencies
run: pip install -r requirements.txt

- name: Build the extension
run: python setup.py build_ext --inplace

- name: Run linter
run: pylint $(git ls-files '*.py')

- name: Run typechecker
run: pyright
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Build the extension
run: python setup.py build_ext --inplace

- name: Run tests
run: pytest

install:
runs-on: windows-latest

steps:
- name: Install KeyWin
run: pip install git+https://github.com/winstxnhdw/KeyWin

- name: Mini smoke test
run: python -c "from keywin import keyboard; keyboard.press(0x5B, 0x44)"
8 changes: 4 additions & 4 deletions tests/test_keywin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from keywin import KeyCodes
from keywin.keyboard import convert_to_key_code
from keywin.keyboard.utils import convert_to_key_code


def test_convert_to_key_code():
Expand All @@ -8,9 +8,9 @@ def test_convert_to_key_code():
-------
test the `convert_to_key_code` function
"""
assert list(convert_to_key_code("a")) == [[KeyCodes.VK_A]]
assert list(convert_to_key_code("A")) == [[KeyCodes.VK_SHIFT, KeyCodes.VK_A]]
assert list(convert_to_key_code("Hello!")) == [
assert convert_to_key_code("a") == [[KeyCodes.VK_A]]
assert convert_to_key_code("A") == [[KeyCodes.VK_SHIFT, KeyCodes.VK_A]]
assert convert_to_key_code("Hello!") == [
[KeyCodes.VK_SHIFT, KeyCodes.VK_H],
[KeyCodes.VK_E, KeyCodes.VK_L, KeyCodes.VK_L, KeyCodes.VK_O],
[KeyCodes.VK_SHIFT, KeyCodes.VK_1],
Expand Down

0 comments on commit 5874981

Please sign in to comment.