improve test suite #24
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: CI/CD Pipeline | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
types: [ labeled ] | |
# Only run when "full-ci" label is added | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Enable debug logging' | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
test: | |
name: Test Suite | |
if: | | |
github.event_name == 'push' || | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-ci')) | |
uses: ./.github/workflows/test-workflow.yml | |
secrets: inherit | |
with: | |
debug_enabled: ${{ inputs.debug_enabled || false }} | |
build: | |
name: Build | |
needs: test | |
uses: ./.github/workflows/build-workflow.yml | |
secrets: inherit | |
code-quality: | |
name: Quality | |
needs: test | |
uses: ./.github/workflows/code-quality-workflow.yml | |
secrets: inherit | |
integration-test: | |
name: Integration | |
needs: build | |
if: | | |
github.event_name == 'push' || | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-ci')) | |
uses: ./.github/workflows/integration-test-workflow.yml | |
secrets: inherit | |
status-check: | |
name: CI Status Check | |
runs-on: ubuntu-latest | |
needs: [test, build, code-quality, integration-test] | |
if: always() | |
steps: | |
- name: Check CI Status | |
run: | | |
# Check all job results | |
FAILED=false | |
if [ "${{ needs.test.result }}" != "success" ] && [ "${{ needs.test.result }}" != "skipped" ]; then | |
echo "❌ Test failed: ${{ needs.test.result }}" | |
FAILED=true | |
fi | |
if [ "${{ needs.build.result }}" != "success" ] && [ "${{ needs.build.result }}" != "skipped" ]; then | |
echo "❌ Build failed: ${{ needs.build.result }}" | |
FAILED=true | |
fi | |
if [ "${{ needs.code-quality.result }}" != "success" ] && [ "${{ needs.code-quality.result }}" != "skipped" ]; then | |
echo "❌ Code Quality failed: ${{ needs.code-quality.result }}" | |
FAILED=true | |
fi | |
if [ "${{ needs.integration-test.result }}" != "success" ] && [ "${{ needs.integration-test.result }}" != "skipped" ]; then | |
echo "❌ Integration Test failed: ${{ needs.integration-test.result }}" | |
FAILED=true | |
fi | |
if [ "$FAILED" = "true" ]; then | |
echo "❌ CI pipeline failed" | |
exit 1 | |
else | |
echo "✅ CI pipeline passed successfully!" | |
fi | |
- name: Create status summary | |
if: always() | |
run: | | |
echo "## CI Pipeline Summary" >> $GITHUB_STEP_SUMMARY | |
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY | |
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
echo "| Test Suite | ${{ needs.test.result }} |" >> $GITHUB_STEP_SUMMARY | |
echo "| Build | ${{ needs.build.result }} |" >> $GITHUB_STEP_SUMMARY | |
echo "| Code Quality | ${{ needs.code-quality.result }} |" >> $GITHUB_STEP_SUMMARY | |
echo "| Integration Test | ${{ needs.integration-test.result }} |" >> $GITHUB_STEP_SUMMARY |