Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5fa991c
add README
Pierre-siddall Nov 13, 2025
af70fd2
Implement fortitude linter with pip
Pierre-siddall Nov 13, 2025
e7cb482
README skeleton and python version number bump
Pierre-siddall Nov 14, 2025
3b833e6
add configuration explaination
Pierre-siddall Nov 14, 2025
26cbbb8
Explain usage in caller workflow
Pierre-siddall Nov 14, 2025
f1e0007
Fix YAML linting
Pierre-siddall Nov 14, 2025
1c97253
Update to stable fortitude version number
Pierre-siddall Nov 14, 2025
855cd5c
Update fortran-lint/README.md
Pierre-siddall Nov 14, 2025
cd6c221
Update fortran-lint/README.md
Pierre-siddall Nov 14, 2025
0d53ee5
Update fortran-lint/README.md
Pierre-siddall Nov 14, 2025
785241d
Update fortran-lint/README.md
Pierre-siddall Nov 14, 2025
c825321
Update fortran-lint/README.md
Pierre-siddall Nov 14, 2025
8b68f8f
optimise workflow using uv
Pierre-siddall Nov 14, 2025
7ed29b5
fix trailing whitespace
Pierre-siddall Nov 14, 2025
9332a29
Setup uv step
Pierre-siddall Nov 14, 2025
b731473
Fix uv setup and caching
Pierre-siddall Nov 14, 2025
485565c
Apply initial fixes raised by sci/tech
Pierre-siddall Nov 17, 2025
630304d
specify target file formats
Pierre-siddall Nov 17, 2025
12654fc
add link to fortitude documentation in README
Pierre-siddall Nov 17, 2025
c3e242f
Condense title
Pierre-siddall Nov 17, 2025
11870ea
Update .github/workflows/fortran-lint.yaml
Pierre-siddall Nov 17, 2025
1f3317c
add input types
Pierre-siddall Nov 17, 2025
d41ebb5
Update .github/workflows/fortran-lint.yaml
Pierre-siddall Nov 17, 2025
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
75 changes: 75 additions & 0 deletions .github/workflows/fortran-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ------------------------------------------------------------------------------
# (c) Crown copyright Met Office. All rights reserved.
# The file LICENCE, distributed with this code, contains details of the terms
# under which the code may be used.
# ------------------------------------------------------------------------------

name: Fortran lint
on:
workflow_call:

inputs:
runner:
description: 'The runner to use for the job'
required: false
default: 'ubuntu-latest'
timeout:
description: 'The maximum time in minutes the job can run for'
required: false
default: 10
python-version:
description: 'The Python version to use'
required: false
default: '3.14'

concurrency:
group: ${{ github.ref}}
Comment thread
Pierre-siddall marked this conversation as resolved.
Outdated
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
fortitude-linting:
name: Fortran lint
runs-on: ${{ inputs.runner }}
timeout-minutes: ${{ inputs.timeout }}

env:
UV_CACHE_DIR: /tmp/.uv_cache

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ inputs.python-version }}
enable-cache: true

- name: restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}

- name: minimize uv cache
run: uv cache clean && uv cache prune || true
Comment thread
Pierre-siddall marked this conversation as resolved.
Outdated

- name: Install Fortitude Linter
run: |
uv pip install fortitude-lint==0.7.3
Comment thread
Pierre-siddall marked this conversation as resolved.
Outdated

- name: Run Fortitude Linter
run: |
output=$(fortitude check)
if [[ -n "$output" ]]; then
echo "$output"
echo "ERROR: Fortran styling issues found."
echo -e "\n Please run 'fortitude check --fix' to fix these"
echo "issues automatically where possible."
exit 1
else
echo "No Fortran styling issues found :) ."
fi
Comment thread
Pierre-siddall marked this conversation as resolved.
Outdated
41 changes: 41 additions & 0 deletions fortran-lint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# GitHub Reusable Workflow to lint fortran using fortitude

This reusable workflow serves as a a generic workflow to lint fortran
code using the fortitude linter.

## Usage

By default this workflow will check all the rules included in fortitude linter.
However, should you wish to check only a certain set of rules in your local repository
you can do this by implementing a `fortitude.toml` file in the top-level/root directory
of your local repository, defining the rules which should be checked when running this
reusable workflow from a caller workflow. The following toml file is an example of
what your `fortitude.toml` file could look like:

### Example fortitude configuration
Comment thread
Pierre-siddall marked this conversation as resolved.

```toml
[check]
select = ["S", "T"]
ignore = ["S001", "S051"]
line-length = 132
```

In order to use this reusable workflow you should implement a calling workflow as
Comment thread
Pierre-siddall marked this conversation as resolved.
a YAML file in your `.github/workflows` directory containing the follwing:

### Example usage in caller workflow
Comment thread
Pierre-siddall marked this conversation as resolved.

```yaml
steps:
- name: Lint Fortran
uses: MetOffice/growss/.github/workflows/fortan-lint.yaml@main

with:
runner: The runner to use for the job (ubuntu-latest)
timeout: The maximum time in minutes the job can run for (10)
python-version: The Python version to use (3.14)
```

Where runner,timeout and python-version are all appropriately defined inputs
to the workflow as defined in `MetOffice/growss/.github/workflows/fortan-lint.yaml`