Skip to content

Commit 56e9a1b

Browse files
committed
merge from upstream master
2 parents d371d40 + afc11b6 commit 56e9a1b

145 files changed

Lines changed: 15662 additions & 1993 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/mfc-agent-rules.mdc

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

.githooks/pre-commit

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# MFC pre-commit hook
4+
# Runs ./mfc.sh precheck before allowing commits
5+
# Bypass with: git commit --no-verify
6+
7+
# Only run if we're in the MFC repo root (where mfc.sh exists)
8+
if [ ! -f "$(git rev-parse --show-toplevel)/mfc.sh" ]; then
9+
exit 0
10+
fi
11+
12+
cd "$(git rev-parse --show-toplevel)"
13+
14+
# Auto-detect CPU count (capped at 12 to avoid hogging resources)
15+
JOBS=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
16+
[ "$JOBS" -gt 12 ] && JOBS=12
17+
18+
echo ""
19+
echo "mfc: Running precheck before commit (-j $JOBS)..."
20+
echo ""
21+
22+
if ./mfc.sh precheck -j "$JOBS"; then
23+
echo ""
24+
exit 0
25+
else
26+
echo ""
27+
echo "mfc: Commit blocked. Fix issues above or use 'git commit --no-verify' to bypass."
28+
echo ""
29+
exit 1
30+
fi

.github/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ RUN apt-get update -y && \
1515
if [ "$TARGET" != "gpu" ]; then \
1616
apt-get install -y \
1717
build-essential git make cmake gcc g++ gfortran bc \
18-
python3.11 python3.11-venv python3-pip \
18+
python3.12 python3.12-venv python3-pip \
1919
openmpi-bin libopenmpi-dev libfftw3-dev \
2020
mpich libmpich-dev; \
2121
else \
2222
apt-get install -y \
2323
build-essential git make cmake bc \
24-
python3.11 python3.11-venv python3-pip \
24+
python3.12 python3.12-venv python3-pip \
2525
libfftw3-dev \
2626
openmpi-bin libopenmpi-dev; \
2727
fi && \
28-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \
28+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 && \
2929
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3030

3131
ENV OMPI_ALLOW_RUN_AS_ROOT=1
@@ -40,6 +40,13 @@ ENV FC=${FC_COMPILER}
4040
ENV PATH="${COMPILER_PATH}:$PATH"
4141
ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH:-}"
4242

43+
# Pre-install numpy into the venv before mfc.sh runs, as it's required at
44+
# build time by several dependencies (pandas, cantera, matplotlib, etc.) that
45+
# may need to compile from source on architectures without pre-built wheels
46+
RUN python3.12 -m venv /opt/MFC/build/venv && \
47+
/opt/MFC/build/venv/bin/pip install --upgrade pip && \
48+
/opt/MFC/build/venv/bin/pip install numpy
49+
4350
RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \
4451
cd /opt/MFC && \
4552
if [ "$TARGET" = "gpu" ]; then \

.github/workflows/bench.yml

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,85 @@
11
name: 'Benchmark'
22

33
on:
4-
pull_request:
5-
pull_request_review:
6-
types: [submitted]
4+
# Trigger when Test Suite completes (no polling needed)
5+
workflow_run:
6+
workflows: ["Test Suite"]
7+
types: [completed]
78
workflow_dispatch:
89

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
12+
cancel-in-progress: true
13+
914
jobs:
1015
file-changes:
1116
name: Detect File Changes
17+
# Only run if Test Suite passed (or manual dispatch)
18+
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
1219
runs-on: 'ubuntu-latest'
13-
outputs:
20+
outputs:
1421
checkall: ${{ steps.changes.outputs.checkall }}
22+
pr_number: ${{ steps.pr-info.outputs.pr_number }}
23+
pr_approved: ${{ steps.pr-info.outputs.approved }}
24+
pr_author: ${{ steps.pr-info.outputs.author }}
1525
steps:
1626
- name: Clone
1727
uses: actions/checkout@v4
28+
with:
29+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
1830

1931
- name: Detect Changes
2032
uses: dorny/paths-filter@v3
2133
id: changes
22-
with:
34+
with:
2335
filters: ".github/file-filter.yml"
2436

37+
- name: Get PR Info
38+
id: pr-info
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
run: |
42+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
43+
echo "pr_number=" >> $GITHUB_OUTPUT
44+
echo "approved=true" >> $GITHUB_OUTPUT
45+
echo "author=${{ github.actor }}" >> $GITHUB_OUTPUT
46+
else
47+
# Get PR number from workflow_run
48+
PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}"
49+
if [ -n "$PR_NUMBER" ]; then
50+
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
51+
52+
# Fetch actual PR author from API (workflow_run.actor is the re-runner, not PR author)
53+
PR_AUTHOR=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.user.login')
54+
echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT
55+
56+
# Check if PR is approved
57+
APPROVED=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews \
58+
--jq '[.[] | select(.state == "APPROVED")] | length')
59+
if [ "$APPROVED" -gt 0 ]; then
60+
echo "approved=true" >> $GITHUB_OUTPUT
61+
else
62+
echo "approved=false" >> $GITHUB_OUTPUT
63+
fi
64+
else
65+
echo "pr_number=" >> $GITHUB_OUTPUT
66+
echo "approved=false" >> $GITHUB_OUTPUT
67+
echo "author=" >> $GITHUB_OUTPUT
68+
fi
69+
fi
70+
2571
self:
2672
name: "${{ matrix.name }} (${{ matrix.device }}${{ matrix.interface != 'none' && format('-{0}', matrix.interface) || '' }})"
27-
if: ${{ github.repository=='MFlowCode/MFC' && needs.file-changes.outputs.checkall=='true' && ((github.event_name=='pull_request_review' && github.event.review.state=='approved') || (github.event_name=='pull_request' && (github.event.pull_request.user.login=='sbryngelson' || github.event.pull_request.user.login=='wilfonba'))) }}
28-
needs: file-changes
73+
if: >
74+
github.repository == 'MFlowCode/MFC' &&
75+
needs.file-changes.outputs.checkall == 'true' &&
76+
(
77+
github.event_name == 'workflow_dispatch' ||
78+
needs.file-changes.outputs.pr_approved == 'true' ||
79+
needs.file-changes.outputs.pr_author == 'sbryngelson' ||
80+
needs.file-changes.outputs.pr_author == 'wilfonba'
81+
)
82+
needs: [file-changes]
2983
strategy:
3084
fail-fast: false
3185
matrix:
@@ -89,6 +143,7 @@ jobs:
89143
- name: Clone - PR
90144
uses: actions/checkout@v4
91145
with:
146+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
92147
path: pr
93148

94149
- name: Clone - Master

.github/workflows/cleanliness.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Cleanliness
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
412

513
jobs:
614
file-changes:

.github/workflows/coverage.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Coverage Check
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
412

513
jobs:
614
file-changes:
@@ -35,10 +43,10 @@ jobs:
3543
libfftw3-dev libhdf5-dev libblas-dev liblapack-dev
3644
3745
- name: Build
38-
run: /bin/bash mfc.sh build -j $(nproc) --gcov
46+
run: /bin/bash mfc.sh build -v -j $(nproc) --gcov
3947

4048
- name: Test
41-
run: /bin/bash mfc.sh test -a -j $(nproc)
49+
run: /bin/bash mfc.sh test -v -a -j $(nproc)
4250

4351
- name: Upload coverage reports to Codecov
4452
uses: codecov/codecov-action@v4

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
TAG="${{ github.event.inputs.tag || github.ref_name }}"
5555
echo "tag=$TAG" >> $GITHUB_OUTPUT
5656
echo "TAG=$TAG" >> $GITHUB_ENV
57-
git clone --branch "$TAG" --depth 1 https://github.com/MFlowCode/MFC.git mfc
57+
git clone --branch "$TAG" --depth 1 ${{ github.server_url }}/${{ github.repository }}.git mfc
5858
5959
- name: Stage
6060
run: |

0 commit comments

Comments
 (0)