From 56b1a514e127d71b890070518d4bbfada42c9331 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Mon, 19 Jun 2023 17:09:54 -0400 Subject: [PATCH 1/6] delete unused testing files, use reusable workflow for CI see https://github.blog/2022-02-10-using-reusable-workflows-github-actions/ --- .github/workflows/CI.yml | 59 ++-------------------------------------- .travis.yml | 46 ------------------------------- trigger-rmg-tests.sh | 53 ------------------------------------ 3 files changed, 2 insertions(+), 156 deletions(-) delete mode 100644 .travis.yml delete mode 100755 trigger-rmg-tests.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 85f400b824..2e42cfa098 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,60 +3,5 @@ name: CI on: [push] jobs: - build-and-test-linux: - runs-on: ubuntu-latest - strategy: - max-parallel: 5 - env: # update this if needed to match a pull request on the RMG-database - RMG_PY_BRANCH: main - defaults: - run: - shell: bash -l {0} - steps: - - uses: actions/checkout@v2 - - name: Get RMG-Py source code - run: | - cd .. - git clone -b $RMG_PY_BRANCH https://github.com/ReactionMechanismGenerator/RMG-Py.git - cd RMG-Py - git clone -b arkanepy3 https://github.com/mjohnson541/Q2DTor.git external/Q2DTor - - uses: conda-incubator/setup-miniconda@v2 - with: - environment-file: ../RMG-Py/environment.yml - python-version: 3.7 - activate-environment: rmg_env - - name: Conda info - run: | - conda info - conda list - - name: Install MOPAC - env: - MOPACKEY: ${{ secrets.MOPACKEY }} - timeout-minutes: 1 - continue-on-error: true # allowed to fail on pull request from a forked repository - run: | - set +o pipefail - yes 'Yes' | ${CONDA_PREFIX}/bin/mopac "$MOPACKEY" - - name: Compile RMG - run: | - cd ../RMG-Py - make - - name: Trigger RMG-tests - if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/stable' }} # only push events to branches other than main and stable - env: - GH_TOKEN: ${{ secrets.RMG_DEV_TOKEN }} - run: ./trigger-rmg-tests.sh - - name: Unit tests - run: | - cd ../RMG-Py - make test-unittests - - name: Functional tests - if: ${{ success() || failure() }} # Run even if the unit tests failed (but not if they were cancelled) - run: | - cd ../RMG-Py - make test-functional - - name: Database tests - if: ${{ success() || failure() }} # Run even if the functional tests failed (but not if they were cancelled) - run: | - cd ../RMG-Py - make test-database + compliance: + uses: ReactionMechanismGenerator/RMG-Py/.github/workflows/CI.yml@main \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 73857615fe..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: c -sudo: false - -env: - global: - - secure: fd2HDrPvxMLHOXar7HyUZh0v+C5WkCfzhRzlBn+aePayrQn5FFrT68ENyr1v4sIpKESxYUOAwqtpDPUhF3M596GgGeU5yQc4q+sZmfwbVrjOvKCYuA5037vHmkWP1+mxQtRJMz/DC6vAoyasZkN5WD2n6WYIGupu/FxIJzYyzMM= - - secure: N/LNeY6kM4g2TOWiwuZhevrFOVSSDXj42hOWmbWVfwjLxVTMpFO29os3TiXxod8q6ezpDkXi5yVcGGtKLQZr6CgoiGW8zS+UKsUntKH4HI4dZdK+hKAKwaWU641aDNIq/XqSzNJ8v7ZmLLo3sk878aTHODPRPBfb7Q9wk2l3sDs= - - secure: jSRuOGP7vghJet6oelSprSLGBd/eYuUaU3UM+QnZW0GhETWyXxjg/17hpl2R2NzVLhVz2m0KRaoT9JmG+EyJ9NW47JwTaKL+CNtxg2gPTM3/6iVNdVrXM1vOTvaJhtZ/C2SbLDg/+JPLLUMfT9/9oXkiz+enh7VzZuZDywgoTsw= - - secure: Y4tbLIssPDkRQZp2lLUtou/YZr3APmhfD3o3tUcv1mqveeg6NBYZ8o6bLSULO3wdm88s1sug23VbP+Gt74XN4Ylbt4GjhKkOxvd+Vut7dR0o0cxsH372AWHYPicCOkuYAfeDK5cqxeXkGibHW1eBdduAAT82wcW5NcD9USyv9ig= - -stages: - - name: deploy - if: branch = stable AND type = push - -before_install: - - cd .. - # Install miniconda - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh; fi - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH=$HOME/miniconda/bin:$PATH - # Update conda - - conda update --yes conda - - conda info -a - - -jobs: - include: - - stage: deploy - install: - # Setup conda build - - conda install -y conda-build - - conda install -y anaconda-client - - conda config --add channels rmg - - conda config --set anaconda_upload yes - script: - - conda build --token $CONDA_TOKEN --user rmg RMG-database/.conda - - os: osx - install: - # Setup conda build - - conda install -y conda-build - - conda install -y anaconda-client - - conda config --add channels rmg - - conda config --set anaconda_upload yes - script: - - conda build --token $CONDA_TOKEN --user rmg RMG-database/.conda diff --git a/trigger-rmg-tests.sh b/trigger-rmg-tests.sh deleted file mode 100755 index 0d23fbcddd..0000000000 --- a/trigger-rmg-tests.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# This script is designed to be run by Github Actions workflow -# to trigger the RMG-tests at -# https://github.com/reactionmechanismgenerator/rmg-tests - -set -e # exit with nonzero exit code if anything fails - -git config --global user.name "RMG Bot" -git config --global user.email "rmg_dev@mit.edu" - -BRANCH=${GITHUB_REF#refs/heads/} - -echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" -echo "BRANCH: $BRANCH" -echo "RMG_PY_BRANCH: $RMG_PY_BRANCH" - -# URL for the official RMG-tests repository -REPO=https://${GH_TOKEN}@github.com/ReactionMechanismGenerator/RMG-tests.git - -# create a temporary folder: -REPO_NAME=$(basename $REPO) -TARGET_DIR=$(mktemp -d /tmp/$REPO_NAME.XXXX) -REV=$(git rev-parse HEAD) - -# clone RMG-tests repo in the newly created folder: -git clone ${REPO} ${TARGET_DIR} - -# go inside the newly created folder: -cd $TARGET_DIR - -# create a new branch in RMG-tests with the name equal to -# the branch name of the tested RMG-database branch: -if [ "$RMG_PY_BRANCH" == "main" ] -then - RMGTESTSBRANCH=rmgdb-$BRANCH -else - RMGTESTSBRANCH=rmgdbpy-$BRANCH -fi - -git checkout -b $RMGTESTSBRANCH || true -git checkout $RMGTESTSBRANCH - -# create an empty commit with the SHA-ID of the -# tested commit of the RMG-database branch: -if [ "$RMG_PY_BRANCH" == "main" ] -then - git commit --allow-empty -m rmgdb-$REV -else - git commit --allow-empty -m rmgdbpy-$REV-${RMG_PY_BRANCH} -fi - -# push to the branch to the RMG/RMG-tests repo: -git push -f $REPO $RMGTESTSBRANCH > /dev/null From 0e19da152c85372b87be1363e421073375e9a47c Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Mon, 19 Jun 2023 17:18:54 -0400 Subject: [PATCH 2/6] rename job to `build-and-test-linux` for repo expectation --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2e42cfa098..f394fbe446 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,5 +3,5 @@ name: CI on: [push] jobs: - compliance: + build-and-test-linux: uses: ReactionMechanismGenerator/RMG-Py/.github/workflows/CI.yml@main \ No newline at end of file From 5650bd379caf2abbff5aedd2135bc0f05597faa8 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Mon, 19 Jun 2023 23:00:29 -0400 Subject: [PATCH 3/6] allow manual run of CI --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f394fbe446..3d7c5b686e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, workflow_dispatch] jobs: build-and-test-linux: From 113cb53eadea0c17ed6f76eaee3ad952774b8728 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Tue, 27 Jun 2023 09:11:34 -0400 Subject: [PATCH 4/6] pass PR branch name through to the resuable workflow see RMG-Py #2494 (https://github.com/ReactionMechanismGenerator/RMG-Py/pull/2494) --- .github/workflows/CI.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3d7c5b686e..0d66fe8052 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,4 +4,6 @@ on: [push, workflow_dispatch] jobs: build-and-test-linux: - uses: ReactionMechanismGenerator/RMG-Py/.github/workflows/CI.yml@main \ No newline at end of file + uses: ReactionMechanismGenerator/RMG-Py/.github/workflows/CI.yml@main + with: + rmg-db-branch: ${GITHUB_REF_NAME} \ No newline at end of file From 9a564d6548fc18c8265e61fbb291b7b19564e900 Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:27:38 -0400 Subject: [PATCH 5/6] Update CI.yml --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0d66fe8052..3b58989016 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,9 +1,9 @@ name: CI -on: [push, workflow_dispatch] +on: [push, workflow_dispatch] # allow manual call jobs: build-and-test-linux: uses: ReactionMechanismGenerator/RMG-Py/.github/workflows/CI.yml@main with: - rmg-db-branch: ${GITHUB_REF_NAME} \ No newline at end of file + rmg-db-branch: ${GITHUB_REF_NAME} From 1e7d4c8431746b47dc26ce52bc99ec89ee34a264 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Mon, 31 Jul 2023 11:57:25 -0400 Subject: [PATCH 6/6] add a job to extract the branch name for the CI --- .github/workflows/CI.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3b58989016..a964d41b04 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,7 +3,17 @@ name: CI on: [push, workflow_dispatch] # allow manual call jobs: - build-and-test-linux: + get-branch: + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.extract_branch.outputs.branch }} + steps: + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + rmg-py-ci: + needs: get-branch uses: ReactionMechanismGenerator/RMG-Py/.github/workflows/CI.yml@main with: - rmg-db-branch: ${GITHUB_REF_NAME} + rmg-db-branch: ${{ needs.get-branch.outputs.branch }}