Skip to content

Make constituent index lookup routines case insensitive #98

Make constituent index lookup routines case insensitive

Make constituent index lookup routines case insensitive #98

name: Codee format Fortran
on:
pull_request:
branches: [develop]
types: [opened, synchronize, labeled, unlabeled]
env:
CODEE_VERSION: 2026.1.2
# Only needed when fixing formatting automatically, but this only
# works for pull requests from the same repo, not from a fork
#permissions:
# contents: write
# pull-requests: write
jobs:
format:
name: Check Fortran formatting
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check formatting of modified Fortran files
run: |
git remote -v show
git fetch origin ${{ github.base_ref }}
MODIFIED_FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }}...HEAD -- '*.f90' '*.F90' '*.f' '*.F')
if [[ "${MODIFIED_FILES}" == "" ]]; then
exit 0
fi
# Filter list of modified files to exclude certain files
EXCLUDED_FILES=(
# Exclude all .F90 files in test/unit_tests/**
test/unit_tests/sample_files/test_fortran_to_metadata.F90
test/unit_tests/sample_files/fortran_files/array_parsing_test.F90
test/unit_tests/sample_files/fortran_files/linebreak_test.F90
test/unit_tests/sample_files/fortran_files/long_string_test.F90
test/unit_tests/sample_files/fortran_files/comments_test.F90
test/unit_tests/sample_host_files/ddt1_plus.F90
test/unit_tests/sample_host_files/mismatch_hdim_mod.F90
test/unit_tests/sample_host_files/ddt1.F90
test/unit_tests/sample_host_files/ddt2_extra_var.F90
test/unit_tests/sample_host_files/ddt2.F90
test/unit_tests/sample_host_files/ddt_data1_mod.F90
test/unit_tests/sample_host_files/data1_mod.F90
test/unit_tests/sample_scheme_files/CCPPnotset_var_missing_in_meta.F90
test/unit_tests/sample_scheme_files/CCPPeq1_var_missing_in_meta.F90
test/unit_tests/sample_scheme_files/missing_fort_header.F90
test/unit_tests/sample_scheme_files/mismatch_intent.F90
test/unit_tests/sample_scheme_files/CCPPgt1_var_in_fort_meta.F90
test/unit_tests/sample_scheme_files/mismatch_hdim.F90
test/unit_tests/sample_scheme_files/CCPPeq1_var_missing_in_fort.F90
test/unit_tests/sample_scheme_files/temp_adjust.F90
test/unit_tests/sample_scheme_files/CCPPeq1_var_in_fort_meta.F90
test/unit_tests/sample_scheme_files/reorder.F90
test/unit_tests/sample_scheme_files/invalid_dummy_arg.F90
test/unit_tests/sample_scheme_files/invalid_subr_stmnt.F90
test/unit_tests/sample_scheme_files/missing_arg_table.F90
)
FILTERED_FILES=()
while IFS= read -r file; do
skip=false
for excluded in "${EXCLUDED_FILES[@]}"; do
if [[ "$file" == "$excluded" ]]; then
skip=true
break
fi
done
if [[ "$skip" == false ]]; then
FILTERED_FILES+=("$file")
fi
done <<< "$MODIFIED_FILES"
echo "MODIFIED_FILES: ${MODIFIED_FILES[@]}"
echo "EXCLUDED_FILES: ${EXCLUDED_FILES[@]}"
echo "FILTERED_FILES: ${FILTERED_FILES[@]}"
if [[ "${FILTERED_FILES}" == "" ]]; then
exit 0
fi
#
echo "Installing Codee ${CODEE_VERSION} ..."
wget https://codee.com/release/codee-${CODEE_VERSION}-linux-x86_64.tar.gz
tar -xf codee-${CODEE_VERSION}-linux-x86_64.tar.gz
export PATH="${PWD}/codee-${CODEE_VERSION}-linux-x86_64/bin:${PATH}"
#
codee format --accept-eula --verbose ${FILTERED_FILES}
REFORMATTED_FILES=$(git diff --name-only --diff-filter=d)
if [[ "${REFORMATTED_FILES}" == "" ]]; then
exit 0
fi
echo "Formatting issues detected. Run 'codee format' locally or apply the following diff manually:"
git diff
exit 1