Skip to content

Commit

Permalink
chore: update 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 8b3e1ac commit 4d9645b
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 9 deletions.
155 changes: 149 additions & 6 deletions .github/workflows/contributor-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## This workflow runs on push events to any branch except main, qa, or beta.
## Allows contributors to push changes to feature branches or other non-protected branches for lightweight checks.
## 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 All @@ -11,9 +11,9 @@ on:
- beta

jobs:
contributor-checks:
analyze-core:
name: Analyze Core Dart Server SDK
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand All @@ -24,7 +24,150 @@ jobs:
dart-version: stable

- name: Install Dependencies
run: dart pub get
run: |
echo "Installing dependencies for core SDK..."
cd dart-server-sdk-openfeature
if ! dart pub get; then
echo "❌ Failed to install dependencies for the core SDK. Exiting..."
exit 1
fi
- name: Run Static Analysis
run: |
echo "Running static analysis for core SDK..."
cd dart-server-sdk-openfeature
if ! dart analyze lib/ > analysis_report.txt 2> error_log.txt; then
echo "❌ Static analysis failed with errors. See details below:"
cat error_log.txt
exit 1
else
echo "✅ Static analysis completed successfully. No critical errors found."
fi
- name: Highlight Info, Warnings, and Errors
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."
echo "Summary of analysis results:"
echo "Informational messages:"
cat info_report.txt || true
echo ""
echo "Warnings:"
cat warning_report.txt || true
echo ""
echo "Errors:"
cat error_report.txt || true
- name: Identify Specific Commits for Easy Resolution
run: |
echo "Identifying specific commits for issues in the core SDK..."
cd dart-server-sdk-openfeature
while IFS= read -r line; do
file=$(echo $line | awk -F ':' '{print $1}')
if [[ -n "$file" ]]; then
git_log=$(git log -n 1 --pretty=format:"%h by %an <%ae>" -- "$file")
echo "File: $file"
echo "Issue: $line"
echo "Commit: $git_log"
else
echo "No file information could be extracted for: $line"
fi
done < analysis_report.txt
- name: Upload Analysis Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: core-sdk-analysis
path: |
dart-server-sdk-openfeature/analysis_report.txt
dart-server-sdk-openfeature/error_log.txt
dart-server-sdk-openfeature/info_report.txt
dart-server-sdk-openfeature/warning_report.txt
dart-server-sdk-openfeature/error_report.txt
retention-days: 1
analyze-go-integration:
name: Analyze Go Feature Integration Example
runs-on: ubuntu-latest
needs: analyze-core
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Install Dependencies
run: |
echo "Installing dependencies for Go-feature-integration example..."
cd dart-server-sdk-openfeature/examples/go-feature-integration
if ! go mod tidy; then
echo "❌ Failed to install dependencies for Go example. Exiting..."
exit 1
fi
- name: Run Static Analysis
run: dart analyze
run: |
echo "Running static analysis for Go-feature-integration example..."
cd dart-server-sdk-openfeature/examples/go-feature-integration
if ! go vet ./... > analysis_report.txt 2> error_log.txt; then
echo "❌ Static analysis failed with errors. See details below:"
cat error_log.txt
exit 1
else
echo "✅ Static analysis completed successfully. No critical errors found."
fi
- name: Highlight Info, Warnings, and Errors
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."
echo "Summary of analysis results:"
echo "Informational messages:"
cat info_report.txt || true
echo ""
echo "Warnings:"
cat warning_report.txt || true
echo ""
echo "Errors:"
cat error_report.txt || true
- name: Identify Specific Commits for Easy Resolution
run: |
echo "Identifying specific commits for issues in the Go-feature-integration example..."
cd dart-server-sdk-openfeature/examples/go-feature-integration
while IFS= read -r line; do
file=$(echo $line | awk -F ':' '{print $1}')
if [[ -n "$file" ]]; then
git_log=$(git log -n 1 --pretty=format:"%h by %an <%ae>" -- "$file")
echo "File: $file"
echo "Issue: $line"
echo "Commit: $git_log"
else
echo "No file information could be extracted for: $line"
fi
done < analysis_report.txt
- name: Upload Analysis Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: go-integration-analysis
path: |
dart-server-sdk-openfeature/examples/go-feature-integration/analysis_report.txt
dart-server-sdk-openfeature/examples/go-feature-integration/error_log.txt
dart-server-sdk-openfeature/examples/go-feature-integration/info_report.txt
dart-server-sdk-openfeature/examples/go-feature-integration/warning_report.txt
dart-server-sdk-openfeature/examples/go-feature-integration/error_report.txt
retention-days: 1
41 changes: 41 additions & 0 deletions .github/workflows/qa-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## This workflow runs on pull requests into the main qa. SDirect pushes to main are blocked.

name: QA Workflow

on:
pull_request:
branches:
- qa

jobs:
qa-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

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

- name: Install Dependencies
run: dart pub get

- name: Run Static Analysis
run: dart analyze

- name: Run Unit Tests
run: dart test --coverage=coverage

- name: Format Coverage Report
run: 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: Check Code Quality
run: dart pub global run dart_code_metrics:metrics analyze lib
20 changes: 17 additions & 3 deletions .github/workflows/validation-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## This workflow valides that branch and commit names are standardized for better workflow.
## This workflow validates that branch and commit names are standardized for better workflow.

name: Validation Workflow

Expand All @@ -19,9 +19,15 @@ jobs:
echo "Branch name: ${{ github.ref_name }}"
BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
echo "Extracted branch name: $BRANCH_NAME"
if [[ ! "$BRANCH_NAME" =~ ^(feature|fix|hotfix|chore|test|refactor|release|qa|beta|main)/[a-z0-9_-]+$ ]]; then
# Check branch naming convention
if [[ "$BRANCH_NAME" =~ ^(qa|beta|main)$ ]]; then
echo "✅ Branch name '$BRANCH_NAME' is valid for protected branches (qa, beta, main)."
elif [[ "$BRANCH_NAME" =~ ^(feat|fix|hotfix|chore|test|refactor|release)/[a-z0-9_-]+$ ]]; then
echo "✅ Branch name '$BRANCH_NAME' follows the naming convention."
else
echo "❌ Branch name '$BRANCH_NAME' does not follow the naming convention: <type>/<branch-name>"
echo "Valid types: feature, fix, hotfix, chore, test, refactor, release, qa, beta, main"
echo "Valid types: feat, fix, hotfix, chore, test, refactor, release, qa, beta, main"
exit 1
fi
shell: bash
Expand All @@ -40,6 +46,14 @@ jobs:
if [[ -n "$INVALID_COMMITS" ]]; then
echo "❌ The following commit messages do not follow the convention:"
echo "$INVALID_COMMITS"
echo ""
echo "Commit message format must follow:"
echo "<type>(<scope>): <short summary>"
echo "Examples:"
echo " feat(auth): add OAuth 2.0 support"
echo " fix(payment): resolve rounding error in total calculation"
exit 1
else
echo "✅ All commit messages follow the convention."
fi
shell: bash

0 comments on commit 4d9645b

Please sign in to comment.