style: format code for consistency by adjusting spacing in path prefi… #6
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: Main | ||
on: | ||
push: | ||
branches: [main, develop] | ||
pull_request: | ||
branches: [main, develop] | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
quality-gate: | ||
name: Quality Gate | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
outputs: | ||
should-run-tests: ${{ steps.changes.outputs.should-run-tests }} | ||
should-run-analysis: ${{ steps.changes.outputs.should-run-analysis }} | ||
should-run-security: ${{ steps.changes.outputs.should-run-security }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: Check for relevant changes | ||
id: changes | ||
run: | | ||
# Check if PHP files, configs, or workflows changed | ||
if git diff --name-only HEAD~1 HEAD | grep -E '\.(php|json|xml|yml|yaml)$' > /dev/null; then | ||
echo "should-run-tests=true" >> $GITHUB_OUTPUT | ||
echo "should-run-analysis=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "should-run-tests=false" >> $GITHUB_OUTPUT | ||
echo "should-run-analysis=false" >> $GITHUB_OUTPUT | ||
fi | ||
# Check if composer files changed for security checks | ||
if git diff --name-only HEAD~1 HEAD | grep -E 'composer\.(json|lock)$' > /dev/null; then | ||
echo "should-run-security=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "should-run-security=false" >> $GITHUB_OUTPUT | ||
fi | ||
ci: | ||
name: CI Pipeline | ||
needs: quality-gate | ||
if: needs.quality-gate.outputs.should-run-tests == 'true' | ||
uses: ./.github/workflows/ci.yml | ||
secrets: inherit | ||
static-analysis: | ||
name: Static Analysis | ||
needs: quality-gate | ||
if: needs.quality-gate.outputs.should-run-analysis == 'true' | ||
uses: ./.github/workflows/static-analysis.yml | ||
code-style: | ||
name: Code Style | ||
needs: quality-gate | ||
if: needs.quality-gate.outputs.should-run-analysis == 'true' | ||
uses: ./.github/workflows/code-style.yml | ||
Check failure on line 65 in .github/workflows/main.yml
|
||
secrets: inherit | ||
security: | ||
name: Security | ||
needs: quality-gate | ||
if: needs.quality-gate.outputs.should-run-security == 'true' || github.event_name == 'schedule' | ||
uses: ./.github/workflows/security.yml | ||
summary: | ||
name: Summary | ||
runs-on: ubuntu-latest | ||
needs: [quality-gate, ci, static-analysis, code-style, security] | ||
if: always() | ||
steps: | ||
- name: Generate summary | ||
run: | | ||
echo "## 🚀 Pipeline Summary" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
# CI Results | ||
if [ "${{ needs.ci.result }}" = "success" ]; then | ||
echo "✅ **CI Pipeline**: Passed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.ci.result }}" = "failure" ]; then | ||
echo "❌ **CI Pipeline**: Failed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.ci.result }}" = "skipped" ]; then | ||
echo "⏭️ **CI Pipeline**: Skipped (no relevant changes)" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
# Static Analysis Results | ||
if [ "${{ needs.static-analysis.result }}" = "success" ]; then | ||
echo "✅ **Static Analysis**: Passed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.static-analysis.result }}" = "failure" ]; then | ||
echo "❌ **Static Analysis**: Failed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.static-analysis.result }}" = "skipped" ]; then | ||
echo "⏭️ **Static Analysis**: Skipped" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
# Code Style Results | ||
if [ "${{ needs.code-style.result }}" = "success" ]; then | ||
echo "✅ **Code Style**: Passed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.code-style.result }}" = "failure" ]; then | ||
echo "❌ **Code Style**: Failed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.code-style.result }}" = "skipped" ]; then | ||
echo "⏭️ **Code Style**: Skipped" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
# Security Results | ||
if [ "${{ needs.security.result }}" = "success" ]; then | ||
echo "✅ **Security**: Passed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.security.result }}" = "failure" ]; then | ||
echo "❌ **Security**: Failed" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ needs.security.result }}" = "skipped" ]; then | ||
echo "⏭️ **Security**: Skipped" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "_Generated at $(date -u '+%Y-%m-%d %H:%M:%S UTC')_" >> $GITHUB_STEP_SUMMARY | ||
- name: Check overall status | ||
run: | | ||
if [ "${{ needs.ci.result }}" = "failure" ] || | ||
[ "${{ needs.static-analysis.result }}" = "failure" ] || | ||
[ "${{ needs.code-style.result }}" = "failure" ] || | ||
[ "${{ needs.security.result }}" = "failure" ]; then | ||
echo "💥 Pipeline failed - check the failed jobs above" | ||
exit 1 | ||
else | ||
echo "🎉 All pipeline checks passed successfully!" | ||
fi |