Skip to content

Commit deed214

Browse files
Merge branch 'main' into optimise-build-docs
2 parents ca9b4ad + 1669fc9 commit deed214

4 files changed

Lines changed: 122 additions & 5 deletions

File tree

.github/workflows/build-sphinx-docs.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ on:
1515
type: string
1616
default: '3.14'
1717
docs-directory:
18-
description: 'Directory containing the documentation to build'
18+
description: 'Directory containing the documentation source to build'
1919
required: false
2020
type: string
21-
default: './documentation'
21+
default: 'documentation'
2222
requirements:
2323
description: 'Path to the requirements file to install dependencies from'
2424
required: true
@@ -33,7 +33,7 @@ on:
3333
description: 'Directory to output the html documentation to'
3434
required: false
3535
type: string
36-
default: '${{inputs.docs-directory}}/build'
36+
default: 'build'
3737
runner:
3838
description: 'The runner to use for the job'
3939
required: false
@@ -49,7 +49,7 @@ jobs:
4949
build-sphinx-docs:
5050
name: Build Sphinx Docs
5151
runs-on: ${{ inputs.runner }}
52-
52+
timeout-minutes: ${{ inputs.timeout }}
5353
env:
5454
DOCS_DIR: ${{ inputs.docs-directory }}
5555
REQS_FILE: ${{ inputs.requirements }}
@@ -79,6 +79,9 @@ jobs:
7979
- name: Install dependencies
8080
run: uv pip install -r "$REQS_FILE"
8181

82+
- name: Minimize pip cache
83+
run: python3 -m pip cache remove '*' || true
84+
8285
- name: Lint Sphinx docs
8386
working-directory: ${{ env.DOCS_DIR }}
8487
run: sphinx-lint .
@@ -88,7 +91,6 @@ jobs:
8891
run: |
8992
make html SPHINXOPTS="$SPHINX_OPTS" BUILDDIR="$BUILD_DIR"
9093
91-
9294
- name: Upload artifact to GitHub Pages
9395
if: ${{ (github.event_name == 'push' || github.event_name == 'merge_group') && github.ref_name == 'main'}}
9496
uses: actions/upload-pages-artifact@v4
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# ------------------------------------------------------------------------------
2+
# (c) Crown copyright Met Office. All rights reserved.
3+
# The file LICENCE, distributed with this code, contains details of the terms
4+
# under which the code may be used.
5+
# ------------------------------------------------------------------------------
6+
7+
name: Fortran lint
8+
on:
9+
workflow_call:
10+
11+
inputs:
12+
runner:
13+
description: 'The runner to use for the job'
14+
required: false
15+
type: string
16+
default: 'ubuntu-latest'
17+
timeout:
18+
description: 'The maximum time in minutes the job can run for'
19+
required: false
20+
type: number
21+
default: 10
22+
python-version:
23+
description: 'The Python version to use'
24+
required: false
25+
type: string
26+
default: '3.14'
27+
28+
concurrency:
29+
group: ${{ github.ref }}
30+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
31+
32+
jobs:
33+
fortitude-linting:
34+
name: Fortran lint
35+
runs-on: ${{ inputs.runner }}
36+
timeout-minutes: ${{ inputs.timeout }}
37+
38+
env:
39+
UV_CACHE_DIR: /tmp/.uv_cache
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v5
44+
45+
- name: Setup uv
46+
uses: astral-sh/setup-uv@v7
47+
with:
48+
python-version: ${{ inputs.python-version }}
49+
enable-cache: true
50+
51+
- name: restore uv cache
52+
uses: actions/cache@v4
53+
with:
54+
path: ${{ env.UV_CACHE_DIR }}
55+
key: ${{ runner.os }}-${{ hashFiles('uv.lock') }}-fortitude-0.7.3
56+
restore-keys: |
57+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
58+
uv-${{ runner.os }}
59+
60+
- name: Install Fortitude Linter
61+
run: uv pip install fortitude-lint==0.7.3
62+
63+
- name: Run Fortitude Linter
64+
run: fortitude check --respect-gitignore --show-fixes --file-extensions=f90,F90,x90,X90 .
65+
66+
- name: minimize uv cache
67+
run: uv cache prune --ci

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# GRoWSS - GitHub Reusable Workflows for Simulation Systems :recycle:
22

3+
[![CI](https://github.com/MetOffice/growss/actions/workflows/validate.yaml/badge.svg?branch=main)](https://github.com/MetOffice/growss/actions/workflows/validate.yaml)
4+
35
Placeholder for a collection of
46
[reusable workflows](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows)
57
for the Met Office Simulation Systems Repositories.

fortran-lint/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Fortran Linting workflow (using Fortitude)
2+
3+
This reusable workflow serves as a a generic workflow to lint fortran
4+
code using the fortitude linter.
5+
6+
## Usage
7+
8+
By default this workflow will check all the rules included in fortitude linter.
9+
However, should you wish to check only a certain set of rules in your local repository
10+
you can do this by implementing a `fortitude.toml` file in the top-level/root directory
11+
of your local repository, defining the rules which should be checked when running this
12+
reusable workflow from a caller workflow. The following toml file is an example of
13+
what your `fortitude.toml` file could look like:
14+
15+
### Example fortitude configuration
16+
17+
```toml
18+
[check]
19+
select = ["S", "T"]
20+
ignore = ["S001", "S051"]
21+
line-length = 132
22+
```
23+
24+
In order to use this reusable workflow you should implement a calling workflow as
25+
a YAML file in your `.github/workflows` directory containing the follwing:
26+
27+
### Example usage in caller workflow
28+
29+
```yaml
30+
steps:
31+
- name: Lint Fortran
32+
uses: MetOffice/growss/.github/workflows/fortan-lint.yaml@main
33+
34+
with:
35+
runner: The runner to use for the job (ubuntu-latest)
36+
timeout: The maximum time in minutes the job can run for (10)
37+
python-version: The Python version to use (3.14)
38+
```
39+
40+
Where runner,timeout and python-version are all appropriately defined inputs
41+
to the workflow as defined in `MetOffice/growss/.github/workflows/fortan-lint.yaml`
42+
43+
### Further details
44+
Fortitude is a fortran linter developed and maintained by PlasmaFAIR. For further details on
45+
how to configure your `fortitude.toml` file and how to interpret error messages given by this
46+
reusable workflow please refer to the [fortitude doumentation](https://fortitude.readthedocs.io/en/latest/)

0 commit comments

Comments
 (0)