Skip to content

Commit

Permalink
Merge pull request #331 from igor-davidyuk/actions-3-os-support
Browse files Browse the repository at this point in the history
Enable pre-merge tests on Windows and MacOS
  • Loading branch information
igor-davidyuk authored Feb 14, 2024
2 parents 5d0477d + 2a75e22 commit 14b2e10
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 24 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/pre-merge-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,28 @@ on:
env:
PREMERGE_TEST_REPORT: pre_merge_test_report.html
REPORT_DIRECTORY: reports
PYTHONUTF8: '1'

jobs:
pr_tests:
# runs-on: ${{ matrix.os }}
runs-on: [self-hosted, sdk-runner]
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
- os: macos-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.10'
fail-fast: true
max-parallel: 1
steps:
max-parallel: 3

- name: Checkout code with caching for Git LFS
uses: nschloe/action-cached-lfs-checkout@v1.2.0
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -41,23 +48,26 @@ jobs:
- name: Create report directory
# Creates the temporary directory that is used to store the test report
run: |
mkdir $REPORT_DIRECTORY
mkdir -p env.REPORT_DIRECTORY
- name: Check formatting with black
run: black . --check

- name: Check imports with isort
run: isort . --check
if: ${{ always() }}

- name: Flake8 linting
run: flake8 .
if: ${{ always() }}

- name: Pydocstyle linting
run: pydocstyle geti_sdk --count
if: ${{ always() }}

- name: Test with pytest
run: |
pytest tests/pre-merge -c tests/offline.ini --cov=geti_sdk --html=$REPORT_DIRECTORY/$PREMERGE_TEST_REPORT --self-contained-html --cov-report html:$REPORT_DIRECTORY/coverage
pytest tests/pre-merge -c tests/offline.ini --cov=geti_sdk --html=env.REPORT_DIRECTORY/env.PREMERGE_TEST_REPORT --self-contained-html --cov-report html:env.REPORT_DIRECTORY/coverage
- name: Upload test report for pre-merge tests
# Publish the test report to github
Expand All @@ -71,4 +81,4 @@ jobs:
# Remove temporary report directory
if: ${{ always() }}
run: |
rm -r $REPORT_DIRECTORY
rm -r env.REPORT_DIRECTORY
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:

# Code formatting
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.1.1
hooks:
- id: black

Expand Down
8 changes: 5 additions & 3 deletions geti_sdk/benchmarking/benchmarker.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,11 @@ def compare_predictions(
"run_name": f"Deployment {deployment_index}",
"model_1": deployment.models[0].name,
"model_1_score": model_scores[0],
"fps": None
if throughput_benchmark_results is None
else throughput_benchmark_results[deployment_index]["fps"],
"fps": (
None
if throughput_benchmark_results is None
else throughput_benchmark_results[deployment_index]["fps"]
),
}
if not self._is_single_task:
model_info.update(
Expand Down
6 changes: 3 additions & 3 deletions geti_sdk/data_models/configurable_parameter_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ def from_dict(cls, input_dict: Dict[str, Any]) -> "ParameterGroup":
input_dict
"""
input_copy = copy.deepcopy(input_dict)
parameter_dicts: List[
Union[Dict[str, Any], ConfigurableParameter]
] = input_copy.pop("parameters", [])
parameter_dicts: List[Union[Dict[str, Any], ConfigurableParameter]] = (
input_copy.pop("parameters", [])
)
group_dicts: List[Union[Dict[str, Any], ParameterGroup]] = input_copy.pop(
"groups", []
)
Expand Down
6 changes: 3 additions & 3 deletions geti_sdk/data_models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ class JobMetadata:
scores: Optional[List[ScoreMetadata]] = None
trained_model: Optional[ModelMetadata] = None # Added in Geti v1.7
warnings: Optional[List[dict]] = None # Added in Geti v1.13 for dataset import jobs
supported_project_types: Optional[
List[dict]
] = None # Added in Geti v1.13 for dataset import jobs
supported_project_types: Optional[List[dict]] = (
None # Added in Geti v1.13 for dataset import jobs
)
project_id: Optional[str] = None # Added in Geti v1.13 for dataset import jobs


Expand Down
8 changes: 5 additions & 3 deletions geti_sdk/geti.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,11 @@ def create_task_chain_project_from_dataset(
regarding the uploaded project
"""
labels_per_task = [
entry.get_all_label_names()
if isinstance(entry, AnnotationReader)
else entry
(
entry.get_all_label_names()
if isinstance(entry, AnnotationReader)
else entry
)
for entry in label_source_per_task
]
annotation_readers_per_task = [
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pytest-env==1.0.*
pytest-html==3.2.*
flake8==6.0.*
pydocstyle>=6.1
black>=22.6
black>=24.1
isort>=5.12
pre-commit>=3.5
nbqa>=1.7.0
Expand Down

0 comments on commit 14b2e10

Please sign in to comment.