Skip to content

Commit 66d8ca8

Browse files
ci: improve linter, add PR checks, and match RocketPy stack (#42)
* ci: improve linter, add PR checks, and match RocketPy stack * fix: correct openrocket_runtime init signature for newer orhelper versions
1 parent 7943f37 commit 66d8ca8

4 files changed

Lines changed: 51 additions & 33 deletions

File tree

.github/workflows/linter.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/linters.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Linters
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
paths:
11+
- "**.py"
12+
- "**.ipynb"
13+
- ".github/**"
14+
- "pyproject.toml"
15+
- "requirements*"
16+
- ".pylintrc"
17+
- "Makefile"
18+
19+
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
python-version: ["3.10"]
25+
steps:
26+
- uses: actions/checkout@main
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@main
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install ruff pylint pytest
35+
pip install -r requirements.in
36+
- name: Ruff (lint)
37+
run: ruff check --output-format=github .
38+
- name: Ruff (format)
39+
run: ruff format --check .
40+
- name: Pylint
41+
run: |
42+
pylint examples/ rocketserializer/ tests/

.github/workflows/test-pytest.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: pytest
22

33
on:
4+
push:
5+
branches:
6+
- master
7+
- main
48
pull_request:
59
types: [opened, synchronize, reopened, ready_for_review]
610
paths:

rocketserializer/openrocket_runtime.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ def __init__(self, jar_path, log_level="OFF"):
153153
)
154154

155155
# Get the default JVM path early so we can pass it
156-
jvm_path = jpype.getDefaultJVMPath()
157156
# Initialize the base class with kwargs to bypass auto-discovery
158-
super().__init__(jar=str(self.jar_path), jvm=str(jvm_path), loglevel=log_level)
157+
super().__init__(jar_path=str(self.jar_path), log_level=log_level)
158+
self.jar_path = Path(self.jar_path) # orhelper may overwrite it as str
159159
self.openrocket = None
160160
# for newest orhelper support
161161
self.openrocket_core = None
@@ -182,7 +182,9 @@ def _block_loader(gui_module, field_name):
182182
pass
183183

184184
def __enter__(self):
185-
ensure_java_compatibility(self.jar_path)
185+
# We need to guarantee that the right Java is used for the jar
186+
# before starting JVM
187+
ensure_java_compatibility(Path(self.jar_path))
186188

187189
jvm_path = jpype.getDefaultJVMPath()
188190
logger.info(

0 commit comments

Comments
 (0)