Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 52 additions & 0 deletions .github/workflows/mpas_dynamical_core_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
runs-on: ubuntu-24.04
needs:
- conditional-check
- source-code-linting
- unit-tests
if: ${{ always() }}
steps:
Expand Down Expand Up @@ -167,6 +168,18 @@ jobs:
;;
esac

case "${{ needs.source-code-linting.result }}" in
skipped|success)
:
;;
cancelled|failure)
write_result_and_exit false
;;
*)
write_result_and_exit error
;;
esac

case "${{ needs.unit-tests.result }}" in
skipped|success)
:
Expand All @@ -180,6 +193,45 @@ jobs:
esac

write_result_and_exit true
source-code-linting:
name: Lint Fortran source code
timeout-minutes: 10
runs-on: ubuntu-24.04
needs: conditional-check
if: ${{ needs.conditional-check.outputs.should-run == 'true' }}
env:
FORTITUDE_VERSION: '0.7.*'
SOURCE_CODE_PATH: ${{ github.workspace }}/src/dynamics/mpas
steps:
- name: Checkout CAM-SIMA
uses: actions/checkout@v5

- name: Setup Python
uses: actions/setup-python@v6
with:
cache: pip
python-version: '3.12'

- name: Install Fortitude
run: |
python3 -m venv venv-fortitude
source venv-fortitude/bin/activate
python3 -m pip install "fortitude-lint==$FORTITUDE_VERSION"

- name: Lint Fortran source code
run: |
source venv-fortitude/bin/activate
fortitude --config-file "$SOURCE_CODE_PATH/assets/fortitude_config.toml" check --exit-zero --output-file "$SOURCE_CODE_PATH/source-code-linting.log" --preview "$SOURCE_CODE_PATH"
cat "$SOURCE_CODE_PATH/source-code-linting.log"

- name: Upload Fortran source code linting log
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: source-code-linting-log
path: ${{ env.SOURCE_CODE_PATH }}/source-code-linting.log
retention-days: 7
unit-tests:
name: Build and run unit tests (GCC ${{ matrix.gcc-version }})
timeout-minutes: 10
Expand Down
29 changes: 29 additions & 0 deletions src/dynamics/mpas/assets/fortitude_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[check]
exclude = [
'src/dynamics/mpas/dycore'
]
file-extensions = [
'F',
'f',
'F90',
'f90'
]
# When ignoring a linting rule, a reason should be provided.
ignore = [
'C003', # Temporarily ignored due to lack of support for Fortran 2018 `implicit none (external)` statement
# in the NVIDIA HPC SDK as of version 25.9.
'C182', # Requiring separate allocations and deallocations for each variable is too restrictive.
# Related variables can be grouped together at the discretion of developers.
'S102' # Prefer only one space instead of two.
]
line-length = 132
output-format = 'grouped'
select = [
'ALL'
]

[check.exit-unlabelled-loops]
allow-unnested-loops = true

[check.strings]
quotes = 'single'
312 changes: 226 additions & 86 deletions src/dynamics/mpas/driver/dyn_mpas_subdriver.F90

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/dynamics/mpas/dyn_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,28 @@ module dyn_comp

interface
module subroutine dyn_readnl(namelist_path)
implicit none
character(*), intent(in) :: namelist_path
end subroutine dyn_readnl

module subroutine dyn_init(cam_runtime_opts, dyn_in, dyn_out)
use runtime_obj, only: runtime_options

implicit none
type(runtime_options), intent(in) :: cam_runtime_opts
type(dyn_import_t), intent(in) :: dyn_in
type(dyn_export_t), intent(in) :: dyn_out
end subroutine dyn_init

module subroutine dyn_run()
implicit none
end subroutine dyn_run

module subroutine dyn_final()
implicit none
end subroutine dyn_final

module subroutine dyn_debug_print(level, message, printer)
implicit none
integer, intent(in) :: level
character(*), intent(in) :: message
integer, optional, intent(in) :: printer
Expand Down
Loading