Skip to content

Commit

Permalink
chore: more updates to contributor, validation, and qa workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Andrews <[email protected]>
  • Loading branch information
ABC2015 committed Nov 28, 2024
1 parent 4d9645b commit 307b728
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 58 deletions.
47 changes: 43 additions & 4 deletions .github/workflows/beta-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## This workflow runs on pull requests into the beta branch. Direct pushes to beta are blocked.
# This workflow runs on pull requests into the beta branch. Direct pushes to beta are blocked.

name: Beta Workflow

Expand All @@ -9,6 +9,7 @@ on:

jobs:
beta-tests:
name: Test Beta Branch with Dart Matrix
runs-on: ubuntu-latest

strategy:
Expand All @@ -25,10 +26,48 @@ jobs:
dart-version: ${{ matrix.dart-version }}

- name: Install Dependencies
run: dart pub get
run: |
echo "Installing dependencies for Dart ${{ matrix.dart-version }}..."
if ! dart pub get; then
echo "❌ Failed to install dependencies for Dart ${{ matrix.dart-version }}. Exiting..."
exit 1
fi
- name: Run Static Analysis
run: dart analyze
run: |
echo "Running static analysis for Dart ${{ matrix.dart-version }}..."
if ! dart analyze > analysis_report.txt 2> error_log.txt; then
echo "❌ Static analysis failed for Dart ${{ matrix.dart-version }}."
cat error_log.txt
exit 1
else
echo "✅ Static analysis passed for Dart ${{ matrix.dart-version }}."
fi
- name: Upload Analysis Report
if: always()
uses: actions/upload-artifact@v3
with:
name: analysis-report-${{ matrix.dart-version }}
path: |
analysis_report.txt
error_log.txt
retention-days: 7

- name: Run Unit Tests
run: dart test
run: |
echo "Running unit tests for Dart ${{ matrix.dart-version }}..."
if ! dart test --reporter expanded; then
echo "❌ Unit tests failed for Dart ${{ matrix.dart-version }}. Exiting..."
exit 1
else
echo "✅ Unit tests passed for Dart ${{ matrix.dart-version }}."
fi
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.dart-version }}
path: .dart_tool/test/generated_reports
retention-days: 7
72 changes: 52 additions & 20 deletions .github/workflows/contributor-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## This workflow analyzes the Dart Server SDK and a Go-feature-integration example project
## to identify issues and commits for resolution.
# This workflow analyzes the Dart Server SDK and a Go-feature-integration example project
# to identify issues and commits for resolution.

name: Contributor Workflow

Expand Down Expand Up @@ -44,25 +44,41 @@ jobs:
echo "✅ Static analysis completed successfully. No critical errors found."
fi
- name: Highlight Info, Warnings, and Errors
- name: Categorize and Count Analysis Results
run: |
echo "Categorizing analysis results..."
cd dart-server-sdk-openfeature
grep -i "info" analysis_report.txt > info_report.txt || echo "No informational messages found."
grep -i "warning" analysis_report.txt > warning_report.txt || echo "No warnings found."
grep -i "error" analysis_report.txt > error_report.txt || echo "No errors found."
INFO_COUNT=$(wc -l < info_report.txt || echo 0)
WARNING_COUNT=$(wc -l < warning_report.txt || echo 0)
ERROR_COUNT=$(wc -l < error_report.txt || echo 0)
echo "Summary of analysis results:"
echo "Informational messages:"
cat info_report.txt || true
echo ""
echo "Warnings:"
cat warning_report.txt || true
echo "Informational messages: $INFO_COUNT"
echo "Warnings: $WARNING_COUNT"
echo "Errors: $ERROR_COUNT"
echo ""
echo "Errors:"
cat error_report.txt || true
- name: Identify Specific Commits for Easy Resolution
if [[ $INFO_COUNT -gt 0 ]]; then
echo "Informational messages:"
cat info_report.txt
echo ""
fi
if [[ $WARNING_COUNT -gt 0 ]]; then
echo "Warnings:"
cat warning_report.txt
echo ""
fi
if [[ $ERROR_COUNT -gt 0 ]]; then
echo "Errors:"
cat error_report.txt
echo ""
fi
- name: Identify Specific Commits for Issues
run: |
echo "Identifying specific commits for issues in the core SDK..."
cd dart-server-sdk-openfeature
Expand Down Expand Up @@ -125,25 +141,41 @@ jobs:
echo "✅ Static analysis completed successfully. No critical errors found."
fi
- name: Highlight Info, Warnings, and Errors
- name: Categorize and Count Analysis Results
run: |
echo "Categorizing analysis results..."
cd dart-server-sdk-openfeature/examples/go-feature-integration
grep -i "info" analysis_report.txt > info_report.txt || echo "No informational messages found."
grep -i "warning" analysis_report.txt > warning_report.txt || echo "No warnings found."
grep -i "error" analysis_report.txt > error_report.txt || echo "No errors found."
INFO_COUNT=$(wc -l < info_report.txt || echo 0)
WARNING_COUNT=$(wc -l < warning_report.txt || echo 0)
ERROR_COUNT=$(wc -l < error_report.txt || echo 0)
echo "Summary of analysis results:"
echo "Informational messages:"
cat info_report.txt || true
echo ""
echo "Warnings:"
cat warning_report.txt || true
echo "Informational messages: $INFO_COUNT"
echo "Warnings: $WARNING_COUNT"
echo "Errors: $ERROR_COUNT"
echo ""
echo "Errors:"
cat error_report.txt || true
- name: Identify Specific Commits for Easy Resolution
if [[ $INFO_COUNT -gt 0 ]]; then
echo "Informational messages:"
cat info_report.txt
echo ""
fi
if [[ $WARNING_COUNT -gt 0 ]]; then
echo "Warnings:"
cat warning_report.txt
echo ""
fi
if [[ $ERROR_COUNT -gt 0 ]]; then
echo "Errors:"
cat error_report.txt
echo ""
fi
- name: Identify Specific Commits for Issues
run: |
echo "Identifying specific commits for issues in the Go-feature-integration example..."
cd dart-server-sdk-openfeature/examples/go-feature-integration
Expand Down
52 changes: 45 additions & 7 deletions .github/workflows/main-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## This workflow runs on pull requests into the main branch. Direct pushes to main are blocked.
# This workflow runs on pull requests into the main branch. Direct pushes to main are blocked.

name: Main Workflow

Expand All @@ -9,34 +9,72 @@ on:

jobs:
main-tests:
name: Validate and Test Main Branch
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
dart-version: stable

- name: Install Dependencies
run: dart pub get
run: |
echo "Installing dependencies..."
if ! dart pub get; then
echo "❌ Failed to install dependencies. Exiting..."
exit 1
fi
- name: Check Code Formatting
run: |
echo "Checking code formatting..."
if ! dart format --set-exit-if-changed .; then
echo "❌ Code formatting issues detected. Please format your code with 'dart format'."
exit 1
fi
- name: Run Static Analysis
run: dart analyze
run: |
echo "Running static analysis..."
if ! dart analyze; then
echo "❌ Static analysis failed. Please fix the issues above."
exit 1
fi
- name: Run Full Test Suite
run: dart test --coverage=coverage
run: |
echo "Running full test suite with coverage..."
if ! dart test --coverage=coverage; then
echo "❌ Tests failed. Please fix the errors above."
exit 1
fi
- name: Format Coverage Report
run: dart pub global activate coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info
run: |
echo "Formatting coverage report..."
dart pub global activate coverage
dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: coverage/lcov.info

- name: Upload Coverage Artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/lcov.info

- name: Deploy to Production
if: github.event.pull_request.merged
run: echo "Deploying to Production..."
if: github.event.pull_request.merged && github.ref == 'refs/heads/main'
run: |
echo "Deploying to Production..."
# Add your deployment commands here
38 changes: 30 additions & 8 deletions .github/workflows/parent-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ name: Parent Pipeline
on:
push:
branches:
- '*'
- '*' # Matches any branch
pull_request:
branches:
- '*'
- '*' # Matches pull requests to any branch

jobs:
trigger-validation:
Expand All @@ -17,6 +17,10 @@ jobs:
determine-workflow:
needs: trigger-validation
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.determine.outputs.branch }}
base_branch: ${{ steps.determine.outputs.base_branch }}
event_name: ${{ steps.determine.outputs.event }}
steps:
- name: Determine Branch and Event
id: determine
Expand All @@ -31,23 +35,41 @@ jobs:
trigger-contributor-workflow:
needs: [determine-workflow, trigger-validation]
uses: ./.github/workflows/contributor-workflow.yml
with:
branch_name: ${{ needs.determine-workflow.outputs.branch_name }}
event_name: ${{ needs.determine-workflow.outputs.event_name }}
if: |
github.event_name == 'push' &&
github.ref_name != 'main' &&
github.ref_name != 'qa' &&
github.ref_name != 'beta'
needs.determine-workflow.outputs.branch_name != 'main' &&
needs.determine-workflow.outputs.branch_name != 'qa' &&
needs.determine-workflow.outputs.branch_name != 'beta'
trigger-qa-workflow:
needs: [determine-workflow, trigger-validation]
uses: ./.github/workflows/qa-workflow.yml
if: github.event_name == 'pull_request' && github.base_ref == 'qa'
with:
branch_name: ${{ needs.determine-workflow.outputs.branch_name }}
event_name: ${{ needs.determine-workflow.outputs.event_name }}
if: |
github.event_name == 'pull_request' &&
needs.determine-workflow.outputs.base_branch == 'qa'
trigger-beta-workflow:
needs: [determine-workflow, trigger-validation]
uses: ./.github/workflows/beta-workflow.yml
if: github.event_name == 'pull_request' && github.base_ref == 'beta'
with:
branch_name: ${{ needs.determine-workflow.outputs.branch_name }}
event_name: ${{ needs.determine-workflow.outputs.event_name }}
if: |
github.event_name == 'pull_request' &&
needs.determine-workflow.outputs.base_branch == 'beta'
trigger-main-workflow:
needs: [determine-workflow, trigger-validation]
uses: ./.github/workflows/main-workflow.yml
if: github.event_name == 'pull_request' && github.base_ref == 'main'
with:
branch_name: ${{ needs.determine-workflow.outputs.branch_name }}
event_name: ${{ needs.determine-workflow.outputs.event_name }}
if: |
github.event_name == 'pull_request' &&
needs.determine-workflow.outputs.base_branch == 'main'
Loading

0 comments on commit 307b728

Please sign in to comment.