Skip to content

Commit fb8d493

Browse files
chambridgetarilabs
andauthored
ci: Enable execution of make test-fuzz via pull request comment (kubeflow#1435)
* ci: Enable execution of make test-fuzz via pull request comment * Provide simplified mechanism for executing `make test-fuzz` for specific pull requests Signed-off-by: Chris Hambridge <[email protected]> * ci: Fix comment check and update status checks section. Signed-off-by: Chris Hambridge <[email protected]> * Update .github/workflows/test-fuzz.yml Signed-off-by: Matteo Mortari <[email protected]> --------- Signed-off-by: Chris Hambridge <[email protected]> Signed-off-by: Matteo Mortari <[email protected]> Co-authored-by: Matteo Mortari <[email protected]>
1 parent 9be8560 commit fb8d493

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

.github/workflows/test-fuzz.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Test Fuzz on Comment
2+
on:
3+
issue_comment:
4+
types: [created]
5+
6+
permissions:
7+
contents: read
8+
checks: write # Required to create/update checks
9+
10+
env:
11+
IMG_REGISTRY: ghcr.io
12+
IMG_ORG: kubeflow
13+
IMG_REPO: model-registry/server
14+
IMG_VERSION: cicd
15+
PUSH_IMAGE: false
16+
17+
jobs:
18+
test-fuzz:
19+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test-fuzz')
20+
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
working-directory: clients/python
24+
steps:
25+
- name: Get PR details
26+
id: pr
27+
uses: actions/github-script@v7
28+
with:
29+
script: |
30+
const pr = await github.rest.pulls.get({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
pull_number: context.issue.number
34+
});
35+
return {
36+
sha: pr.data.head.sha,
37+
ref: pr.data.head.ref
38+
};
39+
40+
- name: Create Check Run
41+
id: create-check
42+
uses: actions/github-script@v7
43+
with:
44+
script: |
45+
const result = await github.rest.checks.create({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
name: 'test-fuzz',
49+
head_sha: '${{ fromJson(steps.pr.outputs.result).sha }}',
50+
status: 'in_progress',
51+
started_at: new Date().toISOString(),
52+
output: {
53+
title: 'Fuzz Test',
54+
summary: 'Running fuzz tests for the pull request'
55+
}
56+
});
57+
return result.data.id;
58+
59+
- name: Checkout PR
60+
uses: actions/checkout@v4
61+
with:
62+
ref: ${{ fromJson(steps.pr.outputs.result).sha }}
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: "3.10"
68+
69+
- name: Install Poetry
70+
run: |
71+
pipx install poetry
72+
73+
- name: Remove AppArmor profile for mysql in KinD on GHA # https://github.com/kubeflow/manifests/issues/2507
74+
run: |
75+
set -x
76+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
77+
78+
- name: Run Fuzz Tests
79+
id: run-tests
80+
run: |
81+
echo "Starting fuzz tests..."
82+
make test-fuzz
83+
84+
- name: Update Check Run on Success
85+
if: success()
86+
uses: actions/github-script@v7
87+
with:
88+
script: |
89+
await github.rest.checks.update({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
check_run_id: '${{ steps.create-check.outputs.result }}',
93+
status: 'completed',
94+
conclusion: 'success',
95+
completed_at: new Date().toISOString(),
96+
output: {
97+
title: 'Fuzz Test',
98+
summary: 'Fuzz tests completed successfully'
99+
}
100+
});
101+
102+
- name: Update Check Run on Failure
103+
if: failure()
104+
uses: actions/github-script@v7
105+
with:
106+
script: |
107+
await github.rest.checks.update({
108+
owner: context.repo.owner,
109+
repo: context.repo.repo,
110+
check_run_id: '${{ steps.create-check.outputs.result }}',
111+
status: 'completed',
112+
conclusion: 'failure',
113+
completed_at: new Date().toISOString(),
114+
output: {
115+
title: 'Fuzz Test',
116+
summary: 'Fuzz tests failed'
117+
}
118+
});

0 commit comments

Comments
 (0)