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
126 changes: 109 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
name: build

# One pipeline: build/test on every PR and every push to main; release runs
# ONLY after the test matrix passes (release job `needs: test`), and only on
# push to main or manual dispatch — never on PRs.
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
paths:
- '**.py'
- 'pyproject.toml'
push:
branches:
- main
paths:
- '**.py'
- 'pyproject.toml'
workflow_dispatch:
workflow_call:

jobs:
format:
runs-on: ubuntu-latest
Expand All @@ -29,7 +21,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref || github.ref }}

- name: Install Python
uses: actions/setup-python@v4
with:
Expand All @@ -41,7 +33,6 @@ jobs:
pip install black

- name: Check for existing release
if: github.event_name == 'pull_request'
run: |
VERSION=$(python -c "
try:
Expand All @@ -58,6 +49,8 @@ jobs:
else
echo "Version v$VERSION is available"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Auto-format with Black
run: |
Expand Down Expand Up @@ -96,11 +89,110 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest black
pip install -e .[all]
pip install -e .[all]

# Transitional (until the engforge-structures split, docs/ENGFORGE_1.0.md):
# the eng extra's sectionproperties~=3.1.2 has no py3.12 release, and
# 3.2+ requires numpy>=2. Install current eng deps, then pin numpy back
# below 2 — runtime-compatible even though the resolver disagrees.
- name: Install eng deps on 3.12
if: matrix.python-version == '3.12'
run: |
pip install sectionproperties PyNiteFEA CoolProp fluids control
pip install "numpy>=1.26,<2"

- name: Check Python & Run Tests
run: |
python -c "import sys; print(sys.version)"
python -m pip list | grep PyNiteFEA || echo "pynite-not-found"
python -m pip list | grep coolprop || echo "coolprop-not-found"
python -m pip list | grep -i PyNiteFEA || echo "pynite-not-found"
python -m pip list | grep -i coolprop || echo "coolprop-not-found"
python -m unittest discover -s engforge/test -p "test_*.py" -v

release:
runs-on: ubuntu-latest
needs: [test]
# only ever release from main — push is already main-only via the trigger,
# but workflow_dispatch can be fired from any branch, so pin the ref too
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
pip install -e .[all]

- name: Get version
id: version
run: |
VERSION=$(python -c "
try:
import tomllib
except ImportError:
import tomli as tomllib
with open('pyproject.toml', 'rb') as f:
print(tomllib.load(f)['project']['version'])
")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- name: Check if release exists
id: check_release
run: |
if gh release view "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Release v${{ steps.version.outputs.version }} already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Release v${{ steps.version.outputs.version }} does not exist"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build documentation
run: |
cd docs
make html

- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/_build/html/'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Build package
if: steps.check_release.outputs.exists == 'false'
run: |
python -m build

- name: Create GitHub Release
if: steps.check_release.outputs.exists == 'false'
run: |
gh release create "v${{ steps.version.outputs.version }}" \
--title "Release v${{ steps.version.outputs.version }}" \
--notes "Automated release for version ${{ steps.version.outputs.version }}" \
--generate-notes \
dist/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to PyPI
if: steps.check_release.outputs.exists == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://upload.pypi.org/legacy/
102 changes: 0 additions & 102 deletions .github/workflows/release.yml

This file was deleted.

1 change: 0 additions & 1 deletion engforge/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from engforge.reporting import *
from engforge.attr_plotting import PlottingMixin


# import datetime
import os
from uuid import uuid4
Expand Down
1 change: 0 additions & 1 deletion engforge/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import pandas
import attr, attrs


# Index maps are used to translate between different indexes (local & global)


Expand Down
1 change: 0 additions & 1 deletion engforge/eng/fluid_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import fluids
import abc


# TODO: add a exact fluid state (T,P) / (Q,P) in the concept of processes for each thermodynamic operation (isothermal,isobaric,heating...ect)

STD_PRESSURE = 1e5 # pa
Expand Down
1 change: 0 additions & 1 deletion engforge/solveable.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import datetime
import typing


# from engforge.dynamics import DynamicsMixin
from engforge.attributes import AttributeInstance
from engforge.engforge_attributes import AttributedBaseMixin
Expand Down
1 change: 0 additions & 1 deletion engforge/test/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from engforge.problem_context import ProblemExec
import itertools


indep = "*x,*y,*z"
indep_l = indep.split(",")

Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "engforge"
version = "0.3.1"
version = "0.3.2"
description = "The Engineer's Framework"
readme = "README.md"
license = "MIT"
Expand Down Expand Up @@ -68,10 +68,11 @@ eng = [

database = [
"SQLAlchemy~=1.3.17",
"SQLAlchemy-Utils",
"SQLAlchemy-Utils",
"psycopg2-binary",
"diskcache>=5.6.1",
"sqlalchemy-batch-inserts",
"cachetools",
]
google = [
"expiringdict~=1.2.2",
Expand All @@ -94,8 +95,12 @@ docs = [
"sphinx_autodoc_typehints",
"toml~=0.10.2",
]
# NOTE: the eng extra (sectionproperties~=3.1.2) has no Python 3.12-compatible
# release that works with numpy<2, so `all` includes it only on <3.12. The
# long-term fix is the engforge-structures split (docs/ENGFORGE_1.0.md).
all = [
"engforge[database,google,cloud,distributed,docs,eng,dev]",
"engforge[database,google,cloud,distributed,docs,dev]",
"engforge[eng]; python_version < '3.12'",
]

[tool.setuptools]
Expand Down