Skip to content
Closed
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
137 changes: 93 additions & 44 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ on:
# allow calling from other repos in the ReactionMechanismGenerator organization
workflow_call:
inputs:
rmg-py-branch:
default: "main"
required: false
type: string
rmg-db-branch:
# if calling from RMG-database, must provide a branch
required: true
Expand All @@ -52,23 +56,98 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# if running on RMG-Py but requiring changes on an un-merged branch of RMG-database, replace
# main with the name of the branch
env:
RMG_DATABASE_BRANCH: main

jobs:
clone:
runs-on: ubuntu-latest
# skip scheduled runs from forks
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
steps:
# Option 1: calling from branch on RMG/RMG-Py and using branch on RMG/RMG-database
- name: Checkout RMG-Py
if: github.repository == 'ReactionMechanismGenerator/RMG-Py'
uses: actions/checkout@v3
with:
repository: ReactionMechanismGenerator/RMG-Py
path: RMG-Py
- name: Checkout RMG-database
if: github.repository == 'ReactionMechanismGenerator/RMG-Py'
uses: actions/checkout@v3
with:
repository: ReactionMechanismGenerator/RMG-database
path: RMG-database
ref: ${{ env.RMG_DATABASE_BRANCH }}

# Option 2: calling from fork of RMG-Py and using branch on RMG/RMG-database
- name: Checkout RMG-Py
if: github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event.repository.name == 'RMG-Py'
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/RMG-Py
path: RMG-Py
- name: Checkout RMG-database
if: github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event.repository.name == 'RMG-Py'
uses: actions/checkout@v3
with:
repository: ReactionMechanismGenerator/RMG-database
path: RMG-database
ref: ${{ env.RMG_DATABASE_BRANCH }}

# Option 3: calling from branch on RMG-database
- name: Checkout RMG-Py
if: github.repository == 'ReactionMechanismGenerator/RMG-database'
uses: actions/checkout@v3
with:
repository: ReactionMechanismGenerator/RMG-Py
path: RMG-Py
ref: ${{ inputs.rmg-py-branch }}
- name: Checkout RMG-database
if: github.repository == 'ReactionMechanismGenerator/RMG-database'
uses: actions/checkout@v3
with:
repository: ReactionMechanismGenerator/RMG-database
path: RMG-database
ref: ${{ inputs.rmg-db-branch }}

# Option 4: calling from fork on RMG-database
- name: Checkout RMG-Py
if: github.repository != 'ReactionMechanismGenerator/RMG-database' && github.event.repository.name == 'RMG-database'
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/RMG-Py
path: RMG-Py
ref: ${{ inputs.rmg-py-branch }}
- name: Checkout RMG-database
if: github.repository != 'ReactionMechanismGenerator/RMG-database' && github.event.repository.name == 'RMG-database'
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/RMG-database
path: RMG-database
ref: ${{ inputs.rmg-db-branch }}

- name: Pass Repos to Build and Test
uses: actions/upload-artifact@v3
with:
name: repositories
path: ${{ github.workspace }}

build-osx:
needs: clone
runs-on: macos-latest
# skip scheduled runs from forks
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
env:
# 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
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout RMG-Py
uses: actions/checkout@v3
- name: Fetch Repos
uses: actions/download-artifact@v3
with:
repository: ReactionMechanismGenerator/RMG-Py
name: repositories
path: ${{ github.workspace }}

# configures the mamba environment manager and builds the environment
- name: Setup Mambaforge Python 3.7
Expand All @@ -87,19 +166,6 @@ jobs:
mamba info
mamba list

# Clone RMG-database
- name: Clone RMG-database - Reusable Workflow
if: github.repository == 'ReactionMechanismGenerator/RMG-database'
run: |
cd ..
git clone -b ${{ inputs.rmg-db-branch }} https://github.com/ReactionMechanismGenerator/RMG-database.git

- name: Clone RMG-database - RMG-Py
if: github.repository != 'ReactionMechanismGenerator/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: |
Expand All @@ -114,24 +180,20 @@ jobs:
make

build-and-test-linux:
needs: clone
runs-on: ubuntu-latest
# skip scheduled runs from forks
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
env:
# 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

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@v3
- name: Fetch Repos
uses: actions/download-artifact@v3
with:
repository: ReactionMechanismGenerator/RMG-Py
name: repositories
path: ${{ github.workspace }}

# configures the mamba environment manager and builds the environment
- name: Setup Mambaforge Python 3.7
Expand All @@ -150,19 +212,6 @@ jobs:
mamba info
mamba list

# Clone RMG-database
- name: Clone RMG-database - Reusable Workflow
if: github.repository == 'ReactionMechanismGenerator/RMG-database'
run: |
cd ..
git clone -b ${{ inputs.rmg-db-branch }} https://github.com/ReactionMechanismGenerator/RMG-database.git

- name: Clone RMG-database - RMG-Py
if: github.repository != 'ReactionMechanismGenerator/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: |
Expand Down