From 462eb11bb5a47cda9d386531d24e38f5682174dc Mon Sep 17 00:00:00 2001 From: winstxnhdw Date: Tue, 25 Jul 2023 13:12:02 +0800 Subject: [PATCH] ci: split long running steps into separate jobs --- .github/workflows/main.yml | 54 ++++++++++++++++++++++++++++++-------- tests/test_keywin.py | 8 +++--- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfa8225..576d737 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -36,14 +45,37 @@ 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 + cache: pip + + - name: Install the development dependencies + run: pip install -r requirements.txt + + - 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)" diff --git a/tests/test_keywin.py b/tests/test_keywin.py index 421b607..214f91f 100644 --- a/tests/test_keywin.py +++ b/tests/test_keywin.py @@ -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(): @@ -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],