From 84a31977017b6466295c598cd57fad6b7075bca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20No=C3=ABl?= Date: Sun, 15 Mar 2026 13:14:09 -0700 Subject: [PATCH] chore: align setup and workflow automation --- .github/workflows/lint-format.yml | 30 ++++++++++++++++++++--------- .github/workflows/lint-markdown.yml | 2 +- .github/workflows/lint-yaml.yml | 2 +- .rubocop.yml | 2 ++ CONTRIBUTING.md | 10 +++++----- bin/setup | 5 +---- scripts/run_paradedb.sh | 2 +- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index b127e6c..ef19de2 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -46,13 +46,25 @@ jobs: exit 1 fi - - name: Print Modified Files + - name: Check for Missing Final Newlines run: | - FILES=$(git ls-files --modified) - if [[ ! -z "$FILES" ]]; then - echo "The following files have incorrect trailing newlines:" - echo "$FILES" - echo "Please fix them using:" - echo -e 'if [[ -f "$1" ]]; then\n echo -n "$1"\n if (diff /dev/null "$1" || true) | tail -1 | grep -q "^\\ No newline"; then\n echo >> "$1"\n echo "...fixed"\n else\n echo ""\n fi\nfi' - false - fi + python3 - <<'PY' + import pathlib + import subprocess + import sys + + missing = [] + for name in subprocess.check_output(["git", "ls-files"], text=True).splitlines(): + path = pathlib.Path(name) + if not path.is_file(): + continue + data = path.read_bytes() + if data and not data.endswith(b"\n"): + missing.append(name) + + if missing: + print("The following files are missing a trailing newline:") + for name in missing: + print(name) + sys.exit(1) + PY diff --git a/.github/workflows/lint-markdown.yml b/.github/workflows/lint-markdown.yml index 8b58131..8dda0c5 100644 --- a/.github/workflows/lint-markdown.yml +++ b/.github/workflows/lint-markdown.yml @@ -34,7 +34,7 @@ jobs: uses: actions/setup-node@v6 - name: Install Prettier and markdownlint - run: npm install -g prettier markdownlint-cli + run: npm install -g prettier@3.5.3 markdownlint-cli@0.45.0 - name: Run Markdown Lint run: markdownlint "**/*.md" diff --git a/.github/workflows/lint-yaml.yml b/.github/workflows/lint-yaml.yml index bc0519a..edde909 100644 --- a/.github/workflows/lint-yaml.yml +++ b/.github/workflows/lint-yaml.yml @@ -33,7 +33,7 @@ jobs: uses: actions/setup-node@v6 - name: Install Prettier - run: npm install -g prettier + run: npm install -g prettier@3.5.3 - name: Check YAML Formatting run: prettier --check "**/*.{yml,yaml}" --ignore-path .prettierignore diff --git a/.rubocop.yml b/.rubocop.yml index e8cfb19..345ab8e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,5 @@ AllCops: # Avoid RuboCop warnings when new cops are released. NewCops: disable + SuggestExtensions: false + TargetRubyVersion: 3.2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed4e517..0cdd477 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,12 +34,12 @@ git clone https://github.com/paradedb/rails-paradedb.git cd rails-paradedb bundle install -prek install -f +pre-commit install -f ``` ### Running Tests -Unit tests: +Unit specs (DB-backed; starts local ParadeDB unless `CI` is set): ```bash bash scripts/run_unit_tests.sh @@ -59,13 +59,13 @@ bash scripts/run_unit_tests.sh spec/user_api_unit_spec.rb ### Linting and Formatting -This repository enforces markdown/style checks via `prek` and +This repository enforces markdown/style checks via `pre-commit` and `.pre-commit-config.yaml`. Common commands: ```bash -prek run --all-files -prek install -f +pre-commit run --all-files +pre-commit install -f ``` If you change Ruby code, keep style consistent with existing files and tests. diff --git a/bin/setup b/bin/setup index 6af5520..0f1b630 100755 --- a/bin/setup +++ b/bin/setup @@ -6,13 +6,10 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" echo "==> Installing dependencies" -if [[ "${PARADEDB_WITH_PG:-0}" == "1" ]]; then - echo " PARADEDB_WITH_PG=1 (installing pg gem)" -fi bundle install echo "" echo "==> Done" echo "Run unit tests: scripts/run_unit_tests.sh" -echo "Run integration tests (requires ParadeDB): PARADEDB_WITH_PG=1 scripts/run_integration_tests.sh" +echo "Run integration tests (requires ParadeDB): scripts/run_integration_tests.sh" diff --git a/scripts/run_paradedb.sh b/scripts/run_paradedb.sh index f3cff32..cb12773 100755 --- a/scripts/run_paradedb.sh +++ b/scripts/run_paradedb.sh @@ -8,7 +8,7 @@ else RUNNING=0 fi -IMAGE="${PARADEDB_IMAGE:-paradedb/paradedb:latest-pg18}" +IMAGE="${PARADEDB_IMAGE:-paradedb/paradedb:0.21.10-pg18}" CONTAINER_NAME="${PARADEDB_CONTAINER_NAME:-paradedb-integration}" # Allow overriding connection details via env vars