Skip to content

Commit

Permalink
Merge branch 'main' into adsorbate_resonance
Browse files Browse the repository at this point in the history
  • Loading branch information
bjkreitz authored Nov 12, 2024
2 parents 271fe7e + 43d5bf8 commit 76440c6
Show file tree
Hide file tree
Showing 19 changed files with 2,343 additions and 93 deletions.
43 changes: 33 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# 2023-07-17 - made it pass by default
# 2023-07-21 - upload the regression results summary as artifact (for use as a comment on PRs)
# 2023-07-31 - removed option to run from RMG-database with GitHub resuable workflows
# 2024-10-01 - deprecated Mambaforge with Miniforge3 for environment creation

name: Continuous Integration

Expand Down Expand Up @@ -61,14 +62,25 @@ jobs:
- 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 Mambaforge Python 3.7
- name: Setup Miniforge Python 3.7
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yml
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.7
condarc-file: condarc.yml
activate-environment: rmg_env
use-mamba: true

Expand Down Expand Up @@ -111,14 +123,25 @@ jobs:
- 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 Mambaforge Python 3.7
- name: Setup Miniforge Python 3.7
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yml
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.7
condarc-file: condarc.yml
activate-environment: rmg_env
use-mamba: true

Expand Down Expand Up @@ -167,7 +190,7 @@ jobs:
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;
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
echo "$regr_test" "Executed Successfully"
Expand Down Expand Up @@ -218,16 +241,16 @@ jobs:
- 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 1 --json databaseId --jq '.[0].databaseId')
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:
# this will search for the last successful execution of CI on main and download
# the stable regression results
# download stable regression results
run-id: ${{ env.CI_RUN_ID }}
repository: ReactionMechanismGenerator/RMG-Py
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -243,7 +266,7 @@ jobs:
run: |
exec 2> >(tee -a regression.stderr >&2) 1> >(tee -a regression.stdout)
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;
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:"
Expand Down Expand Up @@ -378,7 +401,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
push: true
tags: reactionmechanismgenerator/rmg:latest
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
fetch-depth: 0

- name: Setup Mambaforge Python 3.7
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: environment.yml
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.7
activate-environment: rmg_env
Expand Down
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ RUN apt-get update && \
apt-get clean -y

# Install conda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p /miniconda && \
rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH="$PATH:/miniconda/bin"
RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" && \
bash Miniforge3-Linux-x86_64.sh -b -p /miniforge && \
rm Miniforge3-Linux-x86_64.sh
ENV PATH="$PATH:/miniforge/bin"

# Set solver backend to mamba for speed
RUN conda install -n base conda-libmamba-solver && \
Expand All @@ -35,12 +35,18 @@ RUN conda install -n base conda-libmamba-solver && \
# Set Bash as the default shell for following commands
SHELL ["/bin/bash", "-c"]

# Add build arguments for RMG-Py, RMG-database, and RMS branches.
ARG RMG_Py_Branch=main
ARG RMG_Database_Branch=main
ARG RMS_Branch=main
ENV rmsbranch=${RMS_Branch}

# cd
WORKDIR /rmg

# Clone the RMG base and database repositories
RUN git clone --single-branch --branch main --depth 1 https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
git clone --single-branch --branch main --depth 1 https://github.com/ReactionMechanismGenerator/RMG-database.git
RUN git clone --single-branch --branch ${RMG_Py_Branch} --depth 1 https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
git clone --single-branch --branch ${RMG_Database_Branch} --depth 1 https://github.com/ReactionMechanismGenerator/RMG-database.git

WORKDIR /rmg/RMG-Py
# build the conda environment
Expand All @@ -64,7 +70,7 @@ ENV PATH="$RUNNER_CWD/RMG-Py:$PATH"
# setting this env variable fixes an issue with Julia precompilation on Windows
ENV JULIA_CPU_TARGET="x86-64,haswell,skylake,broadwell,znver1,znver2,znver3,cascadelake,icelake-client,cooperlake,generic"
RUN make && \
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master")); Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator' && \
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master")); Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev=ENV["rmsbranch"])); using ReactionMechanismSimulator' && \
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"

# RMG-Py should now be installed and ready - trigger precompilation and test run
Expand Down
Loading

0 comments on commit 76440c6

Please sign in to comment.