Skip to content

Commit 1a7ba29

Browse files
SkySingh04claude
andcommitted
feat(ci): Add comprehensive CI/CD infrastructure
- Add CI workflow with frontend (lint, build) and backend (pytest) checks - Add PR template with standardized sections for contributors - Add auto-labeling workflow based on changed files - Add labeler config for component labels (Frontend, Backend, MLIR, etc.) - Add issue command bot with slash commands (/assign, /close, /label, etc.) - Add PR size labeling (XS/S/M/L/XL based on lines changed) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5a70040 commit 1a7ba29

6 files changed

Lines changed: 505 additions & 0 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## Summary
2+
<!-- Provide a brief description of the changes in this PR -->
3+
4+
## Related Issue
5+
<!-- Link to the issue this PR addresses (e.g., Fixes #123, Closes #456) -->
6+
7+
## Changes Made
8+
<!-- List the key changes made in this PR -->
9+
-
10+
-
11+
-
12+
13+
## Type of Change
14+
<!-- Mark the relevant option with an "x" -->
15+
- [ ] Bug fix (non-breaking change that fixes an issue)
16+
- [ ] New feature (non-breaking change that adds functionality)
17+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
18+
- [ ] Documentation update
19+
- [ ] Refactoring (no functional changes)
20+
- [ ] CI/CD changes
21+
- [ ] Other (please describe):
22+
23+
## Testing
24+
<!-- Describe the tests you ran to verify your changes -->
25+
- [ ] Existing tests pass
26+
- [ ] New tests added (if applicable)
27+
- [ ] Manual testing performed
28+
29+
### Test Details
30+
<!-- Provide details about how to test these changes -->
31+
32+
## Screenshots (if applicable)
33+
<!-- Add screenshots to help explain your changes -->
34+
35+
## Reviewer Notes
36+
<!-- Any additional context or notes for reviewers -->
37+
38+
## Checklist
39+
- [ ] My code follows the project's style guidelines
40+
- [ ] I have performed a self-review of my code
41+
- [ ] I have commented my code where necessary
42+
- [ ] I have updated the documentation (if needed)
43+
- [ ] My changes generate no new warnings
44+
- [ ] Any dependent changes have been merged and published

.github/labeler.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Label configuration for actions/labeler
2+
# Documentation: https://github.com/actions/labeler
3+
4+
"GitHub Actions":
5+
- changed-files:
6+
- any-glob-to-any-file: '.github/**/*'
7+
8+
"Documentation":
9+
- changed-files:
10+
- any-glob-to-any-file:
11+
- '**/*.md'
12+
- 'docs/**/*'
13+
14+
"CI/CD":
15+
- changed-files:
16+
- any-glob-to-any-file: '.github/workflows/**/*'
17+
18+
"Frontend":
19+
- changed-files:
20+
- any-glob-to-any-file:
21+
- 'cmd/llvm-obfuscator/frontend/**/*'
22+
- '**/*.tsx'
23+
- '**/*.ts'
24+
25+
"Backend":
26+
- changed-files:
27+
- any-glob-to-any-file:
28+
- 'cmd/llvm-obfuscator/**/*.py'
29+
- 'cmd/llvm-obfuscator/api/**/*'
30+
- 'cmd/llvm-obfuscator/cli/**/*'
31+
- 'cmd/llvm-obfuscator/core/**/*'
32+
33+
"MLIR":
34+
- changed-files:
35+
- any-glob-to-any-file: 'mlir-obs/**/*'
36+
37+
"Docker":
38+
- changed-files:
39+
- any-glob-to-any-file:
40+
- '**/Dockerfile*'
41+
- '**/docker-compose.yml'
42+
- '**/docker-compose.yaml'
43+
44+
"Dependencies":
45+
- changed-files:
46+
- any-glob-to-any-file:
47+
- '**/package.json'
48+
- '**/package-lock.json'
49+
- '**/requirements.txt'
50+
- '**/requirements*.txt'
51+
52+
"Config":
53+
- changed-files:
54+
- any-glob-to-any-file:
55+
- '**/*.config.*'
56+
- '**/tsconfig.json'
57+
- '**/vite.config.*'
58+
- '**/.eslintrc*'
59+
60+
"Phoronix":
61+
- changed-files:
62+
- any-glob-to-any-file: 'phoronix/**/*'
63+
64+
"Tests":
65+
- changed-files:
66+
- any-glob-to-any-file:
67+
- '**/tests/**/*'
68+
- '**/test_*.py'
69+
- '**/*_test.py'
70+
- 'obfuscation_test_suite/**/*'
71+
72+
"LLVM":
73+
- changed-files:
74+
- any-glob-to-any-file:
75+
- 'llvm-patches/**/*'
76+
- '**/*.ll'
77+
- '**/*.bc'
78+
79+
"Binary Obfuscation":
80+
- changed-files:
81+
- any-glob-to-any-file: 'binary_obfuscation_pipeline/**/*'

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
frontend-checks:
11+
name: Frontend Checks
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: cmd/llvm-obfuscator/frontend
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
cache-dependency-path: cmd/llvm-obfuscator/frontend/package-lock.json
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run linter
32+
run: npm run lint
33+
34+
- name: Build
35+
run: npm run build
36+
37+
backend-checks:
38+
name: Backend Checks
39+
runs-on: ubuntu-latest
40+
defaults:
41+
run:
42+
working-directory: cmd/llvm-obfuscator
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
48+
- name: Setup Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: '3.10'
52+
cache: 'pip'
53+
cache-dependency-path: cmd/llvm-obfuscator/requirements.txt
54+
55+
- name: Install dependencies
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install -r requirements.txt
59+
60+
- name: Run tests with coverage
61+
run: pytest --cov=core --cov-report=term-missing --cov-report=xml -v
62+
continue-on-error: true
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: Issue Command Bot
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
issues: write
9+
pull-requests: write
10+
11+
jobs:
12+
command-bot:
13+
runs-on: ubuntu-latest
14+
if: github.event.issue && startsWith(github.event.comment.body, '/')
15+
steps:
16+
- name: Handle /assign command
17+
if: contains(github.event.comment.body, '/assign')
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
const comment = context.payload.comment.body;
22+
const issueNumber = context.issue.number;
23+
24+
// Extract username from /assign @username or use commenter
25+
const assignMatch = comment.match(/\/assign\s+@?(\S+)/);
26+
const assignee = assignMatch ? assignMatch[1] : context.payload.comment.user.login;
27+
28+
try {
29+
await github.rest.issues.addAssignees({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
issue_number: issueNumber,
33+
assignees: [assignee]
34+
});
35+
36+
await github.rest.issues.createComment({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
issue_number: issueNumber,
40+
body: `Assigned @${assignee} to this issue.`
41+
});
42+
} catch (error) {
43+
await github.rest.issues.createComment({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
issue_number: issueNumber,
47+
body: `Failed to assign @${assignee}: ${error.message}`
48+
});
49+
}
50+
51+
- name: Handle /close command
52+
if: contains(github.event.comment.body, '/close')
53+
uses: actions/github-script@v7
54+
with:
55+
script: |
56+
await github.rest.issues.update({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
issue_number: context.issue.number,
60+
state: 'closed'
61+
});
62+
63+
await github.rest.issues.createComment({
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
issue_number: context.issue.number,
67+
body: `Issue closed by @${context.payload.comment.user.login}`
68+
});
69+
70+
- name: Handle /reopen command
71+
if: contains(github.event.comment.body, '/reopen')
72+
uses: actions/github-script@v7
73+
with:
74+
script: |
75+
await github.rest.issues.update({
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
issue_number: context.issue.number,
79+
state: 'open'
80+
});
81+
82+
await github.rest.issues.createComment({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
issue_number: context.issue.number,
86+
body: `Issue reopened by @${context.payload.comment.user.login}`
87+
});
88+
89+
- name: Handle /label command
90+
if: contains(github.event.comment.body, '/label')
91+
uses: actions/github-script@v7
92+
with:
93+
script: |
94+
const comment = context.payload.comment.body;
95+
const labelMatch = comment.match(/\/label\s+(\S+)/);
96+
97+
if (labelMatch) {
98+
const label = labelMatch[1];
99+
try {
100+
await github.rest.issues.addLabels({
101+
owner: context.repo.owner,
102+
repo: context.repo.repo,
103+
issue_number: context.issue.number,
104+
labels: [label]
105+
});
106+
107+
await github.rest.issues.createComment({
108+
owner: context.repo.owner,
109+
repo: context.repo.repo,
110+
issue_number: context.issue.number,
111+
body: `Added label: \`${label}\``
112+
});
113+
} catch (error) {
114+
await github.rest.issues.createComment({
115+
owner: context.repo.owner,
116+
repo: context.repo.repo,
117+
issue_number: context.issue.number,
118+
body: `Failed to add label \`${label}\`: ${error.message}`
119+
});
120+
}
121+
}
122+
123+
- name: Handle /needs-triage command
124+
if: contains(github.event.comment.body, '/needs-triage')
125+
uses: actions/github-script@v7
126+
with:
127+
script: |
128+
await github.rest.issues.addLabels({
129+
owner: context.repo.owner,
130+
repo: context.repo.repo,
131+
issue_number: context.issue.number,
132+
labels: ['needs-triage']
133+
});
134+
135+
await github.rest.issues.createComment({
136+
owner: context.repo.owner,
137+
repo: context.repo.repo,
138+
issue_number: context.issue.number,
139+
body: 'Added `needs-triage` label. A maintainer will review this issue soon.'
140+
});
141+
142+
- name: Handle /cc command
143+
if: contains(github.event.comment.body, '/cc')
144+
uses: actions/github-script@v7
145+
with:
146+
script: |
147+
const comment = context.payload.comment.body;
148+
const ccMatch = comment.match(/\/cc\s+(.+)/);
149+
150+
if (ccMatch) {
151+
const users = ccMatch[1].split(/[,\s]+/).filter(u => u.startsWith('@')).map(u => u.substring(1));
152+
153+
if (users.length > 0) {
154+
const mentions = users.map(u => `@${u}`).join(', ');
155+
await github.rest.issues.createComment({
156+
owner: context.repo.owner,
157+
repo: context.repo.repo,
158+
issue_number: context.issue.number,
159+
body: `CC: ${mentions}`
160+
});
161+
}
162+
}
163+
164+
- name: Handle /help command
165+
if: contains(github.event.comment.body, '/help')
166+
uses: actions/github-script@v7
167+
with:
168+
script: |
169+
const helpMessage = `
170+
## Available Commands
171+
172+
| Command | Description |
173+
|---------|-------------|
174+
| \`/assign\` | Assign yourself to this issue |
175+
| \`/assign @username\` | Assign a specific user to this issue |
176+
| \`/close\` | Close this issue |
177+
| \`/reopen\` | Reopen this issue |
178+
| \`/label <name>\` | Add a label to this issue |
179+
| \`/needs-triage\` | Mark this issue as needing triage |
180+
| \`/cc @user1, @user2\` | Mention users to notify them |
181+
| \`/help\` | Show this help message |
182+
`;
183+
184+
await github.rest.issues.createComment({
185+
owner: context.repo.owner,
186+
repo: context.repo.repo,
187+
issue_number: context.issue.number,
188+
body: helpMessage
189+
});

0 commit comments

Comments
 (0)