mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-03 22:14:45 +08:00
more CI testing
This commit is contained in:
parent
337ea7fb6d
commit
309e681695
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
sudo apt-add-repository -y ppa:deadsnakes/ppa
|
sudo apt-add-repository -y ppa:deadsnakes/ppa
|
||||||
sudo apt-get -y install python3.7 python3.7-dev python3-pip python3-setuptools
|
sudo apt-get -y install python3.7 python3.7-dev python3-pip python3-setuptools
|
||||||
sudo python3.7 -m pip install pylint mypy typing-extensions
|
sudo python3.7 -m pip install pylint mypy typing-extensions pytz
|
||||||
- name: Run checks
|
- name: Run checks
|
||||||
run: make checkfull
|
run: make checkfull
|
||||||
|
|
||||||
|
|||||||
@ -12,14 +12,6 @@ if TYPE_CHECKING:
|
|||||||
from typing import Dict, Union, Sequence, Optional, Any
|
from typing import Dict, Union, Sequence, Optional, Any
|
||||||
|
|
||||||
|
|
||||||
def get_proc_count() -> int:
|
|
||||||
"""Return the number of logical processors available."""
|
|
||||||
|
|
||||||
# Note: this is mac specific currently.
|
|
||||||
return int(
|
|
||||||
subprocess.check_output(['sysctl', '-n', 'hw.ncpu']).decode().strip())
|
|
||||||
|
|
||||||
|
|
||||||
def explicit_bool(value: bool) -> bool:
|
def explicit_bool(value: bool) -> bool:
|
||||||
"""Simply return input value; can avoid unreachable-code type warnings."""
|
"""Simply return input value; can avoid unreachable-code type warnings."""
|
||||||
return value
|
return value
|
||||||
|
|||||||
@ -18,7 +18,8 @@ def formatcode(projroot: Path, full: bool) -> None:
|
|||||||
"""Run clang-format on all of our source code (multithreaded)."""
|
"""Run clang-format on all of our source code (multithreaded)."""
|
||||||
import time
|
import time
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
from efrotools import get_files_hash, get_proc_count
|
from efrotools import get_files_hash
|
||||||
|
from multiprocessing import cpu_count
|
||||||
os.chdir(projroot)
|
os.chdir(projroot)
|
||||||
cachepath = Path(projroot, 'config/.cache-formatcode')
|
cachepath = Path(projroot, 'config/.cache-formatcode')
|
||||||
if full and cachepath.exists():
|
if full and cachepath.exists():
|
||||||
@ -50,7 +51,7 @@ def formatcode(projroot: Path, full: bool) -> None:
|
|||||||
# so it actually helps to lighten the load around them.
|
# so it actually helps to lighten the load around them.
|
||||||
# may want to revisit later when we have everything chopped up
|
# may want to revisit later when we have everything chopped up
|
||||||
# better
|
# better
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=get_proc_count() //
|
with concurrent.futures.ThreadPoolExecutor(max_workers=cpu_count() //
|
||||||
2) as executor:
|
2) as executor:
|
||||||
# Converting this to a list will propagate any errors.
|
# Converting this to a list will propagate any errors.
|
||||||
list(executor.map(format_file, dirtyfiles))
|
list(executor.map(format_file, dirtyfiles))
|
||||||
@ -66,7 +67,8 @@ def formatcode(projroot: Path, full: bool) -> None:
|
|||||||
def cpplintcode(projroot: Path, full: bool) -> None:
|
def cpplintcode(projroot: Path, full: bool) -> None:
|
||||||
"""Run lint-checking on all code deemed lint-able."""
|
"""Run lint-checking on all code deemed lint-able."""
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from efrotools import get_config, get_proc_count
|
from efrotools import get_config
|
||||||
|
from multiprocessing import cpu_count
|
||||||
os.chdir(projroot)
|
os.chdir(projroot)
|
||||||
filenames = get_code_filenames(projroot)
|
filenames = get_code_filenames(projroot)
|
||||||
if any(' ' in name for name in filenames):
|
if any(' ' in name for name in filenames):
|
||||||
@ -98,7 +100,7 @@ def cpplintcode(projroot: Path, full: bool) -> None:
|
|||||||
if result != 0:
|
if result != 0:
|
||||||
raise Exception(f'Linting failed for {filename}')
|
raise Exception(f'Linting failed for {filename}')
|
||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=get_proc_count() // 2) as executor:
|
with ThreadPoolExecutor(max_workers=cpu_count() // 2) as executor:
|
||||||
# Converting this to a list will propagate any errors.
|
# Converting this to a list will propagate any errors.
|
||||||
list(executor.map(lint_file, dirtyfiles))
|
list(executor.map(lint_file, dirtyfiles))
|
||||||
|
|
||||||
@ -129,7 +131,8 @@ def formatscripts(projroot: Path, full: bool) -> None:
|
|||||||
"""Runs yapf on all our scripts (multithreaded)."""
|
"""Runs yapf on all our scripts (multithreaded)."""
|
||||||
import time
|
import time
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from efrotools import get_proc_count, get_files_hash
|
from efrotools import get_files_hash
|
||||||
|
from multiprocessing import cpu_count
|
||||||
os.chdir(projroot)
|
os.chdir(projroot)
|
||||||
cachepath = Path(projroot, 'config/.cache-formatscripts')
|
cachepath = Path(projroot, 'config/.cache-formatscripts')
|
||||||
if full and cachepath.exists():
|
if full and cachepath.exists():
|
||||||
@ -158,7 +161,7 @@ def formatscripts(projroot: Path, full: bool) -> None:
|
|||||||
# so it actually helps to lighten the load around them.
|
# so it actually helps to lighten the load around them.
|
||||||
# may want to revisit later when we have everything chopped up
|
# may want to revisit later when we have everything chopped up
|
||||||
# better
|
# better
|
||||||
with ThreadPoolExecutor(max_workers=get_proc_count() // 2) as executor:
|
with ThreadPoolExecutor(max_workers=cpu_count() // 2) as executor:
|
||||||
# Converting this to a list will propagate any errors
|
# Converting this to a list will propagate any errors
|
||||||
list(executor.map(format_file, dirtyfiles))
|
list(executor.map(format_file, dirtyfiles))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user