feat: v7.1.0 community sync #682
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint | |
| on: | |
| # Pull requests: Run detect-changes and Lint Summary only | |
| # This ensures the required Lint Summary check is present for merge queue entry. | |
| # Actual linting is skipped on PRs - only run in merge queue. | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| # Push to main/develop: Run lint with path filters | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| paths: | |
| - '**.go' | |
| - 'go.mod' | |
| - 'go.sum' | |
| - '.golangci.yml' | |
| - '.github/workflows/lint.yml' | |
| # Merge queue: re-run lint against the merged code with path filtering | |
| merge_group: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| checks: write | |
| # Consolidated lint job to reduce CI costs | |
| # Reduced from 6 parallel matrix jobs to 1 sequential job (~80% reduction in billable minutes) | |
| jobs: | |
| # ============================================================================= | |
| # Change Detection (pull_request and merge_group only) | |
| # ============================================================================= | |
| detect-changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| go-code: ${{ steps.filter.outputs.go-code }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Detect Go code changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| go-code: | |
| - '**.go' | |
| - '**/go.mod' | |
| - '**/go.sum' | |
| - '.golangci.yml' | |
| - '.github/workflows/lint.yml' | |
| golangci-lint: | |
| name: Lint All Modules | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: [detect-changes] | |
| # Run if: push/workflow_dispatch OR (PR/merge_group with Go changes) | |
| if: | | |
| always() && | |
| (github.event_name == 'push' || | |
| github.event_name == 'workflow_dispatch' || | |
| (needs.detect-changes.result == 'success' && needs.detect-changes.outputs.go-code == 'true')) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| cache: false # golangci-lint has its own cache | |
| - name: Install golangci-lint | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.11.4 | |
| - name: Lint All Modules (Parallel) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "π Linting all modules in parallel..." | |
| GOLANGCI_CONFIG="${{ github.workspace }}/.golangci.yml" | |
| # Create temp directory for status and output tracking | |
| WORKDIR=$(mktemp -d) | |
| trap "rm -rf $WORKDIR" EXIT | |
| # Define modules to lint with their paths | |
| declare -A MODULES=( | |
| ["agent"]="platform/agent" | |
| ["orchestrator"]="platform/orchestrator" | |
| ["connectors"]="platform/connectors" | |
| ["shared"]="platform/shared" | |
| ) | |
| # Run all lint jobs in parallel, capturing output | |
| for name in "${!MODULES[@]}"; do | |
| path="${MODULES[$name]}" | |
| ( | |
| if [ ! -d "$path" ]; then | |
| echo "ERROR: Directory $path does not exist" > "$WORKDIR/${name}.out" | |
| echo "1" > "$WORKDIR/${name}.status" | |
| else | |
| cd "$path" | |
| if golangci-lint run --timeout=10m --config="$GOLANGCI_CONFIG" > "$WORKDIR/${name}.out" 2>&1; then | |
| echo "0" > "$WORKDIR/${name}.status" | |
| else | |
| echo "1" > "$WORKDIR/${name}.status" | |
| fi | |
| fi | |
| ) & | |
| done | |
| # Wait for all to complete | |
| wait | |
| # Check results and display output for failures | |
| FAILED=0 | |
| for name in "${!MODULES[@]}"; do | |
| if [ "$(cat "$WORKDIR/${name}.status" 2>/dev/null || echo "1")" = "1" ]; then | |
| echo "" | |
| echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ" | |
| echo "β $name lint FAILED (${MODULES[$name]})" | |
| echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ" | |
| cat "$WORKDIR/${name}.out" 2>/dev/null || echo "(no output captured)" | |
| echo "" | |
| FAILED=1 | |
| else | |
| echo "β $name lint passed" | |
| fi | |
| done | |
| if [ "$FAILED" = "1" ]; then | |
| echo "" | |
| echo "β One or more modules failed linting. See details above." | |
| exit 1 | |
| fi | |
| echo "" | |
| echo "β All modules passed linting!" | |
| - name: Lint DEPLOYMENT_MODE pattern (Issue #1133) | |
| run: bash scripts/lint-deployment-mode.sh | |
| lint-summary: | |
| name: Lint Summary | |
| runs-on: ubuntu-latest | |
| needs: [detect-changes, golangci-lint] | |
| if: always() | |
| steps: | |
| - name: Check lint results | |
| run: | | |
| echo "π Lint Complete" | |
| echo "" | |
| echo "Results:" | |
| echo " Detect Changes: ${{ needs.detect-changes.result }}" | |
| echo " golangci-lint: ${{ needs.golangci-lint.result }}" | |
| - name: Fail if lint failed | |
| # Accept 'success' or 'skipped' (skipped = no Go code changes) | |
| # detect-changes is 'skipped' for push/workflow_dispatch events | |
| if: | | |
| needs.detect-changes.result == 'failure' || | |
| (needs.golangci-lint.result != 'success' && needs.golangci-lint.result != 'skipped') | |
| run: | | |
| echo "β Linting failed - please fix issues before merging" | |
| exit 1 | |
| - name: Success message | |
| if: success() | |
| run: | | |
| echo "β All linting checks passed!" |