Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
76 changes: 76 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI
# This workflow is used for validating code quality on growss PRs.

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

permissions: read-all

jobs:

validate:
name: QC
runs-on: ubuntu-24.04
timeout-minutes: 5

env:
UV_CACHE_DIR: /tmp/.uv-cache
UV_PYTHON: "3.14"

steps:
- uses: actions/checkout@v5

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

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

- name: Install dependencies
run: uv sync

- name: YAML Lint
run: uv run yamllint -s .

- name: Python Lint
if: always()
run: uv run ruff check --respect-gitignore .
- name: Python Format Check
if: always()
run: uv run ruff format --check --diff -s --respect-gitignore .

- name: Shell Check
if: always()
shell: bash
run: |
mapfile -d '' potential_files < <(
find . -type f \( -name "*.*sh" -o ! -name "*.*" \) \
-not -path "*.git/*" -not -path "*.venv/*" -print0
)
if [ ${#potential_files[@]} -eq 0 ]; then
echo "No shell scripts to check."
exit 0
fi
printf "%s\0" "${potential_files[@]}" \
| xargs -0 file | grep "shell script" | cut -d: -f1 \
| xargs -r uv run shellcheck -S warning \
&& echo "All checks passed!"
continue-on-error: true

- name: Minimize uv cache
run: uv cache prune --ci
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# uv
.venv
uv.lock

# Jetbrains
.idea

# vscode
.vscode

# Backup files
.#*
\#*#
*~

# Python
*.py[cod]
*.pyo
__pycache__
.pytest_cache
*.coverage
11 changes: 11 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
extends: default

ignore: |
.venv/
.svn/

rules:
document-start: disable
line-length: disable
truthy: disable
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
Placeholder for a collection of
[reusable workflows](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows)
for the Met Office Simulation Systems Repositories.

## Notes for contributors

When contributing to this repository, your changes will be automatically
validated for YAML, Python, and Shell script correctness. We recommend manually
checking your files before opening a pull request. For example, you can run
`yamllint workflow-file.yaml` to verify YAML syntax.
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[project]
name = "growss"
version = "0.1.0"
description = "GitHub Reusable Workflows for Simulation Systems"
readme = "README.md"
requires-python = ">=3.12.9"
dependencies = [
"ruff==0.14.4",
"shellcheck-py==0.11.0.1",
"yamllint==1.37.1",
]
Loading