diff --git a/.github/workflows/fortitude.yaml b/.github/workflows/fortitude.yaml new file mode 100644 index 0000000..6700b70 --- /dev/null +++ b/.github/workflows/fortitude.yaml @@ -0,0 +1,52 @@ +on: + workflow_call: + inputs: + TIMEOUT: + type: number + default: 10 + description: "Timeout for the job in minutes" + FAIL: + type: boolean + default: true + description: "Fail the workflow on fortitude issues" + +jobs: + fortitude: + runs-on: ubuntu-24.04 + timeout-minutes: ${{ inputs.TIMEOUT }} + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" + + - name: Install fortitude + run: pip install fortitude-lint==0.7.5 + + - name: Get fortitude config + run: | + LOCAL_CONFIG_FILE="fortitude.toml" + GLOBAL_CONFIG_URL="https://raw.githubusercontent.com/scritical/.github/main/fortitude.toml" + + if [[ ! -f "$LOCAL_CONFIG_FILE" ]]; then + echo "Downloading global fortitude config..." + wget "$GLOBAL_CONFIG_URL" -O "$LOCAL_CONFIG_FILE" || echo "No global config found, using defaults" + fi + + - name: Run fortitude + run: | + CONFIG_FILE="fortitude.toml" + CONFIG_ARG="" + if [[ -f "$CONFIG_FILE" ]]; then + CONFIG_ARG="--config-file $CONFIG_FILE" + fi + + # Run fortitude with appropriate fail behavior + if [[ ${{ inputs.FAIL }} == true ]]; then + fortitude $CONFIG_ARG check + else + fortitude $CONFIG_ARG check --exit-zero + fi \ No newline at end of file diff --git a/fortitude.toml b/fortitude.toml new file mode 100644 index 0000000..f9a84ac --- /dev/null +++ b/fortitude.toml @@ -0,0 +1,14 @@ +[check] +line-length = 120 +# Core checks +select = ["E", "C", "OB", "MOD", "S", "FORT"] +# Style preferences +ignore = [ + "C003", # implicit-external-procedures: Only valid for Fortran 2018+ + "C132", # default-public-accessibility + "S201", # superfluous-implicit-none + "C141", # missing-exit-or-cycle-label + "C121" # use-all +] +# Exclude differentiated files by pattern +exclude = ["*_b.f*", "*_d.f*"] \ No newline at end of file