Skip to content

Run the JCB client integration tests when making PRs in the client #15

Run the JCB client integration tests when making PRs in the client

Run the JCB client integration tests when making PRs in the client #15

name: Run JCB basic testing with client changes
on:
push:
branches:
- develop
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
test:
runs-on: ubuntu-latest
env:
JCB_REPO: https://github.com/NOAA-EMC/jcb.git
JCB_APP_REPO: "https://github.com/${GITHUB_REPOSITORY}"
steps:
- name: Checkout submodule repository
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # specify your python version
- name: Determine branch to use
id: determine-branch
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
BRANCH_NAME=${{ github.head_ref }}
else
BRANCH_REF=${{ github.ref }}
BRANCH_NAME=${BRANCH_REF#refs/heads/}
fi
echo "JCB_APP_BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
if git ls-remote --heads $JCB_REPO $BRANCH_NAME | grep -q "refs/heads/$BRANCH_NAME"; then
echo "Branch $BRANCH_NAME exists in jcb repo."
echo "JCB_BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
else
echo "Branch $BRANCH_NAME does not exist in jcb repo. Using develop branch."
echo "JCB_BRANCH_NAME=develop" >> $GITHUB_ENV
fi
- name: Clone jcb repository
run: |
mkdir -p empty_hooks
git config --global core.hooksPath empty_hooks
git clone --branch ${{ env.JCB_BRANCH_NAME }} --recursive $JCB_REPO jcb_repo
cd jcb_repo
python get_submod_path.py $JCB_APP_REPO > SUBMODPATH
SUBMODPATH=$(cat SUBMODPATH)
cd $SUBMODPATH
git checkout ${{ env.JCB_APP_BRANCH_NAME }}
- name: Install dependencies
run: |
cd jcb_repo
pip install .[testing]
- name: Run the JCB client integration tests
run: |
cd jcb_repo/test/client_integration
pytest -v