Skip to content

Commit e1c8da8

Browse files
committed
Add git-fleximod test Github Action.
1 parent cd7152c commit e1c8da8

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#Github Action to ensure that
2+
#the "fxtag" and "url" values
3+
#in the ".gitmodules" file
4+
#match what is actually
5+
#stored in the committed
6+
#git submodule entries.
7+
8+
#Please note that 'git-fleximod'
9+
#is not actually needed for this
10+
#repo, it is simply being used
11+
#here to run the test described
12+
#above.
13+
14+
#on: pull_request
15+
on:
16+
push:
17+
branches:
18+
- fleximod_test
19+
pull_request:
20+
21+
jobs:
22+
fleximod-test:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: checkout atmospheric_physics
26+
uses: actions/checkout@v4
27+
28+
- name: checkout python v3.12
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: "3.12"
32+
33+
- name: checkout git-fleximod
34+
use: actions/checkout@v4
35+
with:
36+
repository: ESMCI/git-fleximod
37+
ref: main
38+
path: $GITHUB_WORKSPACE/.lib/git-fleximod
39+
40+
- name: create git-fleximod script
41+
run:
42+
echo
43+
echo "Creating git-fleximod python srcript..."
44+
45+
#Create new directory:
46+
mkdir $GITHUB_WORKSPACE/bin
47+
48+
#Write python script to expected location:
49+
cat <<EOF > $GITHUB_WORKSPACE/bin/git-fleximod
50+
#!/usr/bin/env python3
51+
import sys
52+
import os
53+
sys.path.insert(0,os.path.abspath(os.path.join(os.path.dirname(__file__),"..",".lib","git-fleximod")))
54+
from git_fleximod.git_fleximod import main
55+
56+
if __name__ == '__main__':
57+
sys.exit(main())
58+
EOF
59+
60+
#Make sure python script is executable:
61+
chmod a+x $GITHUB_WORKSPACE/bin/git-fleximod
62+
63+
echo "...git-fleximod python script generated."
64+
65+
- name: run git-fleximod
66+
run: |
67+
$GITHUB_WORKSPACE/bin/git-fleximod update -o
68+
echo
69+
echo "Update complete, checking status"
70+
echo
71+
$GITHUB_WORKSPACE/bin/git-fleximod test
72+
- name: check cleanliness
73+
run: |
74+
echo
75+
echo "Checking if git fleximod matches expected externals"
76+
echo
77+
git add . && git diff --exit-code && git diff --cached --exit-code

0 commit comments

Comments
 (0)