-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
179 lines (153 loc) · 4.86 KB
/
action.yml
File metadata and controls
179 lines (153 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: 'gpuci - GPU Kernel Testing'
description: 'Test CUDA kernels across multiple GPUs via SSH'
author: 'RightNow AI'
branding:
icon: 'cpu'
color: 'green'
inputs:
kernel:
description: 'Path to CUDA kernel file(s). Supports glob patterns.'
required: true
config:
description: 'Path to gpuci.yml config file'
required: false
default: 'gpuci.yml'
target:
description: 'Filter to specific target(s) by name or GPU type'
required: false
runs:
description: 'Number of benchmark iterations'
required: false
default: '10'
warmup:
description: 'Number of warmup iterations'
required: false
default: '3'
ssh-key:
description: 'SSH private key for connecting to GPU machines'
required: false
brev-token:
description: 'Brev.dev API token (if using Brev provider)'
required: false
post-comment:
description: 'Post results as PR comment (true/false)'
required: false
default: 'true'
fail-on-error:
description: 'Fail the workflow if any GPU test fails'
required: false
default: 'true'
outputs:
results:
description: 'JSON results from gpuci'
value: ${{ steps.run-gpuci.outputs.results }}
passed:
description: 'Whether all tests passed (true/false)'
value: ${{ steps.run-gpuci.outputs.passed }}
runs:
using: 'composite'
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install gpuci
shell: bash
run: |
pip install gpuci
gpuci --version
- name: Setup SSH key
if: inputs.ssh-key != ''
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ inputs.ssh-key }}" > ~/.ssh/gpuci_key
chmod 600 ~/.ssh/gpuci_key
# Add to ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/gpuci_key
- name: Setup Brev CLI
if: inputs.brev-token != ''
shell: bash
run: |
curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/bin/install-latest.sh | bash
echo "${{ inputs.brev-token }}" | brev login --token
- name: Run gpuci tests
id: run-gpuci
shell: bash
run: |
set +e # Don't exit on error, we handle it
# Build command
CMD="gpuci test ${{ inputs.kernel }}"
CMD="$CMD --config ${{ inputs.config }}"
CMD="$CMD --runs ${{ inputs.runs }}"
CMD="$CMD --warmup ${{ inputs.warmup }}"
if [ -n "${{ inputs.target }}" ]; then
CMD="$CMD --target ${{ inputs.target }}"
fi
# Run and capture output
OUTPUT=$(eval $CMD 2>&1)
EXIT_CODE=$?
echo "$OUTPUT"
# Save output for comment
echo "results<<EOF" >> $GITHUB_OUTPUT
echo "$OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
if [ $EXIT_CODE -eq 0 ]; then
echo "passed=true" >> $GITHUB_OUTPUT
else
echo "passed=false" >> $GITHUB_OUTPUT
fi
# Fail if configured to do so
if [ "${{ inputs.fail-on-error }}" = "true" ] && [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi
- name: Post PR comment
if: inputs.post-comment == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const results = `${{ steps.run-gpuci.outputs.results }}`;
const passed = '${{ steps.run-gpuci.outputs.passed }}' === 'true';
const status = passed ? '✅ All GPU tests passed' : '❌ Some GPU tests failed';
const body = `## GPU Kernel Test Results
${status}
<details>
<summary>Full Results</summary>
\`\`\`
${results}
\`\`\`
</details>
---
*Tested with [gpuci](https://github.com/rightnow-ai/gpuci)*`;
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(c =>
c.user.type === 'Bot' && c.body.includes('GPU Kernel Test Results')
);
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: body
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
}
- name: Cleanup SSH key
if: always() && inputs.ssh-key != ''
shell: bash
run: |
rm -f ~/.ssh/gpuci_key