Skip to content

Commit

Permalink
Merge branch 'main' into flux_jsr_check
Browse files Browse the repository at this point in the history
  • Loading branch information
NellyMitnik authored Mar 6, 2024
2 parents e941a80 + ac0935f commit e056be8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 65 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/cont_int.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on:
on:
pull_request:
branches:
- main
Expand All @@ -27,7 +27,7 @@ jobs:
haskell: true
large-packages: true
swap-storage: true

- name: Cache RMG
id: cache-rmg
uses: actions/cache@v2
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
path: RMG-database
ref: main
fetch-depth: 1

- name: Cache ARC
id: cache-arc
uses: actions/cache@v2
Expand All @@ -91,9 +91,8 @@ jobs:
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}-t3


- name: Setup RMG-Py Env
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3.0.1
with:
miniforge-variant: Mambaforge
miniforge-version: latest
Expand All @@ -108,7 +107,7 @@ jobs:
conda-${{ runner.os }}--${{ runner.arch }}-rmgpyenv-${{ env.CACHE_NUMBER}}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 1
CACHE_NUMBER: 3
id: cache-rmgpy-env
- name: Update environment
run: mamba env update -n rmg_env -f RMG-Py/environment.yml
Expand Down Expand Up @@ -164,7 +163,7 @@ jobs:
mamba install -c conda-forge pytest-cov
- name: Run T3 Tests
shell: bash -el {0}
shell: bash -el {0}
run: |
source ~/.bashrc
conda activate t3_env
Expand Down
33 changes: 14 additions & 19 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@ name: Docker Image Build and Push
#https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions



on:
schedule:
- cron: "0 0 */7 * *" # every 7 days
push:
branches:
- main
paths:
- "Dockerfile"
- "devtools/Dockerfile_rmgpy"
- ".github/workflows/docker_build.yml"
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
paths:
- "./Dockerfile"
- "Dockerfile"
- "devtools/Dockerfile_rmgpy"
- ".github/workflows/docker_build.yml"
types: [opened, synchronize, reopened, ready_for_review]
#workflow_dispatch: # Add this line to enable manual trigger

permissions:
contents: read
pull-requests: write

jobs:
ci-check:
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
Expand All @@ -42,28 +50,15 @@ jobs:
swap-storage: false
- name: Checkout
uses: actions/checkout@v4.1.1
# Add steps for CI checks of the Dockerfile
- name: Login to Docker Hub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Build RMG-Py
uses: docker/build-push-action@v5.0.0
with:
context: .
file: ./devtools/Dockerfile_rmgpy
push: false
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rmgpy:latest
- name: Build T3
uses: docker/build-push-action@v5.0.0
# Add steps for CI checks of the Dockerfile
- name: Build Docker Image (No Push)
uses: docker/build-push-action@v5.1.0
with:
context: .
file: ./Dockerfile
push: false
tags: ${{ secrets.DOCKERHUB_USERNAME }}/thetandemtool-t3:latest

build-and-push:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down
49 changes: 11 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
# Using the a base image of rmgpy:latest from DockerHub - Not the official version but a custom version that is smaller in size
FROM --platform=linux/amd64 laxzal/rmgpy:latest
FROM --platform=linux/amd64 laxzal/arc:latest

USER rmguser

# Installing ARC
# Change directory to Code
WORKDIR /home/rmguser/Code

# Clone main branch ARC repository from GitHub and set as working directory
RUN git clone -b main https://github.com/ReactionMechanismGenerator/ARC.git
WORKDIR /home/rmguser/Code/ARC

# Set environment variables for the Docker run and container
ENV PYTHONPATH="${PYTHONPATH}:/home/rmguser/Code/ARC"
ENV PYTHONPATH="${PYTHONPATH}:/home/rmguser/Code/AutoTST"
ENV PYTHONPATH="${PYTHONPATH}:/home/rmguser/Code/TS-GCN"
ENV PATH /home/rmguser/Code/ARC:$PATH

# Install ARC Environment
RUN micromamba create -y -f environment.yml && \
micromamba clean --all -f -y && \
rm -rf /home/rmguser/.cache/yarn \
rm -rf /home/rmguser/.cache/pip &&\
rm -rf /home/rmguser/.cache/pip && \
find -name '*.a' -delete && \
find -name '*.pyc' -delete && \
find -name '__pycache__' -type d -exec rm -rf '{}' '+' && \
find /opt/conda/envs/arc_env/lib/python3.7/site-packages/scipy -name 'tests' -type d -exec rm -rf '{}' '+' && \
find /opt/conda/envs/arc_env/lib/python3.7/site-packages/numpy -name 'tests' -type d -exec rm -rf '{}' '+' && \
find /opt/conda/envs/arc_env/lib/python3.7/site-packages/pandas -name 'tests' -type d -exec rm -rf '{}' '+' && \
find /opt/conda/envs/arc_env/lib/python3.7/site-packages -name '*.pyx' -delete && \
rm -rf /opt/conda/envs/arc_env/lib/python3.7/site-packages/uvloop/loop.c &&\
make clean

# Install T3

# Change directory to Code
Expand All @@ -54,21 +28,20 @@ RUN micromamba create -y -f environment.yml && \
find /opt/conda/envs/t3_env/lib/python3.7/site-packages -name '*.pyx' -delete \
&& find /opt/conda/ -follow -type f -name '*.a' -delete \
&& find /opt/conda/ -follow -type f -name '*.pyc' -delete \
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete

# Add alias to bashrc - rmge to activate the environment
# These commands are not necessary for the Docker image to run, but they are useful for the user
RUN echo "alias arce='micromamba activate arc_env'" >> ~/.bashrc \
&& echo "export PYTHONPATH=/home/rmguser/Code/ARC:$PYTHONPATH" >> ~/.bashrc \
&& echo "export PYTHONPATH=\"${PYTHONPATH}:/home/rmguser/Code/AutoTST\"" >> ~/.bashrc \
&& echo "alias arc='python /home/rmguser/Code/ARC/ARC.py input.yml'" >> ~/.bashrc \
&& echo "export PYTHONPATH=\"${PYTHONPATH}:/home/rmguser/Code/TS-GCN\"" >> ~/.bashrc \
&& echo "alias deact='micromamba deactivate'" >> ~/.bashrc \
&& echo "export arc_path='/home/rmguser/Code/ARC/'" >> ~/.bashrc \
RUN echo "export arc_path='/home/rmguser/Code/ARC/'" >> ~/.bashrc \
&& echo "export t3_path='/home/rmguser/Code/T3/'" >> ~/.bashrc \
&& echo "alias arccode='cd \$arc_path'" >> ~/.bashrc \
&& echo "alias t3code='cd \$t3_path'" >> ~/.bashrc \
&& echo "alias t3e='micromamba activate t3_env'" >> ~/.bashrc \
&& echo "alias t3='python /home/rmguser/Code/T3/T3.py input.yml'" >> ~/.bashrc
&& echo "alias t3='python /home/rmguser/Code/T3/T3.py input.yml'" >> ~/.bashrc

# Set the wrapper script as the entrypoint
ENTRYPOINT ["/home/rmguser/entrywrapper.sh"]

SHELL ["/bin/bash", "-c"]
# Activate the T3 environment
WORKDIR /home/rmguser/
ARG MAMBA_DOCKERFILE_ACTIVATE=1
ENV ENV_NAME=t3_env
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

# The Tandem Tool (T3) for automated chemical kinetic model development

[![Docker Image Build and Push](https://github.com/ReactionMechanismGenerator/T3/actions/workflows/docker_build.yml/badge.svg?branch=main)](https://github.com/ReactionMechanismGenerator/T3/actions/workflows/docker_build.yml)
![Release](https://img.shields.io/badge/version-0.1.0-blue.svg)
![Build Status](https://github.com/ReactionMechanismGenerator/T3/actions/workflows/cont_int.yml/badge.svg)
[![codecov](https://codecov.io/gh/ReactionMechanismGenerator/T3/branch/main/graph/badge.svg)](https://codecov.io/gh/ReactionMechanismGenerator/T3)
Expand Down
1 change: 1 addition & 0 deletions devtools/Dockerfile_rmgpy
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ RUN make \
# Install RMS
# The extra arguments are required to install PyCall and RMS in this Dockerfile. Will not work without them.
# Final command is to compile the RMS during Docker build - This will reduce the time it takes to run RMS for the first time
ENV JULIA_CPU_TARGET="x86-64,haswell,skylake,broadwell,znver1,znver2,znver3,cascadelake,icelake-client,cooperlake,generic,native"
RUN touch /opt/conda/envs/rmg_env/condarc-julia.yml
RUN CONDA_JL_CONDA_EXE=/bin/micromamba julia -e 'ENV["CONDA_JL_CONDA_EXE"]="/opt/conda/envs/rmg_env/bin/conda";using Pkg;Pkg.add(PackageSpec(name="PyCall", rev="master")); Pkg.build("PyCall"); Pkg.add(PackageSpec(name="ReactionMechanismSimulator", rev="main"))' \
&& python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()" \
Expand Down

0 comments on commit e056be8

Please sign in to comment.