This is an automated email from the ASF dual-hosted git repository.
piotr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new 13143871b feat(ci): add TOML formatting with taplo (#2482)
13143871b is described below
commit 13143871be69897762f4f5dcd574f3841dde148b
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Fri Dec 12 18:10:46 2025 +0100
feat(ci): add TOML formatting with taplo (#2482)
---
.github/workflows/_common.yml | 30 ++++
.pre-commit-config.yaml | 8 +
.taplo.toml | 75 +++++++++
cliff.toml | 2 +-
.../runtime/example_config/connectors/iceberg.toml | 1 -
core/journal/Cargo.toml | 1 -
core/message_bus/Cargo.toml | 2 -
foreign/python/Cargo.toml | 5 +-
scripts/ci/taplo.sh | 187 +++++++++++++++++++++
9 files changed, 305 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/_common.yml b/.github/workflows/_common.yml
index d13b09f52..51b8277a6 100644
--- a/.github/workflows/_common.yml
+++ b/.github/workflows/_common.yml
@@ -205,6 +205,26 @@ jobs:
- name: Check for trailing newline in changed text files
run: ./scripts/ci/trailing-newline.sh --check --ci
+ toml-format:
+ name: Check TOML formatting
+ runs-on: ubuntu-latest
+ env:
+ IGGY_CI_BUILD: true
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Need full history to get diff
+
+ - name: Install taplo
+ run: |
+ curl -fsSL
https://github.com/tamasfe/taplo/releases/download/0.10.0/taplo-linux-x86_64.gz
| gunzip > taplo
+ chmod +x taplo
+ sudo mv taplo /usr/local/bin/
+
+ - name: Check TOML formatting
+ run: ./scripts/ci/taplo.sh --check --ci
+
summary:
name: Common checks summary
needs:
@@ -217,6 +237,7 @@ jobs:
shellcheck,
trailing-whitespace,
trailing-newline,
+ toml-format,
]
if: always()
runs-on: ubuntu-latest
@@ -311,6 +332,15 @@ jobs:
echo "| ⏭️ Trailing Newline | $TRAILING_NL | Check skipped |" >>
$GITHUB_STEP_SUMMARY
fi
+ TOML_FORMAT="${{ needs.toml-format.result }}"
+ if [ "$TOML_FORMAT" = "success" ]; then
+ echo "| ✅ TOML Format | success | All TOML files properly
formatted |" >> $GITHUB_STEP_SUMMARY
+ elif [ "$TOML_FORMAT" = "failure" ]; then
+ echo "| ❌ TOML Format | failure | TOML formatting issues found |"
>> $GITHUB_STEP_SUMMARY
+ else
+ echo "| ⏭️ TOML Format | $TOML_FORMAT | Check skipped |" >>
$GITHUB_STEP_SUMMARY
+ fi
+
echo "" >> $GITHUB_STEP_SUMMARY
# Overall status
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e0919768b..0d195b4e7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -84,6 +84,14 @@ repos:
types: [text]
pass_filenames: false
+ - id: taplo
+ name: taplo (TOML format)
+ entry: ./scripts/ci/taplo.sh
+ args: ["--fix", "--staged"]
+ language: system
+ types: [toml]
+ pass_filenames: false
+
# Rust
- repo: local
hooks:
diff --git a/.taplo.toml b/.taplo.toml
new file mode 100644
index 000000000..d8c90d162
--- /dev/null
+++ b/.taplo.toml
@@ -0,0 +1,75 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Taplo configuration for TOML formatting
+# https://taplo.tamasfe.dev/configuration/formatter-options.html
+
+[formatting]
+# Align consecutive entries vertically
+align_entries = false
+
+# Don't align inline comments
+align_comments = false
+
+# Put trailing commas in multi-line arrays
+array_trailing_comma = true
+
+# Expand arrays onto multiple lines if they exceed column width
+array_auto_expand = true
+
+# Collapse arrays into single line if they fit
+array_auto_collapse = false
+
+# Maximum column width
+column_width = 100
+
+# Keep inline tables compact (no spaces around braces)
+compact_inline_tables = false
+
+# Indentation string (4 spaces to match Rust convention)
+indent_string = " "
+
+# Add extra indentation for nested table headers
+indent_tables = false
+
+# Don't reorder keys (preserve manual ordering)
+reorder_keys = false
+
+# Reorder array values alphabetically
+reorder_arrays = false
+
+# Maximum allowed blank lines
+allowed_blank_lines = 1
+
+# Always end files with newline
+trailing_newline = true
+
+# CRLF line endings (false = LF)
+crlf = false
+
+# Files to include
+include = [
+ "**/*.toml",
+]
+
+# Files to exclude
+exclude = [
+ "target/**",
+ "node_modules/**",
+ ".git/**",
+ "venv/**",
+]
diff --git a/cliff.toml b/cliff.toml
index 5a00c822d..e68d16a81 100644
--- a/cliff.toml
+++ b/cliff.toml
@@ -84,4 +84,4 @@ filter_commits = false
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
-sort_commits = "newest"
\ No newline at end of file
+sort_commits = "newest"
diff --git a/core/connectors/runtime/example_config/connectors/iceberg.toml
b/core/connectors/runtime/example_config/connectors/iceberg.toml
index bf5e55d92..2eaff0dbb 100644
--- a/core/connectors/runtime/example_config/connectors/iceberg.toml
+++ b/core/connectors/runtime/example_config/connectors/iceberg.toml
@@ -44,7 +44,6 @@ store_secret_access_key = "password"
store_region = "us-east-1"
store_class = "s3"
-
[transforms.add_fields]
enabled = true
diff --git a/core/journal/Cargo.toml b/core/journal/Cargo.toml
index 74cf4bf92..dd01a0f1a 100644
--- a/core/journal/Cargo.toml
+++ b/core/journal/Cargo.toml
@@ -28,4 +28,3 @@ repository = "https://github.com/apache/iggy"
readme = "../../../README.md"
[dependencies]
-
diff --git a/core/message_bus/Cargo.toml b/core/message_bus/Cargo.toml
index 4286a3a8e..b8bcdf15f 100644
--- a/core/message_bus/Cargo.toml
+++ b/core/message_bus/Cargo.toml
@@ -30,5 +30,3 @@ readme = "../../../README.md"
[dependencies]
iggy_common = { workspace = true }
rand = { workspace = true }
-
-
diff --git a/foreign/python/Cargo.toml b/foreign/python/Cargo.toml
index d7e76a402..5d1b1b4d7 100644
--- a/foreign/python/Cargo.toml
+++ b/foreign/python/Cargo.toml
@@ -19,7 +19,10 @@
name = "apache-iggy"
version = "0.6.1-dev1"
edition = "2021"
-authors = ["Dario Lencina Talarico <[email protected]>", "Albin
Skott <[email protected]>"]
+authors = [
+ "Dario Lencina Talarico <[email protected]>",
+ "Albin Skott <[email protected]>",
+]
license = "Apache-2.0"
description = "Apache Iggy is the persistent message streaming platform
written in Rust, supporting QUIC, TCP and HTTP transport protocols, capable of
processing millions of messages per second."
documentation = "https://iggy.apache.org/docs/"
diff --git a/scripts/ci/taplo.sh b/scripts/ci/taplo.sh
new file mode 100755
index 000000000..7240368c2
--- /dev/null
+++ b/scripts/ci/taplo.sh
@@ -0,0 +1,187 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Default values
+MODE="check"
+FILE_MODE="staged"
+FILES=()
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --check)
+ MODE="check"
+ shift
+ ;;
+ --fix)
+ MODE="fix"
+ shift
+ ;;
+ --staged)
+ FILE_MODE="staged"
+ shift
+ ;;
+ --ci)
+ FILE_MODE="ci"
+ shift
+ ;;
+ --all)
+ FILE_MODE="all"
+ shift
+ ;;
+ --help|-h)
+ echo "Usage: $0 [--check|--fix] [--staged|--ci|--all] [files...]"
+ echo ""
+ echo "Modes:"
+ echo " --check Check TOML formatting (default)"
+ echo " --fix Format TOML files"
+ echo ""
+ echo "File selection:"
+ echo " --staged Check staged files (default, for git hooks)"
+ echo " --ci Check files changed in PR (for CI)"
+ echo " --all Check all TOML files"
+ echo " [files] Check specific files"
+ exit 0
+ ;;
+ -*)
+ echo "Unknown option: $1"
+ echo "Use --help for usage information"
+ exit 1
+ ;;
+ *)
+ # Treat as file argument
+ FILES+=("$1")
+ shift
+ ;;
+ esac
+done
+
+# Check if taplo is installed
+if ! command -v taplo &> /dev/null; then
+ echo "❌ taplo is not installed"
+ echo ""
+ echo "Install with one of:"
+ echo " cargo install taplo-cli --locked"
+ echo " brew install taplo (macOS)"
+ echo " Download from: https://github.com/tamasfe/taplo/releases"
+ exit 1
+fi
+
+# Get files to check based on mode
+get_files() {
+ case "$FILE_MODE" in
+ staged)
+ # Get staged TOML files for git hooks
+ git diff --cached --name-only --diff-filter=ACM -- '*.toml'
+ ;;
+ ci)
+ # Get TOML files changed in PR for CI
+ if [ -n "${GITHUB_BASE_REF:-}" ]; then
+ # GitHub Actions PR context
+ git fetch --no-tags --depth=1 origin
"${GITHUB_BASE_REF}:${GITHUB_BASE_REF}" 2>/dev/null || true
+ git diff --name-only --diff-filter=ACM "${GITHUB_BASE_REF}...HEAD" --
'*.toml'
+ elif [ -n "${CI:-}" ]; then
+ # Generic CI - compare with HEAD~1
+ git diff --name-only --diff-filter=ACM HEAD~1 -- '*.toml'
+ else
+ # Fallback to staged files
+ git diff --cached --name-only --diff-filter=ACM -- '*.toml'
+ fi
+ ;;
+ all)
+ # Get all TOML files (excluding common build directories)
+ find . -name '*.toml' \
+ -not -path './target/*' \
+ -not -path './node_modules/*' \
+ -not -path './.git/*' \
+ -not -path './venv/*' \
+ -type f
+ ;;
+ esac
+}
+
+# If files were provided as arguments, use them
+if [ ${#FILES[@]} -gt 0 ]; then
+ TOML_FILES=("${FILES[@]}")
+else
+ # Get files based on mode
+ TOML_FILES=()
+ while IFS= read -r file; do
+ [ -n "$file" ] && TOML_FILES+=("$file")
+ done < <(get_files)
+fi
+
+# Exit early if no files to check
+if [ ${#TOML_FILES[@]} -eq 0 ]; then
+ echo "✅ No TOML files to check"
+ exit 0
+fi
+
+echo "Checking ${#TOML_FILES[@]} TOML file(s)..."
+
+# Fix mode
+if [ "$MODE" = "fix" ]; then
+ echo "🔧 Formatting TOML files..."
+ FAILED=0
+ for file in "${TOML_FILES[@]}"; do
+ if [ -f "$file" ]; then
+ if taplo fmt "$file" 2>/dev/null; then
+ echo " Formatted: $file"
+ else
+ echo " ❌ Failed: $file"
+ FAILED=1
+ fi
+ fi
+ done
+ if [ $FAILED -eq 0 ]; then
+ echo "✅ All TOML files formatted"
+ else
+ echo "❌ Some files failed to format"
+ exit 1
+ fi
+ exit 0
+fi
+
+# Check mode
+FILES_WITH_ISSUES=()
+for file in "${TOML_FILES[@]}"; do
+ if [ -f "$file" ]; then
+ if ! taplo fmt --check "$file" 2>/dev/null; then
+ FILES_WITH_ISSUES+=("$file")
+ fi
+ fi
+done
+
+if [ ${#FILES_WITH_ISSUES[@]} -eq 0 ]; then
+ echo "✅ All TOML files properly formatted"
+ exit 0
+fi
+
+echo "❌ Found formatting issues in ${#FILES_WITH_ISSUES[@]} file(s):"
+echo ""
+for file in "${FILES_WITH_ISSUES[@]}"; do
+ echo " • $file"
+ # Show diff preview (limit output)
+ taplo fmt --check --diff "$file" 2>/dev/null | head -20 | sed 's/^/ /'
+ echo ""
+done
+
+echo "💡 Run '$0 --fix' to format automatically"
+exit 1