Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a28a93c
HWP Initial JuliaCall efforts
hwpang Mar 22, 2024
3b3c244
JWB initial increase to Python 3.9
JacksonBurns Jun 27, 2024
1233b8c
make muq optional (like the docs say!) and add a helpful msg if missing
JacksonBurns Jul 1, 2024
995b0a1
fix cython compilation errors (0.23 -> 3.n), SEE EXTENDED!!
JacksonBurns Jul 1, 2024
d4af9e1
add newly defined functions to `pxd` files
JacksonBurns Jul 1, 2024
a203d85
HWP Additional JulicaCall Debugging
hwpang Jul 2, 2024
c054a6a
XD Initial MILP Re-implementation
xiaoruiDong Mar 5, 2024
15d91e4
HWP Isodesmic Improvements
hwpang Jan 24, 2024
13f2b1c
JWB Python 3.9 and Cython Debugging, Optional RMS, fix Clar
JacksonBurns Dec 3, 2024
0e69020
dont install juliacall by default
JacksonBurns Dec 3, 2024
2e96175
np.bool is deprecated, bool
JacksonBurns Dec 3, 2024
a58d79f
re-bury the julia imports that got shuffled around
JacksonBurns Dec 3, 2024
a298cb8
remove initial species add - was carried over by accident during deve…
JacksonBurns Dec 3, 2024
c022d42
fix call to `get_reaction_matches` (should match other test)
JacksonBurns Jan 14, 2025
c2b79e4
make the m1 mac run in x86 compat mode
JacksonBurns Jan 14, 2025
4b6122f
split the python-only test into separate CI to simplify reg test logic
JacksonBurns Jan 14, 2025
0bf2cf5
fix `juliacall` incompatibilities; see extended
JacksonBurns Jan 25, 2025
9a2e6f4
docker build should wait for regression test
JacksonBurns Jan 25, 2025
e2dbd17
change liquid initial conditions to surface initial conditions for Co…
jonwzheng Jan 27, 2025
6a0d5b4
forbid incompatible numpy version
JacksonBurns Feb 25, 2025
afc90b4
run ci on arm macs natively
JacksonBurns Feb 25, 2025
143bb66
get cantera from conda-forge, which has arm mac binaries
JacksonBurns Feb 25, 2025
821ec6f
remove cantera channel from environment file
JacksonBurns Feb 25, 2025
6fcf868
don't patch the channels in the CI
JacksonBurns Feb 25, 2025
92b23b3
change lt to leq to account for slightly different arm mac floating p…
JacksonBurns Feb 25, 2025
cb167a2
update devloper installation process docs
JacksonBurns Feb 26, 2025
3958a09
clarify RMS installation process
JacksonBurns Apr 12, 2025
f4a25e0
explain why we have two nearly identical input files
JacksonBurns Apr 12, 2025
e4a2299
provide a more helpful suggestion
JacksonBurns Apr 12, 2025
f05b983
update expected smioles
JacksonBurns Apr 12, 2025
60c4125
misc. small fixes from debugging and review
JacksonBurns May 22, 2025
5de1dfa
port ci updates to docs build, set sphinx to older, compatible version
JacksonBurns May 22, 2025
4f0e3fb
Apply suggestions from code review
JacksonBurns May 23, 2025
0bd55d2
update the install_rms script to be easier to follow
JacksonBurns May 23, 2025
4881ea7
remove dirty makefile hack
JacksonBurns May 25, 2025
e254b5e
more elegant way to set env vars for julia install fix
JacksonBurns May 25, 2025
9639a70
uninstall requries name and edge case where clean can fail
JacksonBurns May 25, 2025
d0b1481
update dockerfile with new rms install
JacksonBurns May 25, 2025
5564674
developer warning about Julia sharp edge
JacksonBurns May 25, 2025
4924b08
straggler
JacksonBurns May 25, 2025
a98ba35
A note about renaming conda environment.
rwest May 27, 2025
22e153b
Use current environment name, in install_rms.sh
rwest May 27, 2025
c46a861
Fix install_rms.sh to not kill the calling shell.
rwest May 28, 2025
f7ca69d
Don't set PYTHON_JULIAPKG_PROJECT environment variable.
rwest May 28, 2025
774115b
Make julia version string more precise.
rwest May 28, 2025
b9db18f
Update developer instructions for Julia and RMS steps.
rwest May 28, 2025
311e319
Tweak to developer instructions.
rwest May 28, 2025
7d24fce
Update install_rms.sh - stable RMG branch for rms
JacksonBurns May 29, 2025
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
2 changes: 0 additions & 2 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ requirements:
- {{ compiler('c') }} # [unix]
host:
- cython >=0.25.2
- lpsolve55
- numpy
- openbabel >=3
- pydas >=1.0.2
Expand All @@ -39,7 +38,6 @@ requirements:
- h5py
- jinja2
- jupyter
- lpsolve55
- markupsafe
- matplotlib >=1.5
- mopac
Expand Down
162 changes: 82 additions & 80 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 8 * * *"
# runs on all branches on both RMG-Py and forks
push:
# allow running on RMG-Py on a pushed branch, only if triggered manually
workflow_dispatch:
# runs on PRs against RMG-Py (and anywhere else, but we add this for RMG-Py)
pull_request:

Expand All @@ -48,11 +48,22 @@
# if running on RMG-Py but requiring changes on an un-merged branch of RMG-database, replace
# main with the name of the branch
RMG_DATABASE_BRANCH: main

# julia parallel pre-compilation leads to race conditions and hangs, so we limit it to run in serial
JULIA_NUM_PRECOMPILE_TASKS: 1

jobs:
build-osx:
runs-on: macos-13
build-and-test:
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
os: [macos-13, macos-latest, ubuntu-latest]
include-rms: ["", "with RMS"]
exclude:
- os: macos-13 # GitHub's runners just aren't up to the task of installing Julia
include-rms: 'with RMS'
runs-on: ${{ matrix.os }}
name: Python ${{ matrix.python-version }} ${{ matrix.os }} Build and Test ${{ matrix.include-rms }}
# skip scheduled runs from forks
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
defaults:
Expand All @@ -62,348 +73,339 @@
- name: Checkout RMG-Py
uses: actions/checkout@v4

# Step to create a custom condarc.yml before setting up conda
- name: Create custom conda config file
run: |
RUNNER_CWD=$(pwd)
echo "channels:" > $RUNNER_CWD/condarc.yml
echo " - conda-forge" >> $RUNNER_CWD/condarc.yml
echo " - rmg" >> $RUNNER_CWD/condarc.yml
echo " - cantera" >> $RUNNER_CWD/condarc.yml
echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml

# configures the mamba environment manager and builds the environment
- name: Setup Miniforge Python 3.7
- name: Setup Miniforge Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yml
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.7
condarc-file: condarc.yml
python-version: ${{ matrix.python-version }}
activate-environment: rmg_env
use-mamba: true
auto-update-conda: true
show-channel-urls: true
conda-remove-defaults: "true"

# list the environment for debugging purposes
- name: mamba info
- name: conda info
run: |
mamba info
mamba list
conda info
conda list

# Clone RMG-database
- name: Clone RMG-database
run: |
cd ..
git clone -b $RMG_DATABASE_BRANCH https://github.com/ReactionMechanismGenerator/RMG-database.git

# modify env variables as directed in the RMG installation instructions
- name: Set Environment Variables
run: |
RUNNER_CWD=$(pwd)
echo "PYTHONPATH=$RUNNER_CWD/RMG-Py:$PYTHONPATH" >> $GITHUB_ENV
echo "$RUNNER_CWD/RMG-Py" >> $GITHUB_PATH

# RMG build step
- name: make RMG
run: |
make clean
make
- run: make install

- name: Setup Juliaup
if: matrix.include-rms == 'with RMS'
uses: julia-actions/install-juliaup@v2
with:
channel: '1.10'

# RMS installation and linking to Julia
- name: Install and link Julia dependencies
if: matrix.include-rms == 'with RMS'
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
run: . install_rms.sh

- name: Install Q2DTor
run: echo "" | make q2dtor

# non-regression testing
- name: Run Unit, Functional, and Database Tests
run: make test-all

build-and-test-linux:
regression-test:
needs: build-and-test
runs-on: ubuntu-latest
name: Regression Test
# skip scheduled runs from forks
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
env:
# This is true only if this is a reference case for the regression testing:
REFERENCE_JOB: ${{ github.ref == 'refs/heads/main' && github.repository == 'ReactionMechanismGenerator/RMG-Py' }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout RMG-Py
uses: actions/checkout@v4

# Step to create a custom condarc.yml before setting up conda
- name: Create custom condarc.yml
run: |
RUNNER_CWD=$(pwd)
echo "channels:" > $RUNNER_CWD/condarc.yml
echo " - conda-forge" >> $RUNNER_CWD/condarc.yml
echo " - rmg" >> $RUNNER_CWD/condarc.yml
echo " - cantera" >> $RUNNER_CWD/condarc.yml
echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml

# configures the mamba environment manager and builds the environment
- name: Setup Miniforge Python 3.7
- name: Setup Miniforge Python 3.9
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yml
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.7
condarc-file: condarc.yml
python-version: 3.9
activate-environment: rmg_env
use-mamba: true
auto-update-conda: true
show-channel-urls: true
conda-remove-defaults: "true"

# list the environment for debugging purposes
- name: mamba info
- name: conda info
run: |
mamba info
mamba list
conda info
conda list

# Clone RMG-database
- name: Clone RMG-database
run: |
cd ..
git clone -b $RMG_DATABASE_BRANCH https://github.com/ReactionMechanismGenerator/RMG-database.git

# modify env variables as directed in the RMG installation instructions
- name: Set Environment Variables
run: |
RUNNER_CWD=$(pwd)
echo "PYTHONPATH=$RUNNER_CWD/RMG-Py:$PYTHONPATH" >> $GITHUB_ENV
echo "$RUNNER_CWD/RMG-Py" >> $GITHUB_PATH

# RMG build step
- name: make RMG
- run: make install

- name: Make separate No-RMS conda env
run: |
make clean
make
conda create --name rmg_env_without_rms --clone rmg_env

- name: Setup Juliaup
uses: julia-actions/install-juliaup@v2
with:
channel: '1.10'

# RMS installation and linking to Julia
- name: Install and link Julia dependencies
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
run: |
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="for_rmg")); using ReactionMechanismSimulator'
. install_rms.sh

- name: Install Q2DTor
run: echo "" | make q2dtor

# non-regression testing
- name: Run Unit, Functional, and Database Tests
# aggregate into one command so we only have to eat the collection time once
run: make test-all

# Regression Testing - Test Execution
- name: Regression Tests - Execution
id: regression-execution
timeout-minutes: 60
run: |
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation RMS_liquidSurface_ch4o2cat fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
do
if python-jl rmg.py test/regression/"$regr_test"/input.py; then
if python rmg.py test/regression/"$regr_test"/input.py; then
echo "$regr_test" "Executed Successfully"
else
echo "$regr_test" "Failed to Execute" | tee -a $GITHUB_STEP_SUMMARY
export FAILED=Yes
fi
done
if [[ ${FAILED} ]]; then
echo "One or more regression tests could not be executed." | tee -a $GITHUB_STEP_SUMMARY
echo "Please download the failed results or check the above log to see why." | tee -a $GITHUB_STEP_SUMMARY
exit 1
fi

# Upload Regression Results as Failed if above step failed
- name: Upload Failed Results
if: ${{ failure() && steps.regression-execution.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: failed_regression_results
path: |
test/regression

# Upload Regression Results as Stable if Scheduled or Push to Main
- name: Upload Results as Reference
# upload the results for scheduled CI (on main) and pushes to main
if: ${{ env.REFERENCE_JOB == 'true' }}
uses: actions/upload-artifact@v4
with:
name: stable_regression_results
path: |
test/regression

# Upload Regression Results as Dynamic if Push to non-main Branch
- name: Upload Results as Dynamic
if: ${{ env.REFERENCE_JOB == 'false' }}
uses: actions/upload-artifact@v4
with:
name: dynamic_regression_results
path: |
test/regression

- name: mkdir stable_regression_results
if: ${{ env.REFERENCE_JOB == 'false' }}
run: mkdir stable_regression_results

# Retrieve Stable Results for reference
- name : Find ID of Reference Results
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# this will search for the last successful execution of CI on main
run: |
run_id=$(gh run list -R ReactionMechanismGenerator/RMG-Py --workflow="Continuous Integration" --branch main --limit 15 --json databaseId,conclusion --jq 'map(select(.conclusion == "success")) | .[0].databaseId')
echo "CI_RUN_ID=$run_id" >> $GITHUB_ENV

- name: Retrieve Stable Regression Results
if: ${{ env.REFERENCE_JOB == 'false' }}
uses: actions/download-artifact@v4
with:
# download stable regression results
run-id: ${{ env.CI_RUN_ID }}
repository: ReactionMechanismGenerator/RMG-Py
github-token: ${{ secrets.GITHUB_TOKEN }}
name: stable_regression_results
path: stable_regression_results

# Regression Testing - Actual Comparisons
- name: Regression Tests - Compare to Baseline
id: regression-comparison
if: ${{ env.REFERENCE_JOB == 'false' }}
env:
REFERENCE: stable_regression_results
run: |
conda activate rmg_env_without_rms

exec 2> >(tee -a regression.stderr >&2) 1> >(tee -a regression.stdout)
touch checkModels.log
mkdir -p "test/regression-diff"
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
do
echo ""
echo "### Regression test $regr_test:"
# Memory Usage and Execution Time
echo -n 'Reference: '
grep "Execution time" $REFERENCE/"$regr_test"/RMG.log | tail -1
echo -n 'Current: '
grep "Execution time" test/regression/"$regr_test"/RMG.log | tail -1
echo -n 'Reference: '
grep "Memory used:" $REFERENCE/"$regr_test"/RMG.log | tail -1
echo -n 'Current: '
grep "Memory used:" test/regression/"$regr_test"/RMG.log | tail -1

echo "<details>"
# Compare the edge and core
if python-jl scripts/checkModels.py \
if python scripts/checkModels.py \
"$regr_test-core" \
$REFERENCE/"$regr_test"/chemkin/chem_annotated.inp \
$REFERENCE/"$regr_test"/chemkin/species_dictionary.txt \
test/regression/"$regr_test"/chemkin/chem_annotated.inp \
test/regression/"$regr_test"/chemkin/species_dictionary.txt
test/regression/"$regr_test"/chemkin/species_dictionary.txt &> checkModels.log
then
echo "<summary>$regr_test Passed Core Comparison ✅</summary>"
else
echo "<summary>$regr_test Failed Core Comparison ❌</summary>"
cp "$regr_test-core.log" test/regression-diff/
export FAILED=Yes
fi
echo "" # blank line so next block is interpreted as markdown
cat "$regr_test-core.log" || (echo "Dumping the whole log failed, please download it from GitHub actions. Here are the first 100 lines:" && head -n100 "$regr_test-core.log")
echo "</details>"
echo "<details>"
if python-jl scripts/checkModels.py \
if python scripts/checkModels.py \
"$regr_test-edge" \
$REFERENCE/"$regr_test"/chemkin/chem_edge_annotated.inp \
$REFERENCE/"$regr_test"/chemkin/species_edge_dictionary.txt \
test/regression/"$regr_test"/chemkin/chem_edge_annotated.inp \
test/regression/"$regr_test"/chemkin/species_edge_dictionary.txt
test/regression/"$regr_test"/chemkin/species_edge_dictionary.txt &> checkModels.log
then
echo "<summary>$regr_test Passed Edge Comparison ✅</summary>"
else
echo "<summary>$regr_test Failed Edge Comparison ❌</summary>"
cp "$regr_test-edge.log" test/regression-diff/
export FAILED=Yes
fi
echo "" # blank line so next block is interpreted as markdown
cat "$regr_test-edge.log" || (echo "Dumping the whole log failed, please download it from GitHub actions. Here are the first 100 lines:" && head -n100 "$regr_test-core.log")
echo "</details>"

# Check for Regression between Reference and Dynamic (skip superminimal)
if [ -f test/regression/"$regr_test"/regression_input.py ];
then
echo "<details>"
if python-jl rmgpy/tools/regression.py \
if python rmgpy/tools/regression.py \
test/regression/"$regr_test"/regression_input.py \
$REFERENCE/"$regr_test"/chemkin \
test/regression/"$regr_test"/chemkin
test/regression/"$regr_test"/chemkin &> checkModels.log
then
echo "<summary>$regr_test Passed Observable Testing ✅</summary>"
else
echo "<summary>$regr_test Failed Observable Testing ❌</summary>"
export FAILED=Yes
fi
echo "</details>"
fi
echo ""
done
if [[ ${FAILED} ]]; then
echo "⚠️ One or more regression tests failed." | tee -a $GITHUB_STEP_SUMMARY >&2
echo "Please download the failed results and run the tests locally or check the log to see why." | tee -a $GITHUB_STEP_SUMMARY >&2
fi

- name: Prepare Results for PR Comment
if: ${{ env.REFERENCE_JOB == 'false' }}
env:
PR_NUMBER: ${{ github.event.number || github.event.after || github.event_name }}
run: |
echo $PR_NUMBER > summary.txt
echo "## Regression Testing Results" >> summary.txt
cat regression.stderr >> summary.txt
echo "<details>" >> summary.txt
echo "<summary>Detailed regression test results.</summary>" >> summary.txt
cat regression.stdout >> summary.txt
echo "</details>" >> summary.txt
echo "" >> summary.txt
echo "<details>" >> summary.txt
echo "<summary>Debugging info for `checkModels.py` (if any).</summary>" >> summary.txt
cat checkModels.log >> summary.txt
echo "</details>" >> summary.txt
echo "" >> summary.txt
echo "_beep boop this comment was written by a bot_ :robot:" >> summary.txt
cat summary.txt > $GITHUB_STEP_SUMMARY

- name: Upload regression summary artifact
# the annotate workflow uses this artifact to add a comment to the PR
uses: actions/upload-artifact@v4
if : ${{ github.event_name == 'pull_request' }}
with:
name: regression_summary
path: summary.txt

- name: Upload Comparison Results
uses: actions/upload-artifact@v4
with:
name: regression_test_comparison_results
path: |
test/regression-diff

# Install and Call codecov only if the tests were successful (permitting failures in the regression comparison tests)
- name: Code coverage install and run
if: success() || ( failure() && steps.regression-execution.conclusion == 'success' )
run: |
mamba install -y -c conda-forge codecov
conda install -y -c conda-forge codecov
codecov

build-and-push-docker:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
# after testing and on pushes to main, build and push docker image
# technically we could live without the 'needs' since _in theory_
# nothing will ever be merged into main that fails the tests, but
# who knows ¯\_(ツ)_/¯
#
# taken from https://github.com/docker/build-push-action
needs: build-and-test-linux
needs: regression-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.repository == 'ReactionMechanismGenerator/RMG-Py'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v6
with:
push: true
tags: reactionmechanismgenerator/rmg:latest
build-args: |
RMS_Branch=for_rmg

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
24 changes: 10 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,34 @@ jobs:
git config --global user.email "github-actions@github.com"

- name: Clone RMG-Py
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Mambaforge Python 3.7
- name: Setup Miniforge Python 3.9
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yml
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.7
python-version: "3.9"
activate-environment: rmg_env
use-mamba: true
auto-update-conda: true
show-channel-urls: true
conda-remove-defaults: "true"

- name: Make libtiff Symlink to Avoid Runner Bug
run: | # This action may need to be removed/adjusted in future runs.
if [ ! -f /usr/lib/x86_64-linux-gnu/libtiff.so.5 ] && [ -f /usr/lib/x86_64-linux-gnu/libtiff.so.6 ]; then sudo ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.6 /usr/lib/x86_64-linux-gnu/libtiff.so.5; fi
find /usr/lib -name libtiff*

- name: Install sphinx
run: mamba install -y sphinx
run: conda install -y sphinx~=5.0

- name: Mamba info
- name: conda info
run: |
mamba info
mamba list
conda info
conda list

- name: Clone RMG-database
run: |
Expand All @@ -65,12 +67,6 @@ jobs:
make clean
make

- name: Install and link Julia dependencies
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
run: |
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="for_rmg")); using ReactionMechanismSimulator'

- name: Checkout gh-pages Branch
uses: actions/checkout@v2
with:
Expand Down
Loading
Loading