From e46a76a5d924f4a3a2c227a236eb16957e5f3226 Mon Sep 17 00:00:00 2001 From: Javier Jorge Date: Fri, 14 Aug 2026 14:34:03 -0300 Subject: [PATCH 1/2] feat: add local linting workflow with pre-push git hook and act support --- CONTRIBUTING.md | 6 ++++-- tools/ci/lint/pre-push.sample | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 tools/ci/lint/pre-push.sample diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f053d203..57a27f65e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,11 +104,13 @@ The general workflow for branching is as follows: 6. Make sure the tests are still running with success. -7. Push the changes to `origin` (i.e. your fork) +7. Run lint locally or set up the pre-push hook: to set up a git pre-push hook that runs lint locally, copy `tools/ci/lint/pre-push.sample` to `.git/hooks/pre-push` and make it executable. + +8. Push the changes to `origin` (i.e. your fork) ```git push origin ``` -8. Create a new Pull Request (see below). +9. Create a new Pull Request (see below). #### Creating A Pull Request diff --git a/tools/ci/lint/pre-push.sample b/tools/ci/lint/pre-push.sample new file mode 100755 index 000000000..795ddc981 --- /dev/null +++ b/tools/ci/lint/pre-push.sample @@ -0,0 +1,23 @@ +#!/bin/sh +# Run the lint workflow from .github/workflows/lint.yml locally using 'act' +# Requires: https://github.com/nektos/act (and Docker) +# +# Install act: +# curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash -s -- -b /usr/local/bin +# On first run, act will ask for an image size. Select "Medium" (~500MB), it is enough. +# +# Skip hook: git push --no-verify + +# Find act: check PATH first, then common local install locations +ACT="$(command -v act 2>/dev/null)" \ + || ACT="$(git rev-parse --show-toplevel)/bin/act" \ + || ACT="" + +if [ ! -x "$ACT" ]; then + echo "Error: 'act' not found. Install it with:" + echo " curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash -s -- -b /usr/local/bin" + exit 1 +fi + +echo "=== Running lint workflow locally ===" +"$ACT" push -W .github/workflows/lint.yml From 4c26e639e44d40b00b22a13bbc971214ee671ccf Mon Sep 17 00:00:00 2001 From: Javier Jorge Date: Fri, 14 Aug 2026 14:44:55 -0300 Subject: [PATCH 2/2] add linting to TESTSING.md --- TESTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TESTING.md b/TESTING.md index 198d1bfec..7a2d1c285 100644 --- a/TESTING.md +++ b/TESTING.md @@ -123,6 +123,16 @@ foo.search_paths = {"/usr/lib/lua/lime/hwd/*.lua"} Coverage is measured using the [luacov](https://keplerproject.github.io/luacov/) library each time the tests are run. The results statistics are merged at `./luacov.stats.out` and a human friendly report is generated at `luacov.report.out`. +## Linting + +To ensure code quality and consistency, we have a lint workflow that runs on GitHub Actions. +You can also run the lint workflow locally before pushing your changes. + +To easily run lint locally before pushing, we provide a git pre-push hook: +* Copy `tools/ci/lint/pre-push.sample` to `.git/hooks/pre-push` +* Make it executable: `chmod +x .git/hooks/pre-push` +* This script requires [act](https://github.com/nektos/act) and Docker to run the GitHub Actions workflow locally. + ## Under the hood: tools in detail As one of the goals is that it must be easy for developers to write, modify and run the tests we created some simple tools to do this: