-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (58 loc) · 1.78 KB
/
run_jcb_basic_testing.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Run JCB basic testing with jcb-gdas 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/NOAA-EMC/jcb-gdas.git
JCB_DEVELOP_BRANCH: develop
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
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/src/jcb/configuration/apps/gdas
git checkout ${{ env.BRANCH_NAME }}
cd -
- name: Install dependencies
run: |
cd jcb_repo
pip install .[testing]
- name: Run unit tests
run: |
cd $GITHUB_WORKSPACE
pytest -v