Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GitHub Actions CI testing (Fixes #138) #189

Merged
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
76d6833
Create github-actions-demo.yml
manishvenu Aug 27, 2024
45e95d7
Create general-ci-tests.yml
manishvenu Aug 27, 2024
77b4fc3
Add ".py" to test file name
manishvenu Aug 27, 2024
2f70677
Update general-ci-tests.yml check_default_params_job
manishvenu Aug 27, 2024
bbb7377
Delete .github/workflows/github-actions-demo.yml
manishvenu Aug 27, 2024
dc36294
Update general-ci-tests.yml with black formatting job & simple checkout
manishvenu Aug 27, 2024
6ec0ff0
Remove simple_checkout
manishvenu Aug 27, 2024
0804362
Add first attempt at running Standalone MOM
manishvenu Aug 27, 2024
7429d76
Apply Black to cime_config python files
manishvenu Aug 27, 2024
2addee3
Add General Ubuntu Linux Packages to build MOM
manishvenu Aug 27, 2024
f48e886
Add CSH
manishvenu Aug 27, 2024
6030aa4
update ncar-gnu.mk template for gcc/13.2.0
alperaltuntas Aug 27, 2024
ce7ea65
make compiler a CL argument
alperaltuntas Aug 27, 2024
77c48d6
Setup Fortran Action
manishvenu Aug 28, 2024
8fe72cd
Remove Fortran Lines
manishvenu Aug 28, 2024
4c7e462
Change Standalone MOM build to GNU
manishvenu Aug 28, 2024
e4cfccb
Set Tmate Session
manishvenu Aug 28, 2024
d582d16
Update general-ci-tests.yml
manishvenu Aug 28, 2024
840d417
Update general-ci-tests.yml
manishvenu Aug 28, 2024
0b46a1e
Update general-ci-tests.yml
manishvenu Aug 28, 2024
9820222
Update general-ci-tests.yml
manishvenu Aug 28, 2024
6d04ef7
Update build_examples-ncar.sh
manishvenu Aug 28, 2024
4602463
Update tmate to upterm
manishvenu Aug 28, 2024
c7cc044
Update general-ci-tests.yml - Setup Fortran
manishvenu Aug 28, 2024
fed6c9c
Update general-ci-tests.yml
manishvenu Aug 28, 2024
25e109b
Update general-ci-tests.yml
manishvenu Aug 29, 2024
b346f81
Update general-ci-tests.yml
manishvenu Aug 29, 2024
4043058
Update general-ci-tests.yml
manishvenu Aug 29, 2024
636f181
Update general-ci-tests.yml
manishvenu Aug 29, 2024
bf14068
Changed Build Script
manishvenu Aug 29, 2024
dabd714
Working MOM Build #1
manishvenu Aug 29, 2024
5f8fe39
Update general-ci-tests.yml
manishvenu Aug 29, 2024
a3d9e49
Merge branch 'main' into 138-set-up-github-actions-ci-testing
manishvenu Aug 29, 2024
f9bb1fd
Update CI
manishvenu Aug 29, 2024
6f10075
Update general-ci-tests.yml
manishvenu Aug 29, 2024
436ff22
Update general-ci-tests.yml
manishvenu Aug 29, 2024
6461882
Test CI check check_default_params
manishvenu Aug 29, 2024
7d4ecd3
Revert "Test CI check check_default_params"
manishvenu Aug 29, 2024
b8e84ab
Test CI: check_standalone_mom_build
manishvenu Aug 29, 2024
6e9055a
Revert "Test CI: check_standalone_mom_build"
manishvenu Aug 29, 2024
2b148db
Update general-ci-tests.yml
manishvenu Aug 29, 2024
6ca817b
Formatting
manishvenu Aug 30, 2024
5099a00
Update general-ci-tests.yml
manishvenu Aug 30, 2024
8abd1b2
Merge pull request #2 from manishvenu/manishvenu-patch-1
manishvenu Aug 30, 2024
964ae09
Update general-ci-tests.yml
manishvenu Aug 30, 2024
78ee9f2
Add back in CSH
manishvenu Aug 30, 2024
b7c82c5
Change CESM checkout to default branch
manishvenu Aug 30, 2024
77c9ff3
MOM_interface README Badge
manishvenu Aug 30, 2024
231a661
Start changes in response to Alper's review: Ubuntu-gnu.mk and combin…
manishvenu Aug 30, 2024
5ec78f6
Merge remote-tracking branch 'alper_standalone_gnu/standalone_gnu_bui…
manishvenu Aug 30, 2024
2812b56
First attempt: Combined Build Scripts
manishvenu Aug 30, 2024
1201ffe
Forgot to add github workflow
manishvenu Aug 30, 2024
a598b23
Minor Formatting
manishvenu Aug 30, 2024
fe680d9
Fix Casper Path
manishvenu Aug 30, 2024
160a87f
homebrew fix
manishvenu Aug 30, 2024
638ac75
Explore Cores Ubuntu
manishvenu Aug 30, 2024
31238d1
Ubuntu Jobs/Cores Used
manishvenu Aug 30, 2024
80e21fd
Remove SSH into Github Runner
manishvenu Aug 30, 2024
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
110 changes: 110 additions & 0 deletions .github/workflows/general-ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: General MOM_interface CI

# This CI workflow tests against the following questions:
# 1. Does standalone mom build and run?
# 2. Does it pass the tests/check_default_params.py test?
# 3. Do the scripts in cime_config pass the black formatter?
# Please see Issue #138 for more information

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the listed branches
push:
branches: ["main" ]
pull_request:
branches: [ "main" ]

jobs:

check_standalone_mom_build_and_run_lightweight_examples:
# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:

# Copied from NCAR/MOM6 - Install Basic Build Packages for MOM6
- name: Install Ubuntu Linux packages
shell: bash
run: |
echo "::group::Install linux packages"
sudo apt-get update
sudo apt-get install netcdf-bin
sudo apt-get install libnetcdf-dev
sudo apt-get install libnetcdff-dev
sudo apt-get install openmpi-bin
sudo apt-get install libopenmpi-dev
sudo apt-get install linux-tools-common
sudo apt-get install -y csh
echo "::endgroup::"

# Checkout CESM (cesm3_0_alpha03a) and externals
- name: Checkout CESM and Externals
run: |
git clone https://github.com/ESCOMP/CESM.git -b cesm3_0_alpha03a cesm3_0_alpha03a
alperaltuntas marked this conversation as resolved.
Show resolved Hide resolved
cd cesm3_0_alpha03a
./bin/git-fleximod update

# Checkout the correct MOM Branch
- name: Checkout initial event (Pull Request)
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "Handling pull request"
cd $GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
git checkout pr-${{ github.event.pull_request.number }}

- name: Checkout initial event (Push)
if: ${{ github.event_name == 'push' }}
run: |
echo "Handling push"
cd $GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/
git checkout ${{ github.sha }}

# Build the standalone mom using the macos script. build_examples-ncar doesn't work.
- name: Build Standalone MOM
run: |
cd $GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/standalone/build
./build_examples-darwin.sh

# CD into a couple MOM examples and run MOM in them. These are very light weight and quick.
- name: Run Double Gyre Test
run: |
cd $GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/standalone/examples/double_gyre
$GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/standalone/build/gnu/MOM6/MOM6
- name: Run Single Column KPP Test
run: |
cd $GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/standalone/examples/single_column/KPP
$GITHUB_WORKSPACE/cesm3_0_alpha03a/components/mom/standalone/build/gnu/MOM6/MOM6


# Job to run the check_default_params script, which is a test
check_default_params:

runs-on: ubuntu-latest

steps:
# Checkout the repo
- uses: actions/checkout@v4

# Run the test
- name: Run the check_default_params script
run: python tests/check_default_params.py

# Job to run the black formatter for cime_config, see black documentation for more info
check_black_format_for_cime_config:

runs-on: ubuntu-latest

steps:
# Checkout the repo
- uses: actions/checkout@v4

# Run black check
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "./cime_config"




39 changes: 24 additions & 15 deletions cime_config/SystemTests/dimcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"H_RESCALE_POWER = -11",
"Z_RESCALE_POWER = -11",
"R_RESCALE_POWER = -11",
"Q_RESCALE_POWER = -11"
]
"Q_RESCALE_POWER = -11",
]

run_suffixes = [
"base",
Expand Down Expand Up @@ -67,27 +67,36 @@
"scale the dimension Q by 2**-11",
]


class DIMCS(SystemTestsCompareN):

def __init__(self, case):
self.comp = case.get_value("COMP_OCN")
SystemTestsCompareN.__init__(self, case, N=len(nl_contents),
separate_builds = False,
run_suffixes = run_suffixes,
run_descriptions = run_descriptions,
ignore_fieldlist_diffs = True)
SystemTestsCompareN.__init__(
self,
case,
N=len(nl_contents),
separate_builds=False,
run_suffixes=run_suffixes,
run_descriptions=run_descriptions,
ignore_fieldlist_diffs=True,
)

def _common_setup(self):
nl_contents_common = '''
nl_contents_common = """
! DIMCS test changes
'''
append_to_user_nl_files(caseroot = self._case.get_value("CASEROOT"),
component = self.comp,
contents = nl_contents_common)
"""
append_to_user_nl_files(
caseroot=self._case.get_value("CASEROOT"),
component=self.comp,
contents=nl_contents_common,
)

def _case_setup(self, i):

# Second append user_nl change sepecific to case-i
append_to_user_nl_files(caseroot = self._case.get_value("CASEROOT"),
component = self.comp,
contents = nl_contents[i])
append_to_user_nl_files(
caseroot=self._case.get_value("CASEROOT"),
component=self.comp,
contents=nl_contents[i],
)
37 changes: 23 additions & 14 deletions cime_config/SystemTests/dimcsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"Z_RESCALE_POWER = 11",
"R_RESCALE_POWER = 11",
"Q_RESCALE_POWER = 11",
]
]

run_suffixes = [
"base",
Expand All @@ -49,27 +49,36 @@
"scale the dimension Q by 2**11",
]


class DIMCSL(SystemTestsCompareN):

def __init__(self, case):
self.comp = case.get_value("COMP_OCN")
SystemTestsCompareN.__init__(self, case, N=len(nl_contents),
separate_builds = False,
run_suffixes = run_suffixes,
run_descriptions = run_descriptions,
ignore_fieldlist_diffs = True)
SystemTestsCompareN.__init__(
self,
case,
N=len(nl_contents),
separate_builds=False,
run_suffixes=run_suffixes,
run_descriptions=run_descriptions,
ignore_fieldlist_diffs=True,
)

def _common_setup(self):
nl_contents_common = '''
nl_contents_common = """
! DIMCSL test changes
'''
append_to_user_nl_files(caseroot = self._case.get_value("CASEROOT"),
component = self.comp,
contents = nl_contents_common)
"""
append_to_user_nl_files(
caseroot=self._case.get_value("CASEROOT"),
component=self.comp,
contents=nl_contents_common,
)

def _case_setup(self, i):

# Second append user_nl change sepecific to case-i
append_to_user_nl_files(caseroot = self._case.get_value("CASEROOT"),
component = self.comp,
contents = nl_contents[i])
append_to_user_nl_files(
caseroot=self._case.get_value("CASEROOT"),
component=self.comp,
contents=nl_contents[i],
)