Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cibuildwheel configuration for automated wheel building #92

Merged
merged 10 commits into from
Jan 31, 2025
11 changes: 8 additions & 3 deletions .github/workflows/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: 'Prepare environment'
description: 'Prepare environment'

inputs:
python-version:
description: 'Python version to use'
required: true

runs:
using: "composite"
steps:
Expand All @@ -10,9 +15,9 @@ runs:

- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
python-version: ${{ inputs.python-version }}
cache: 'poetry'

- name: Install dependencies
run: poetry install --no-interaction --no-ansi --no-root --sync
- name: Install dependencies and package
run: poetry install --no-interaction --no-ansi
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build Wheels

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp3{10,11,12}-*
CIBW_SKIP: "*-musllinux*"
# Temporarily disable tests during wheel building
# CIBW_TEST_REQUIRES: pytest
# CIBW_TEST_COMMAND: "pip install {wheel} && pytest {project}/tests"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: ./wheelhouse/*.whl
53 changes: 32 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,59 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/actions/prepare

with:
python-version: "3.11"
- name: Check files using the ruff formatter
run: poetry run ruff --fix --unsafe-fixes --preview .
shell: bash

mypy:
name: Static Type Checking
runs-on: [ self-hosted, small ]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/actions/prepare

with:
python-version: "3.11"
- name: Mypy
run: poetry run mypy .
shell: bash

test:
name: Run unit test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- [ self-hosted, small ]
- windows-latest
- macos-latest
python-version: [ "3.10", "3.11", "3.12" ]
include:
# Self-hosted runner
- os: [ self-hosted, small ]
python-version: "3.10"
- os: [ self-hosted, small ]
python-version: "3.11"
- os: [ self-hosted, small ]
python-version: "3.12"

# Windows
- os: windows-latest
python-version: "3.10.11"
- os: windows-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.12"

# macOS (arm64)
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
steps:
- uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry==$(head -n 1 .poetry-version)

- uses: actions/setup-python@v5
- uses: ./.github/workflows/actions/prepare
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
run: poetry install --no-interaction --no-ansi --no-root --sync

- name: Run unittests
run: python tests/testing.py
- name: Run Tests
run: poetry run python tests/testing.py
shell: bash
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,10 @@ exclude = [
"tests/sql",
"venv",
]

[tool.cibuildwheel]
test-command = "pytest {project}/tests"
test-extras = ["test"]
test-skip = ["*universal2:arm64"]
# Временно пропускаем сборку для PyPy
skip = ["pp*"]
1 change: 1 addition & 0 deletions tests/projects/go/coffee_machine/stage1/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from hstest.check_result import CheckResult
from hstest.stage_test import StageTest
from hstest.test_case import TestCase
from typing import List

OUTPUT = """
Starting to make a coffee
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage1_ce/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.check_result import CheckResult
import os
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage1_ex/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage1_wa/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage2/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage3/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage4/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/go/coffee_machine/stage5/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
3 changes: 3 additions & 0 deletions tests/projects/javascript/coffee_machine/stage1/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from typing import List

from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
3 changes: 3 additions & 0 deletions tests/projects/javascript/coffee_machine/stage1_ce/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import List

from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.check_result import CheckResult

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/coffee_machine/stage1_ex/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/coffee_machine/stage1_wa/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/coffee_machine/stage2/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/coffee_machine/stage3/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/coffee_machine/stage4/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/coffee_machine/stage5/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/simple_chatty_bot/stage1/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/simple_chatty_bot/stage2/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/simple_chatty_bot/stage3/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/simple_chatty_bot/stage4/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/javascript/simple_chatty_bot/stage5/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
3 changes: 3 additions & 0 deletions tests/projects/python/coffee_machine/stage1/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from typing import List

from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/python/coffee_machine/stage2/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/python/coffee_machine/stage3/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/python/coffee_machine/stage4/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/python/coffee_machine/stage5/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/shell/coffee_machine/stage1/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from hstest.stage_test import *
from hstest.test_case import TestCase
from hstest.common.os_utils import is_windows
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
2 changes: 2 additions & 0 deletions tests/projects/shell/coffee_machine/stage1_ex/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from hstest.test_case import TestCase
from hstest.testing.unittest.user_error_test import UserErrorTest
from hstest.common.os_utils import is_windows
from hstest.check_result import CheckResult
from typing import List

CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
Expand Down
Loading
Loading