Skip to content

Commit

Permalink
[Feature] Run pre-commit hooks as part of GitHub actions (#222)
Browse files Browse the repository at this point in the history
* added pre-commit

* added pre-commit to actions

* added pre-commit (pyest)

* added pre-commit to actions

* added pre-commit (pyest)
  • Loading branch information
palash018 authored Oct 1, 2024
1 parent b421f00 commit c1b286b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches: "**"
pull_request:
branches: "**"

env:
OMR_CHECKER_CONTAINER: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.dev.txt
pip install pre-commit
- name: Run pre-commit
run: |
pre-commit run
12 changes: 8 additions & 4 deletions src/utils/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

import cv2
from matplotlib import pyplot
from screeninfo import get_monitors

from screeninfo import Monitor, get_monitors
import os
from src.utils.constants import WAIT_KEYS
from src.utils.drawing import DrawingUtils
from src.utils.image import ImageUtils
from src.utils.logger import logger

monitor_window = get_monitors()[0]


@dataclass
class ImageMetrics:
# TODO: fix window metrics doesn't account for the doc/taskbar on macos
if os.environ.get("OMR_CHECKER_CONTAINER"):
monitor_window = Monitor(0, 0, 1000, 1000, 100, 100, "FakeMonitor", False)
else:
monitor_window = get_monitors()[0]
window_width, window_height = monitor_window.width, monitor_window.height
# for positioning image windows
window_x, window_y = 0, 0
Expand Down Expand Up @@ -113,6 +115,8 @@ def show(
config=None,
):
image_metrics = InteractionUtils.image_metrics
if os.environ.get("OMR_CHECKER_CONTAINER"):
return
if image is None:
logger.warning(f"'{name}' - NoneType image to show!")
if pause:
Expand Down

0 comments on commit c1b286b

Please sign in to comment.