Skip to content

Commit afe930e

Browse files
authored
Simplify workflows (#435)
🚀 Optimize GitHub Actions: Add Path-Based Triggers and Concurrency Controls ## Summary This PR significantly optimizes our CI/CD pipeline by implementing intelligent path-based filtering and adding concurrency controls to prevent redundant workflow executions. ## Changes Made 🎯 Path-Based Filtering Added paths triggers to workflows so they only run when relevant files change: - components-build-deploy.yml: Only triggers on changes to: - Component directories (components/*/) - Deployment manifests (components/manifests/) - The workflow file itself - e2e.yml: Only triggers on changes to: - Components, e2e tests, scripts, agents - Configuration files (.specify/, agents/) - frontend-lint.yml: Only triggers on changes to: - Frontend TypeScript/JavaScript files - Package management files (package.json, package-lock.json) - Configuration files (tsconfig.json, eslint.config.mjs) - go-lint.yml: Only triggers on changes to: - Go source files in backend/operator - Go module files (go.mod, go.sum) ##⚡ Concurrency Controls Added concurrency groups with cancel-in-progress: true to: - Prevent multiple workflows running simultaneously for the same PR - Automatically cancel outdated workflow runs when new commits are pushed - Reduce resource usage and queue times ##🧹 Workflow Simplification - Removed redundant change detection job in frontend-lint.yml - Leveraged GitHub's native path filtering instead of custom change detection logic ## Benefits - ⏰ Faster CI: Workflows only run when necessary, reducing overall CI time - 💰 Cost Savings: Fewer unnecessary workflow executions = reduced GitHub Actions usage - 🔄 Better Developer Experience: No more waiting for irrelevant workflows to complete - 🚫 Prevents Conflicts: Concurrency controls eliminate race conditions from simultaneous runs ## Example Impact Before: A documentation-only change would trigger all 4 workflows unnecessarily After: Documentation changes won't trigger any component workflows Before: Pushing multiple commits rapidly could run multiple conflicting workflows After: Only the latest commit's workflow runs, previous ones are automatically cancelled ## Testing - Verified workflow syntax is valid - Confirmed path patterns cover all relevant file types - Tested concurrency groups work correctly with PR scenarios This optimization will make our CI pipeline more efficient while maintaining the same level of code quality assurance. --------- Signed-off-by: Nelesh Singla <117123879+nsingla@users.noreply.github.com>
1 parent 6605008 commit afe930e

File tree

4 files changed

+84
-26
lines changed

4 files changed

+84
-26
lines changed

.github/workflows/components-build-deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,28 @@ name: Build and Push Component Docker Images
33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- '.github/workflows/components-build-deploy.yml'
8+
- 'components/manifests/**'
9+
- 'components/runners/**'
10+
- 'components/operator/**'
11+
- 'components/backend/**'
12+
- 'components/frontend/**'
613
pull_request_target:
714
branches: [main]
15+
paths:
16+
- '.github/workflows/components-build-deploy.yml'
17+
- 'components/manifests/**'
18+
- 'components/runners/**'
19+
- 'components/operator/**'
20+
- 'components/backend/**'
21+
- 'components/frontend/**'
822
workflow_dispatch:
923

24+
concurrency:
25+
group: components-build-deploy-${{ github.event.pull_request.number || github.ref }}
26+
cancel-in-progress: true
27+
1028
jobs:
1129
detect-changes:
1230
runs-on: ubuntu-latest

.github/workflows/e2e.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,29 @@ name: E2E Tests
33
on:
44
pull_request:
55
branches: [ main, master ]
6+
paths:
7+
- 'components/**'
8+
- '.github/workflows/e2e.yml'
9+
- 'e2e/**'
10+
- 'scripts/**'
11+
- '.specify/**'
12+
- 'agents/**'
13+
614
push:
715
branches: [ main, master ]
16+
paths:
17+
- 'components/**'
18+
- '.github/workflows/e2e.yml'
19+
- 'e2e/**'
20+
- 'scripts/**'
21+
- '.specify/**'
22+
- 'agents/**'
823
workflow_dispatch: # Allow manual trigger
924

25+
concurrency:
26+
group: e2e-tests-${{ github.event.pull_request.number || github.ref }}
27+
cancel-in-progress: true
28+
1029
jobs:
1130
detect-changes:
1231
runs-on: ubuntu-latest

.github/workflows/frontend-lint.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,39 @@ name: Frontend Lint and Type Check
33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- 'components/frontend/**/*.ts'
8+
- 'components/frontend/**/*.tsx'
9+
- 'components/frontend/**/*.js'
10+
- 'components/frontend/**/*.jsx'
11+
- 'components/frontend/package.json'
12+
- 'components/frontend/package-lock.json'
13+
- 'components/frontend/tsconfig.json'
14+
- 'components/frontend/eslint.config.mjs'
15+
- '.github/workflows/frontend-lint.yml'
16+
617
pull_request:
718
branches: [main]
19+
paths:
20+
- 'components/frontend/**/*.ts'
21+
- 'components/frontend/**/*.tsx'
22+
- 'components/frontend/**/*.js'
23+
- 'components/frontend/**/*.jsx'
24+
- 'components/frontend/package.json'
25+
- 'components/frontend/package-lock.json'
26+
- 'components/frontend/tsconfig.json'
27+
- 'components/frontend/eslint.config.mjs'
28+
- '.github/workflows/frontend-lint.yml'
29+
830
workflow_dispatch:
931

10-
jobs:
11-
detect-frontend-changes:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
frontend: ${{ steps.filter.outputs.frontend }}
15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v5
18-
19-
- name: Check for Frontend changes
20-
uses: dorny/paths-filter@v3
21-
id: filter
22-
with:
23-
filters: |
24-
frontend:
25-
- 'components/frontend/**/*.ts'
26-
- 'components/frontend/**/*.tsx'
27-
- 'components/frontend/**/*.js'
28-
- 'components/frontend/**/*.jsx'
29-
- 'components/frontend/package.json'
30-
- 'components/frontend/package-lock.json'
31-
- 'components/frontend/tsconfig.json'
32-
- 'components/frontend/eslint.config.mjs'
32+
concurrency:
33+
group: frontend-lint-${{ github.event.pull_request.number || github.ref }}
34+
cancel-in-progress: true
3335

36+
jobs:
3437
lint-frontend:
3538
runs-on: ubuntu-latest
36-
needs: detect-frontend-changes
37-
if: needs.detect-frontend-changes.outputs.frontend == 'true' || github.event_name == 'workflow_dispatch'
3839
steps:
3940
- name: Checkout code
4041
uses: actions/checkout@v5
@@ -68,7 +69,7 @@ jobs:
6869
6970
lint-summary:
7071
runs-on: ubuntu-latest
71-
needs: [detect-frontend-changes, lint-frontend]
72+
needs: lint-frontend
7273
if: always()
7374
steps:
7475
- name: Check overall status

.github/workflows/go-lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,30 @@ name: Go Lint and Format
33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- 'components/backend/**/*.go'
8+
- 'components/backend/go.mod'
9+
- 'components/backend/go.sum'
10+
- 'components/operator/**/*.go'
11+
- 'components/operator/go.mod'
12+
- 'components/operator/go.sum'
13+
- '.github/workflows/go-lint.yml'
614
pull_request:
715
branches: [main]
16+
paths:
17+
- 'components/backend/**/*.go'
18+
- 'components/backend/go.mod'
19+
- 'components/backend/go.sum'
20+
- 'components/operator/**/*.go'
21+
- 'components/operator/go.mod'
22+
- 'components/operator/go.sum'
23+
- '.github/workflows/go-lint.yml'
824
workflow_dispatch:
925

26+
concurrency:
27+
group: go-lint-${{ github.event.pull_request.number || github.ref }}
28+
cancel-in-progress: true
29+
1030
jobs:
1131
detect-go-changes:
1232
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)