Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
122 changes: 122 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
test:
name: Test Plugin Structure
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install fz framework
run: |
pip install git+https://github.com/Funz/fz.git

- name: Validate JSON files
run: |
echo "Validating model files..."
for f in .fz/models/*.json; do
echo " Checking $f"
python -m json.tool "$f" > /dev/null
done
echo "Validating calculator config files..."
for f in .fz/calculators/*.json; do
echo " Checking $f"
python -m json.tool "$f" > /dev/null
done

- name: Check shell script syntax
run: |
echo "Checking shell scripts..."
for f in .fz/calculators/*.sh; do
echo " Checking $f"
bash -n "$f"
done

- name: Test fzi (parse variables)
run: |
python -c "
import fz
variables = fz.fzi('examples/Modelica/NewtonCooling.mo', 'Modelica')
print(f'Variables found: {list(variables.keys())}')
assert 'convection' in variables, 'Variable convection not found'
print('✓ fzi test passed')
"

- name: Test fzc (compile input)
run: |
python -c "
import fz
import tempfile
import os
with tempfile.TemporaryDirectory() as tmpdir:
fz.fzc('examples/Modelica/NewtonCooling.mo', {'convection': 0.5}, 'Modelica', output_dir=tmpdir)
compiled = os.path.join(tmpdir, 'convection=0.5', 'NewtonCooling.mo')
assert os.path.exists(compiled), 'Compiled file not created'
with open(compiled) as f:
content = f.read()
assert '0.5' in content, 'Variable not substituted'
print('✓ fzc test passed')
"

- name: Run plugin tests
run: |
python tests/test_plugin.py

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check shell scripts are executable
run: |
for f in .fz/calculators/*.sh; do
if [ ! -x "$f" ]; then
echo "Error: $f is not executable"
exit 1
fi
done

docs:
name: Check Documentation
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check required documentation files
run: |
for f in README.md LICENSE; do
if [ ! -f "$f" ]; then
echo "Error: Missing $f"
exit 1
fi
echo "✓ $f exists"
done

- name: Check example files
run: |
if [ ! -f "examples/Modelica/NewtonCooling.mo" ]; then
echo "Error: Missing example input file"
exit 1
fi
echo "✓ Example files present"
40 changes: 0 additions & 40 deletions .github/workflows/verify.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ results/
results_*/
output/
.fz/tmp/
*.out
*.msg
*.html
PID

# IDE
.vscode/
Expand Down
Loading