Skip to content

Commit daa14fc

Browse files
chore: polish lint configs and workflow metadata (#30)
1 parent 90ea7bb commit daa14fc

14 files changed

Lines changed: 243 additions & 29 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# workflows/ci.yml
2+
#
3+
# CI
4+
# Run lint, test matrix, and example checks for pull requests and main.
5+
16
name: CI
27

38
on:

.github/workflows/lint-bash.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# workflows/lint-bash.yml
2+
#
3+
# Lint Bash
4+
# Lint and enforce good practices for Bash scripts.
5+
6+
name: Lint Bash
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
paths:
12+
- "**/*.sh"
13+
- ".github/workflows/lint-bash.yml"
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: lint-bash-${{ github.head_ref || github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
lint-bash:
22+
name: Lint Bash Scripts
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout Git Repository
27+
uses: actions/checkout@v6
28+
29+
- name: Set up Python Environment
30+
uses: actions/setup-python@v6
31+
with:
32+
python-version: "3.11"
33+
34+
- name: Install Bash Linters
35+
run: |
36+
pip install beautysh
37+
sudo apt-get update
38+
sudo apt-get install -y shellcheck
39+
40+
- name: Run Beautysh
41+
run: |
42+
shopt -s globstar nullglob
43+
if compgen -G "**/*.sh" > /dev/null; then
44+
beautysh **/*.sh --indent-size 2 --check
45+
fi
46+
shopt -u globstar nullglob
47+
48+
- name: Check Bash Script Shebang
49+
run: |
50+
while IFS= read -r -d '' file; do
51+
if head -n 1 "$file" | grep -Eq '^#!/usr/bin/env bash$|^#!/bin/bash$'; then
52+
echo "[bash shebang -> Present] $file"
53+
else
54+
echo "[bash shebang -> NOT FOUND] $file"
55+
exit 1
56+
fi
57+
done < <(find . -name '*.sh' -print0)
58+
59+
- name: Check Bash Scripts for Pipefail
60+
run: |
61+
while IFS= read -r -d '' file; do
62+
if grep -q \
63+
-e "^[[:space:]]*set -euo pipefail$" \
64+
-e "^[[:space:]]*set -Eeuo pipefail$" \
65+
-e "^[[:space:]]*# @paradedb-skip-check-pipefail$" \
66+
"$file"; then
67+
echo "[pipefail -> Present] $file"
68+
else
69+
echo "[pipefail -> NOT FOUND] $file"
70+
exit 1
71+
fi
72+
done < <(find . -name '*.sh' -print0)
73+
74+
- name: Run ShellCheck
75+
run: |
76+
while IFS= read -r -d '' file; do
77+
shellcheck -x "$file"
78+
done < <(find . -name '*.sh' -print0)

.github/workflows/lint-format.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# workflows/lint-format.yml
2+
#
3+
# Lint Format
4+
# Lint file line endings and trailing whitespace.
5+
6+
name: Lint Format
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: lint-format-${{ github.head_ref || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint-format:
19+
name: Lint File Endings & Trailing Whitespaces
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout Git Repository
24+
uses: actions/checkout@v6
25+
26+
- name: Check for CRLF Files
27+
run: |
28+
FILES=$(git ls-files --eol | grep crlf || true)
29+
if [[ -n "$FILES" ]]; then
30+
echo "The following files have incorrect line endings:"
31+
echo "$FILES"
32+
exit 1
33+
fi
34+
35+
- name: Check for Trailing Whitespaces
36+
run: |
37+
FILES=$(git grep -Ilr '[[:blank:]]$' -- . || true)
38+
if [[ -n "$FILES" ]]; then
39+
echo "The following files have trailing whitespaces:"
40+
echo "$FILES"
41+
exit 1
42+
fi
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# workflows/lint-markdown.yml
2+
#
3+
# Lint Markdown
4+
# Lint Markdown files using markdownlint and Prettier.
5+
6+
name: Lint Markdown
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
paths:
12+
- "**/*.md"
13+
- "**/*.mdx"
14+
- ".markdownlint.yaml"
15+
- ".prettierignore"
16+
- ".prettierrc"
17+
- ".github/workflows/lint-markdown.yml"
18+
workflow_dispatch:
19+
20+
concurrency:
21+
group: lint-markdown-${{ github.head_ref || github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
lint-markdown:
26+
name: Lint Markdown Files
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout Git Repository
31+
uses: actions/checkout@v6
32+
33+
- name: Set up NodeJS Environment
34+
uses: actions/setup-node@v6
35+
36+
- name: Install Markdown Linters
37+
run: npm install -g prettier markdownlint-cli
38+
39+
- name: Run Markdown Lint
40+
run: markdownlint '**/*.md'
41+
42+
- name: Run Prettier
43+
run: prettier --check '{**/*.md,**/*.mdx}' --ignore-path .prettierignore

.github/workflows/lint-yaml.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# workflows/lint-yaml.yml
2+
#
3+
# Lint YAML
4+
# Lint YAML files using Prettier.
5+
6+
name: Lint YAML
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
paths:
12+
- "**/*.yml"
13+
- "**/*.yaml"
14+
- ".github/workflows/lint-yaml.yml"
15+
- ".prettierignore"
16+
- ".prettierrc"
17+
workflow_dispatch:
18+
19+
concurrency:
20+
group: lint-yaml-${{ github.head_ref || github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
lint-yaml:
25+
name: Lint YAML Files
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout Git Repository
30+
uses: actions/checkout@v6
31+
32+
- name: Set up NodeJS Environment
33+
uses: actions/setup-node@v6
34+
35+
- name: Install Prettier
36+
run: npm install -g prettier
37+
38+
- name: Check YAML Formatting
39+
run: prettier --check "**/*.{yml,yaml}" --ignore-path .prettierignore

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# workflows/release.yml
2+
#
3+
# Release
4+
# Build, tag, publish, and release rails-paradedb from a validated version.
5+
16
name: Release
27

38
on:

.markdownlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MD013: false # Line length

.markdownlint.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
examples/hybrid_rrf/mock_items_embeddings.csv

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": false
3+
}

0 commit comments

Comments
 (0)