lint fixes
Some checks failed
Continuous Integration / Code Formatting (pull_request) Successful in 27s
Continuous Integration / Code Quality Check (pull_request) Successful in 29s
Continuous Integration / Test Execution (pull_request) Failing after 33s
Continuous Integration / CI Summary (pull_request) Failing after 5s
Some checks failed
Continuous Integration / Code Formatting (pull_request) Successful in 27s
Continuous Integration / Code Quality Check (pull_request) Successful in 29s
Continuous Integration / Test Execution (pull_request) Failing after 33s
Continuous Integration / CI Summary (pull_request) Failing after 5s
This commit is contained in:
292
.gitea/workflows/ci.yml
Normal file
292
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,292 @@
|
||||
name: Continuous Integration
|
||||
|
||||
# CI pipeline for the Skelly Godot project
|
||||
#
|
||||
# Code quality checks (formatting, linting, testing) run as independent jobs
|
||||
# in parallel. Uses tools/run_development.py for consistency with local development.
|
||||
#
|
||||
# Features:
|
||||
# - Independent job execution (no dependencies between format/lint/test)
|
||||
# - Automatic code formatting with commit back to branch
|
||||
# - Error reporting and PR comments
|
||||
# - Manual execution with selective step skipping
|
||||
|
||||
on:
|
||||
# Trigger on push to any branch - only when relevant files change
|
||||
push:
|
||||
branches: ['*']
|
||||
paths:
|
||||
- '**/*.gd' # Any GDScript file
|
||||
- '.gdlintrc' # Linting configuration
|
||||
- '.gdformatrc' # Formatting configuration
|
||||
- 'tools/run_development.py' # Development workflow script
|
||||
- '.gitea/workflows/ci.yml' # This workflow file
|
||||
|
||||
# Trigger on pull requests - same file filters as push
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
paths:
|
||||
- '**/*.gd'
|
||||
- '.gdlintrc'
|
||||
- '.gdformatrc'
|
||||
- 'tools/run_development.py'
|
||||
- '.gitea/workflows/ci.yml'
|
||||
|
||||
# Allow manual triggering with optional step skipping
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip_format:
|
||||
description: 'Skip code formatting'
|
||||
required: false
|
||||
default: 'false'
|
||||
type: boolean
|
||||
skip_lint:
|
||||
description: 'Skip code linting'
|
||||
required: false
|
||||
default: 'false'
|
||||
type: boolean
|
||||
skip_tests:
|
||||
description: 'Skip test execution'
|
||||
required: false
|
||||
default: 'false'
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Code Formatting
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
if: ${{ always() && github.event.inputs.skip_format != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade "setuptools<81"
|
||||
pip install gdtoolkit==4
|
||||
|
||||
- name: Run code formatting
|
||||
id: format
|
||||
run: |
|
||||
echo "🎨 Running GDScript formatting..."
|
||||
python tools/run_development.py --format
|
||||
|
||||
- name: Check for formatting changes
|
||||
id: check-changes
|
||||
run: |
|
||||
if git diff --quiet; then
|
||||
echo "📝 No formatting changes detected"
|
||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "📝 Formatting changes detected"
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
echo "🔍 Changed files:"
|
||||
git diff --name-only
|
||||
echo ""
|
||||
echo "📊 Diff summary:"
|
||||
git diff --stat
|
||||
fi
|
||||
|
||||
- name: Commit and push formatting changes
|
||||
if: steps.check-changes.outputs.has_changes == 'true'
|
||||
run: |
|
||||
echo "💾 Committing formatting changes..."
|
||||
|
||||
git config user.name "Gitea Actions"
|
||||
git config user.email "actions@gitea.local"
|
||||
|
||||
git add -A
|
||||
|
||||
commit_message="🎨 Auto-format GDScript code
|
||||
|
||||
Automated formatting applied by tools/run_development.py
|
||||
|
||||
🤖 Generated by Gitea Actions
|
||||
Workflow: ${{ github.workflow }}
|
||||
Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
git commit -m "$commit_message"
|
||||
|
||||
target_branch="${{ github.event.pull_request.head.ref || github.ref_name }}"
|
||||
echo "📤 Pushing changes to branch: $target_branch"
|
||||
git push origin HEAD:"$target_branch"
|
||||
|
||||
echo "✅ Formatting changes pushed successfully!"
|
||||
|
||||
lint:
|
||||
name: Code Quality Check
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.inputs.skip_lint != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade "setuptools<81"
|
||||
pip install gdtoolkit==4
|
||||
|
||||
- name: Run linting
|
||||
id: lint
|
||||
run: |
|
||||
echo "🔍 Running GDScript linting..."
|
||||
python tools/run_development.py --lint
|
||||
|
||||
- name: Upload linting results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: lint-results
|
||||
path: |
|
||||
**/*.gd
|
||||
retention-days: 7
|
||||
|
||||
test:
|
||||
name: Test Execution
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.inputs.skip_tests != 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade "setuptools<81"
|
||||
pip install gdtoolkit==4
|
||||
|
||||
- name: Set up Godot
|
||||
uses: chickensoft-games/setup-godot@v1
|
||||
with:
|
||||
version: 4.3.0
|
||||
use-dotnet: false
|
||||
|
||||
- name: Run tests
|
||||
id: test
|
||||
run: |
|
||||
echo "🧪 Running GDScript tests..."
|
||||
python tools/run_development.py --test
|
||||
|
||||
- name: Upload test results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: |
|
||||
tests/**/*.gd
|
||||
retention-days: 7
|
||||
|
||||
summary:
|
||||
name: CI Summary
|
||||
runs-on: ubuntu-latest
|
||||
needs: [format, lint, test]
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- name: Set workflow status
|
||||
id: status
|
||||
run: |
|
||||
format_status="${{ needs.format.result }}"
|
||||
lint_status="${{ needs.lint.result }}"
|
||||
test_status="${{ needs.test.result }}"
|
||||
|
||||
echo "📊 Workflow Results:"
|
||||
echo "🎨 Format: $format_status"
|
||||
echo "🔍 Lint: $lint_status"
|
||||
echo "🧪 Test: $test_status"
|
||||
|
||||
if [[ "$format_status" == "success" && "$lint_status" == "success" && ("$test_status" == "success" || "$test_status" == "skipped") ]]; then
|
||||
echo "overall_status=success" >> $GITHUB_OUTPUT
|
||||
echo "✅ All CI checks passed!"
|
||||
else
|
||||
echo "overall_status=failure" >> $GITHUB_OUTPUT
|
||||
echo "❌ Some CI checks failed"
|
||||
fi
|
||||
|
||||
- name: Comment on PR (if applicable)
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const formatStatus = '${{ needs.format.result }}';
|
||||
const lintStatus = '${{ needs.lint.result }}';
|
||||
const testStatus = '${{ needs.test.result }}';
|
||||
const overallStatus = '${{ steps.status.outputs.overall_status }}';
|
||||
|
||||
const getStatusEmoji = (status) => {
|
||||
switch(status) {
|
||||
case 'success': return '✅';
|
||||
case 'failure': return '❌';
|
||||
case 'skipped': return '⏭️';
|
||||
default: return '⚠️';
|
||||
}
|
||||
};
|
||||
|
||||
const message = `## 🤖 CI Pipeline Results
|
||||
|
||||
| Step | Status | Result |
|
||||
|------|--------|--------|
|
||||
| 🎨 Formatting | ${getStatusEmoji(formatStatus)} | ${formatStatus} |
|
||||
| 🔍 Linting | ${getStatusEmoji(lintStatus)} | ${lintStatus} |
|
||||
| 🧪 Testing | ${getStatusEmoji(testStatus)} | ${testStatus} |
|
||||
|
||||
**Overall Status:** ${getStatusEmoji(overallStatus)} ${overallStatus.toUpperCase()}
|
||||
|
||||
${overallStatus === 'success'
|
||||
? '🎉 All checks passed! This PR is ready for review.'
|
||||
: '⚠️ Some checks failed. Please review the workflow logs and fix any issues.'}
|
||||
|
||||
[View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: message
|
||||
});
|
||||
|
||||
- name: Set final exit code
|
||||
run: |
|
||||
if [[ "${{ steps.status.outputs.overall_status }}" == "success" ]]; then
|
||||
echo "🎉 CI Pipeline completed successfully!"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ CI Pipeline failed"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,278 +0,0 @@
|
||||
name: GDScript Auto-Formatting
|
||||
|
||||
on:
|
||||
# Trigger on pull requests to main branch
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- '**/*.gd'
|
||||
- '.gdformatrc'
|
||||
- '.gitea/workflows/gdformat.yml'
|
||||
|
||||
# Allow manual triggering
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target_branch:
|
||||
description: 'Target branch to format (leave empty for current branch)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
gdformat:
|
||||
name: Auto-Format GDScript Code
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Grant write permissions for pushing changes
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Use the PR head ref for pull requests, or current branch for manual runs
|
||||
ref: ${{ github.event.pull_request.head.ref || github.ref }}
|
||||
# Need token with write permissions to push back
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade "setuptools<81"
|
||||
pip install gdtoolkit==4
|
||||
|
||||
- name: Verify gdformat installation
|
||||
run: |
|
||||
gdformat --version
|
||||
echo "✅ gdformat installed successfully"
|
||||
|
||||
- name: Get target branch info
|
||||
id: branch-info
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
target_branch="${{ github.event.pull_request.head.ref }}"
|
||||
echo "🔄 Processing PR branch: $target_branch"
|
||||
elif [[ -n "${{ github.event.inputs.target_branch }}" ]]; then
|
||||
target_branch="${{ github.event.inputs.target_branch }}"
|
||||
echo "🎯 Manual target branch: $target_branch"
|
||||
git checkout "$target_branch" || (echo "❌ Branch not found: $target_branch" && exit 1)
|
||||
else
|
||||
target_branch="${{ github.ref_name }}"
|
||||
echo "📍 Current branch: $target_branch"
|
||||
fi
|
||||
echo "target_branch=$target_branch" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Count GDScript files
|
||||
id: count-files
|
||||
run: |
|
||||
file_count=$(find . -name "*.gd" -not -path "./.git/*" | wc -l)
|
||||
echo "file_count=$file_count" >> $GITHUB_OUTPUT
|
||||
echo "📊 Found $file_count GDScript files to format"
|
||||
|
||||
- name: Run GDScript formatting
|
||||
id: format-files
|
||||
run: |
|
||||
echo "🎨 Starting GDScript formatting..."
|
||||
echo "================================"
|
||||
|
||||
# Initialize counters
|
||||
total_files=0
|
||||
formatted_files=0
|
||||
skipped_files=0
|
||||
failed_files=0
|
||||
|
||||
# Track if any files were actually changed
|
||||
files_changed=false
|
||||
|
||||
# Find all .gd files except TestHelper.gd (static var syntax incompatibility)
|
||||
while IFS= read -r -d '' file; do
|
||||
filename=$(basename "$file")
|
||||
|
||||
# Skip TestHelper.gd due to static var syntax incompatibility with gdformat
|
||||
if [[ "$filename" == "TestHelper.gd" ]]; then
|
||||
echo "⚠️ Skipping $file (static var syntax not supported by gdformat)"
|
||||
((total_files++))
|
||||
((skipped_files++))
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "🎨 Formatting: $file"
|
||||
((total_files++))
|
||||
|
||||
# Get file hash before formatting
|
||||
before_hash=$(sha256sum "$file" | cut -d' ' -f1)
|
||||
|
||||
# Run gdformat
|
||||
if gdformat "$file" 2>/dev/null; then
|
||||
# Get file hash after formatting
|
||||
after_hash=$(sha256sum "$file" | cut -d' ' -f1)
|
||||
|
||||
if [[ "$before_hash" != "$after_hash" ]]; then
|
||||
echo "✅ Formatted (changes applied)"
|
||||
files_changed=true
|
||||
else
|
||||
echo "✅ Already formatted"
|
||||
fi
|
||||
((formatted_files++))
|
||||
else
|
||||
echo "❌ Failed to format"
|
||||
((failed_files++))
|
||||
fi
|
||||
|
||||
done < <(find . -name "*.gd" -not -path "./.git/*" -print0)
|
||||
|
||||
# Print summary
|
||||
echo ""
|
||||
echo "================================"
|
||||
echo "📋 Formatting Summary"
|
||||
echo "================================"
|
||||
echo "📊 Total files: $total_files"
|
||||
echo "✅ Successfully formatted: $formatted_files"
|
||||
echo "⚠️ Skipped files: $skipped_files"
|
||||
echo "❌ Failed files: $failed_files"
|
||||
echo ""
|
||||
|
||||
# Export results for next step
|
||||
echo "files_changed=$files_changed" >> $GITHUB_OUTPUT
|
||||
echo "total_files=$total_files" >> $GITHUB_OUTPUT
|
||||
echo "formatted_files=$formatted_files" >> $GITHUB_OUTPUT
|
||||
echo "failed_files=$failed_files" >> $GITHUB_OUTPUT
|
||||
|
||||
# Exit with error if any files failed
|
||||
if [[ $failed_files -gt 0 ]]; then
|
||||
echo "❌ Formatting FAILED - $failed_files file(s) could not be formatted"
|
||||
exit 1
|
||||
else
|
||||
echo "✅ All files processed successfully!"
|
||||
fi
|
||||
|
||||
- name: Check for changes
|
||||
id: check-changes
|
||||
run: |
|
||||
if git diff --quiet; then
|
||||
echo "📝 No formatting changes detected"
|
||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "📝 Formatting changes detected"
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
|
||||
# Show what changed
|
||||
echo "🔍 Changed files:"
|
||||
git diff --name-only
|
||||
echo ""
|
||||
echo "📊 Diff summary:"
|
||||
git diff --stat
|
||||
fi
|
||||
|
||||
- name: Commit and push changes
|
||||
if: steps.check-changes.outputs.has_changes == 'true'
|
||||
run: |
|
||||
echo "💾 Committing formatting changes..."
|
||||
|
||||
# Configure git
|
||||
git config user.name "Gitea Actions"
|
||||
git config user.email "actions@gitea.local"
|
||||
|
||||
# Add all changed files
|
||||
git add -A
|
||||
|
||||
# Create commit with detailed message
|
||||
commit_message="🎨 Auto-format GDScript code
|
||||
|
||||
Automated formatting applied by gdformat workflow
|
||||
|
||||
📊 Summary:
|
||||
- Total files processed: ${{ steps.format-files.outputs.total_files }}
|
||||
- Successfully formatted: ${{ steps.format-files.outputs.formatted_files }}
|
||||
- Files with changes: $(git diff --cached --name-only | wc -l)
|
||||
|
||||
🤖 Generated by Gitea Actions
|
||||
Workflow: ${{ github.workflow }}
|
||||
Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
git commit -m "$commit_message"
|
||||
|
||||
# Push changes back to the branch
|
||||
target_branch="${{ steps.branch-info.outputs.target_branch }}"
|
||||
echo "📤 Pushing changes to branch: $target_branch"
|
||||
|
||||
git push origin HEAD:"$target_branch"
|
||||
|
||||
echo "✅ Changes pushed successfully!"
|
||||
|
||||
- name: Summary comment (PR only)
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const hasChanges = '${{ steps.check-changes.outputs.has_changes }}' === 'true';
|
||||
const totalFiles = '${{ steps.format-files.outputs.total_files }}';
|
||||
const formattedFiles = '${{ steps.format-files.outputs.formatted_files }}';
|
||||
const failedFiles = '${{ steps.format-files.outputs.failed_files }}';
|
||||
|
||||
let message;
|
||||
if (hasChanges) {
|
||||
message = `🎨 **GDScript Auto-Formatting Complete**
|
||||
|
||||
✅ Code has been automatically formatted and pushed to this branch.
|
||||
|
||||
📊 **Summary:**
|
||||
- Total files processed: ${totalFiles}
|
||||
- Successfully formatted: ${formattedFiles}
|
||||
- Files with changes applied: ${hasChanges ? 'Yes' : 'No'}
|
||||
|
||||
🔄 **Next Steps:**
|
||||
The latest commit contains the formatted code. You may need to pull the changes locally.
|
||||
|
||||
[View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
|
||||
} else {
|
||||
message = `🎨 **GDScript Formatting Check**
|
||||
|
||||
✅ All GDScript files are already properly formatted!
|
||||
|
||||
📊 **Summary:**
|
||||
- Total files checked: ${totalFiles}
|
||||
- Files needing formatting: 0
|
||||
|
||||
🎉 No changes needed - code style is consistent.
|
||||
|
||||
[View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
|
||||
}
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: message
|
||||
});
|
||||
|
||||
- name: Upload formatting artifacts
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: gdformat-results
|
||||
path: |
|
||||
**/*.gd
|
||||
retention-days: 7
|
||||
|
||||
- name: Workflow completion status
|
||||
run: |
|
||||
echo "🎉 GDScript formatting workflow completed!"
|
||||
echo ""
|
||||
echo "📋 Final Status:"
|
||||
if [[ "${{ steps.format-files.outputs.failed_files }}" != "0" ]]; then
|
||||
echo "❌ Some files failed to format"
|
||||
exit 1
|
||||
elif [[ "${{ steps.check-changes.outputs.has_changes }}" == "true" ]]; then
|
||||
echo "✅ Code formatted and changes pushed"
|
||||
else
|
||||
echo "✅ Code already properly formatted"
|
||||
fi
|
||||
@@ -1,147 +0,0 @@
|
||||
name: GDScript Linting
|
||||
|
||||
on:
|
||||
# Trigger on push to any branch
|
||||
push:
|
||||
branches: ['*']
|
||||
paths:
|
||||
- '**/*.gd'
|
||||
- '.gdlintrc'
|
||||
- '.gitea/workflows/gdlint.yml'
|
||||
|
||||
# Trigger on pull requests
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
paths:
|
||||
- '**/*.gd'
|
||||
- '.gdlintrc'
|
||||
- '.gitea/workflows/gdlint.yml'
|
||||
|
||||
# Allow manual triggering
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
gdlint:
|
||||
name: GDScript Code Quality Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade "setuptools<81"
|
||||
pip install gdtoolkit==4
|
||||
|
||||
- name: Verify gdlint installation
|
||||
run: |
|
||||
gdlint --version
|
||||
echo "✅ gdlint installed successfully"
|
||||
|
||||
- name: Count GDScript files
|
||||
id: count-files
|
||||
run: |
|
||||
file_count=$(find . -name "*.gd" -not -path "./.git/*" | wc -l)
|
||||
echo "file_count=$file_count" >> $GITHUB_OUTPUT
|
||||
echo "📊 Found $file_count GDScript files to lint"
|
||||
|
||||
- name: Run GDScript linting
|
||||
run: |
|
||||
echo "🔍 Starting GDScript linting..."
|
||||
echo "================================"
|
||||
|
||||
# Initialize counters
|
||||
total_files=0
|
||||
clean_files=0
|
||||
warning_files=0
|
||||
error_files=0
|
||||
|
||||
# Find all .gd files except TestHelper.gd (static var syntax incompatibility)
|
||||
while IFS= read -r -d '' file; do
|
||||
filename=$(basename "$file")
|
||||
|
||||
# Skip TestHelper.gd due to static var syntax incompatibility with gdlint
|
||||
if [[ "$filename" == "TestHelper.gd" ]]; then
|
||||
echo "⚠️ Skipping $file (static var syntax not supported by gdlint)"
|
||||
((total_files++))
|
||||
((clean_files++))
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "🔍 Linting: $file"
|
||||
((total_files++))
|
||||
|
||||
# Run gdlint and capture output
|
||||
if output=$(gdlint "$file" 2>&1); then
|
||||
if [[ -z "$output" ]]; then
|
||||
echo "✅ Clean"
|
||||
((clean_files++))
|
||||
else
|
||||
echo "⚠️ Warnings found:"
|
||||
echo "$output"
|
||||
((warning_files++))
|
||||
fi
|
||||
else
|
||||
echo "❌ Errors found:"
|
||||
echo "$output"
|
||||
((error_files++))
|
||||
fi
|
||||
echo ""
|
||||
|
||||
done < <(find . -name "*.gd" -not -path "./.git/*" -print0)
|
||||
|
||||
# Print summary
|
||||
echo "================================"
|
||||
echo "📋 Linting Summary"
|
||||
echo "================================"
|
||||
echo "📊 Total files: $total_files"
|
||||
echo "✅ Clean files: $clean_files"
|
||||
echo "⚠️ Files with warnings: $warning_files"
|
||||
echo "❌ Files with errors: $error_files"
|
||||
echo ""
|
||||
|
||||
# Set exit code based on results
|
||||
if [[ $error_files -gt 0 ]]; then
|
||||
echo "❌ Linting FAILED - $error_files file(s) have errors"
|
||||
echo "Please fix the errors above before merging"
|
||||
exit 1
|
||||
elif [[ $warning_files -gt 0 ]]; then
|
||||
echo "⚠️ Linting PASSED with warnings - Consider fixing them"
|
||||
echo "✅ No blocking errors found"
|
||||
exit 0
|
||||
else
|
||||
echo "✅ All GDScript files passed linting!"
|
||||
echo "🎉 Code quality check complete - ready for merge"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
- name: Upload linting results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: gdlint-results
|
||||
path: |
|
||||
**/*.gd
|
||||
retention-days: 7
|
||||
|
||||
- name: Comment on PR (if applicable)
|
||||
if: github.event_name == 'pull_request' && failure()
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '❌ **GDScript Linting Failed**\n\nPlease check the workflow logs and fix the linting errors before merging.\n\n[View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
|
||||
})
|
||||
Reference in New Issue
Block a user