|
| 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 |
0 commit comments