Skip to content

Commit b81c1b7

Browse files
Merge pull request #33 from saeedya/feature/ci-cd-setup
ci: add code quality and security scanning workflow
2 parents 5fb17ec + 045ea33 commit b81c1b7

5 files changed

Lines changed: 47 additions & 10 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright Contributors to the RMTC Project
3+
name: CI
4+
5+
on:
6+
push:
7+
branches: [main, develop]
8+
pull_request:
9+
branches: [main, develop]
10+
11+
jobs:
12+
lint:
13+
name: "Code Quality"
14+
runs-on: ubuntu-22.04
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
cache: pip
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install black pylint pip-audit
30+
pip install -e ".[dev]" --no-deps
31+
32+
- name: Lint (pylint)
33+
run: pylint src/
34+
35+
- name: Security audit (pip-audit)
36+
run: pip-audit

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ rmtc-setup.sh
5050
# Ignore sublime files
5151
*.sublime-project
5252
*.sublime-workspace
53+
54+
# Ignore .venv files
55+
.venv/

.pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ source-roots=
109109

110110
# When enabled, pylint would attempt to guess common misconfiguration and emit
111111
# user-friendly hints instead of false-positive error messages.
112-
suggestion-mode=yes
113112

114113
# Allow loading of arbitrary C extensions. Extensions are imported into the
115114
# active Python interpreter and may run arbitrary code.

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ dynamic = ["version"]
1212
description = "The Rongotai Model Train Club - AI artifact provenance and training system"
1313
requires-python = ">=3.9"
1414
readme = "README.md"
15-
license = {text = "Apache-2.0"}
16-
license-files = ["LICENSE"]
15+
license = "Apache-2.0"
1716

1817
dependencies = [
1918

@@ -27,8 +26,6 @@ dependencies = [
2726
"requests>=2.28.0",
2827

2928
# GUI
30-
"NodeGraphQt>=0.6.0",
31-
"PySide>=2.0.0",
3229

3330
# Track
3431
"apache_age_python>=0.0.7",
@@ -53,6 +50,7 @@ dev = [
5350
"pytest>=8.3.0",
5451
"pylint>=3.3.0",
5552
"black>=24.8.0",
53+
"pip-audit>=2.10.0",
5654
]
5755

5856
[tool.setuptools]

src/python/lib/rmtc_core/track/cypher/connection.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,11 @@ def _sync_properties(self, entity, required_only=False):
475475
continue
476476
if prop.is_output():
477477
query = f"""
478-
MATCH (a:{entity.class_category})-[r:{prop.name}]->(b)
478+
MATCH (a:{entity.class_category})-[r:{prop.name}]->(b)
479479
"""
480480
elif prop.is_input():
481481
query = f"""
482-
MATCH (a:{entity.class_category})<-[r:{prop.name}]-(b)
482+
MATCH (a:{entity.class_category})<-[r:{prop.name}]-(b)
483483
"""
484484
query += f"""
485485
WHERE a._obj_id='{entity.obj_id}'
@@ -614,7 +614,7 @@ def get_runs(
614614
# ambiguous - fully qualified relation
615615
if checkpoint is not None:
616616
query = f"""
617-
MATCH (r:Run)-[:checkpoints]->(n) WHERE n._obj_id='{checkpoint.obj_id}'
617+
MATCH (r:Run)-[:checkpoints]->(n) WHERE n._obj_id='{checkpoint.obj_id}'
618618
RETURN r._obj_id AS id
619619
"""
620620
results = self.connection.read_query(query)
@@ -814,7 +814,7 @@ def _get_entity(
814814
if name is None and entity_license is None and version is None:
815815
self.connection.store.log.warning(f"Requesting all {category}s")
816816
query = f"""
817-
MATCH (n:{category}) WHERE n._store='{self.connection.store.name}'
817+
MATCH (n:{category}) WHERE n._store='{self.connection.store.name}'
818818
RETURN DISTINCT n._obj_id AS id
819819
"""
820820
results = self.connection.read_query(query)
@@ -848,7 +848,8 @@ def _get_entity(
848848
if len(entity_obj_ids) > 0:
849849
clause = f" AND n._obj_id IN {entity_obj_ids} "
850850
query = f"""
851-
MATCH (n)-[:licenses]->(l:License) WHERE l._obj_id='{entity_license.obj_id}' {clause}
851+
MATCH (n)-[:licenses]->(l:License)
852+
WHERE l._obj_id='{entity_license.obj_id}' {clause}
852853
RETURN DISTINCT n._obj_id AS id
853854
"""
854855
results = self.connection.read_query(query)

0 commit comments

Comments
 (0)