|
| 1 | +name: Compile Workflows |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths: |
| 7 | + - 'workflows/**' |
| 8 | + - '.github/workflows/compile-workflows.yml' |
| 9 | + pull_request: |
| 10 | + branches: [ main ] |
| 11 | + paths: |
| 12 | + - 'workflows/**' |
| 13 | + - '.github/workflows/compile-workflows.yml' |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + compile-workflows: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install gh CLI |
| 25 | + run: | |
| 26 | + type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) |
| 27 | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ |
| 28 | + && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ |
| 29 | + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ |
| 30 | + && sudo apt update \ |
| 31 | + && sudo apt install gh -y |
| 32 | + |
| 33 | + - name: Install gh aw extension |
| 34 | + run: | |
| 35 | + gh extension install githubnext/gh-aw || gh extension upgrade githubnext/gh-aw |
| 36 | + |
| 37 | + - name: Clean up existing lock files |
| 38 | + run: | |
| 39 | + echo "Cleaning up existing .lock.yml files..." |
| 40 | + find workflows -name "*.lock.yml" -type f -delete || true |
| 41 | + echo "Cleanup complete" |
| 42 | + |
| 43 | + - name: Compile workflows |
| 44 | + run: | |
| 45 | + set -e |
| 46 | + echo "Compiling workflows..." |
| 47 | + |
| 48 | + # Find all workflow markdown files, excluding shared components |
| 49 | + workflow_files=$(find workflows -name "*.md" -type f | grep -v "workflows/agentics/shared/") |
| 50 | + |
| 51 | + if [ -z "$workflow_files" ]; then |
| 52 | + echo "No workflow files found" |
| 53 | + exit 1 |
| 54 | + fi |
| 55 | + |
| 56 | + echo "Found workflow files:" |
| 57 | + echo "$workflow_files" |
| 58 | + echo "" |
| 59 | + |
| 60 | + failed_compilations=() |
| 61 | + compiled_count=0 |
| 62 | + |
| 63 | + # Compile each workflow |
| 64 | + for workflow_file in $workflow_files; do |
| 65 | + echo "Compiling $workflow_file..." |
| 66 | + |
| 67 | + if gh aw compile --validate "$workflow_file"; then |
| 68 | + echo "✅ Successfully compiled $workflow_file" |
| 69 | + compiled_count=$((compiled_count + 1)) |
| 70 | + else |
| 71 | + echo "❌ Failed to compile $workflow_file" |
| 72 | + failed_compilations+=("$workflow_file") |
| 73 | + fi |
| 74 | + echo "" |
| 75 | + done |
| 76 | + |
| 77 | + echo "Compilation Summary:" |
| 78 | + echo "Successfully compiled: $compiled_count workflows" |
| 79 | + |
| 80 | + if [ ${#failed_compilations[@]} -gt 0 ]; then |
| 81 | + echo "Failed compilations: ${#failed_compilations[@]}" |
| 82 | + echo "Failed workflows:" |
| 83 | + for failed_workflow in "${failed_compilations[@]}"; do |
| 84 | + echo " - $failed_workflow" |
| 85 | + done |
| 86 | + exit 1 |
| 87 | + else |
| 88 | + echo "All workflows compiled successfully! 🎉" |
| 89 | + fi |
| 90 | + |
| 91 | + - name: Check for generated YAML files |
| 92 | + run: | |
| 93 | + echo "Checking for generated YAML files..." |
| 94 | + |
| 95 | + # Look for generated .lock.yml files in workflows directory |
| 96 | + lock_yml_files=$(find workflows -name "*.lock.yml" -type f | grep -v "workflows/agentics/shared/" || true) |
| 97 | + |
| 98 | + if [ -n "$lock_yml_files" ]; then |
| 99 | + echo "Generated .lock.yml files:" |
| 100 | + echo "$lock_yml_files" |
| 101 | + |
| 102 | + echo "" |
| 103 | + echo "Compilation generated $(echo "$lock_yml_files" | wc -l) workflow files:" |
| 104 | + for lock_yml_file in $lock_yml_files; do |
| 105 | + echo " ✅ $lock_yml_file" |
| 106 | + done |
| 107 | + else |
| 108 | + echo "⚠️ No generated .lock.yml files found in workflows/" |
| 109 | + fi |
0 commit comments