Skip to content

Development Workflow

Michael Kavulich edited this page Jul 11, 2024 · 18 revisions

THIS PAGE IS UNDER CONSTRUCTION

We are in the process of updating and modernizing these instructions. Please bear with us as we work through these updates.

Table of Contents

  1. Open an Issue
  2. Develop new feature or bug fix
  3. Test! Test! Test!
  4. Submit Pull Request
  5. Code Merged to Main
  6. Post-merge Testing

Open an Issue

All development, whether for a new feature, bug fix, re-engineering task, or documentation or data update, MUST begin with opening an issue. An open issue allows for transparency, developer and community input, assignment of the task, and progress tracking.

To open an issue, follow these steps

Develop new feature or bug fix

Coding should take place in a branch in your GitHub fork. If you have not yet created a fork of ccpp-framework, you can create one at https://github.com/NCAR/ccpp-framework/fork by selecting your username from the "Owner" dropdown menu.

Test! Test! Test!

A number of tests are required to pass prior to a PR being merged, and it is highly recommended that you run as many of these tests as possible prior to opening your PR.

Continuous Integration (CI) tests

CI tests (found in ccpp-framework/.github/workflows/) are set to run automatically once a PR is opened. These are mainly unit tests for exercising various parts of the framework system, but there are also "smoke tests" for certain components, such as the ccpp_track_variables.py script. More testing may be rolled into continuous integration in the future as well.

Tests specific to "prebuild" (ccpp_prebuild.py) are contained in the top-level test_prebuild/ directory. Other tests, including those specific to "capgen" (ccpp_capgen.py), are contained in the top-level test/ directory. To run these tests, navigate to the appropriate directory and run the test scripts; in test_prebuild/ this script is ./run_all_tests.sh, in test/ these scripts are run_fortran_tests.sh and pylint_test.sh. You will need to have all of the framework prerequisites installed (Python 3.8 or higher, a compatible C and Fortran compiler, with MPI enabled) as well as cmake, make, and the python package pytest.

Regression tests

Because the CCPP framework does not generate data on its own except to create software caps, regression testing is done in the context of a host model utilizing the framework. When opening a PR to the develop branch, you should ensure regression testing is passing (or at least, has expected differences with no errors) in one or more host models with your latest code.

SCM

The CCPP Single-Column Model (SCM) has a regression test that is run automatically on all PRs that are opened to the SCM repository. To run the tests manually, you can reference the GitHub CI file for running the tests

UFS Weather Model

The UFS Weather Model has a regression test documented here: https://github.com/ufs-community/ufs-weather-model/wiki/Running-regression-test-using-rt.sh

CESM

The Community Earth System Model has a regression test documented here:

Submit Pull Request

To submit a pull request, use GitHub's "New pull request" button and set the proper compare (your development) and base (the branch on this repository to which to merge your development). All development should be committed to the develop branch outside of special cases (like release branches).

  • Enter a short description in the title bar
  • In the description text box, enter a longer description with information about the change.
  • Using proper syntax, enter the issues which are resolved by this pull request (e.g., fixes #42). If there is no issue, create one to describe the problem this PR is solving.
  • Add appropriate labels
  • Add an appropriate set of reviewers including, at least, the CODEOWNERS.
  • Assign the PR to yourself or to a member of CODEOWNERS.

If you are assigned as a reviewer of a pull request, please review the code as soon as possible. If you feel that you do not have the time or expertise to review the PR, you may remove your name from the list of reviewers unless you are the last reviewer from your organization. One person from each participating organization must review each PR.

Code Merged to Develop

After a PR has received the required approvals, and there are no additional requested changes or failing tests, a code manager should merge the PR to the develop branch. This merge should be performed via the "Squash-and-Merge" method. This method keeps the commit history concise, with only one commit per pull request, allowing for an easy-to-navigate code history.

Post-merge

After a PR is merged, the changes have been incorporated into the develop branch. However, most host models will not point to the top of develop directly, but rather to tags or hashes from the main branch. This main branch is updated occasionally (on a weekly-to-monthly basis) when a stable hash is available that can pass required tests (regression tests and any others as specified by each host's code management policies). These changes should be made via a pull request from the develop branch to main. However, when merging a PR for these main-branch updates, the traditional merge strategy should be used, to preserve the history of each pull request as a separate commit in the main branch.

main vs develop branch

The develop branch represents the "latest and greatest" CCPP Framework developments. While the top of develop should have passed all framework-specific tests, it has not necessarily been tested with all host models. Because it is a heavy lift to run all regression tests for the hosts, especially the UFS Weather Model, the main branch will only occasionally (on a weekly-to-monthly basis)

Clone this wiki locally