forked from Genesis-Embodied-AI/quadrants
-
Notifications
You must be signed in to change notification settings - Fork 0
210 lines (205 loc) · 6.9 KB
/
linux.yml
File metadata and controls
210 lines (205 loc) · 6.9 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Linux
on:
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
# Developing directly on ubuntu arm not supported currently.
# Need to dev inside a manylinux container, when developing using linux arm.
OS: ['ubuntu-22.04']
name: Linux ${{ matrix.OS }} Build
runs-on: ${{ matrix.OS }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python check
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Linux prerequisites
run: |
bash .github/workflows/scripts_new/linux/1_prerequisites.sh
- name: Linux build
run: |
bash .github/workflows/scripts_new/linux/2_build.sh
- name: Linux install
run: |
bash .github/workflows/scripts_new/linux/3_install.sh
- name: Linux test
run: |
bash .github/workflows/scripts_new/linux/4_test.sh
- name: Upload wheel for CUDA job
if: always()
uses: actions/upload-artifact@v4
with:
name: linux-wheel
path: dist/*.whl
- name: Upload CPU coverage data
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-cpu
path: |
coverage.xml
pytest-coverage.txt
test-cuda:
name: Linux CUDA Test
needs: build
runs-on: gpu-t4-4-core
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python check
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install CUDA libraries
run: |
sudo apt-get install -y libcusolver-dev-12-8 libcusolver-12-8 libcusparse-dev-12-8 libcusparse-12-8 libnvjitlink-12-8 libcublas-12-8
echo "/usr/local/cuda/targets/x86_64-linux/lib" | sudo tee /etc/ld.so.conf.d/cuda-targets.conf
sudo ldconfig
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: linux-wheel
- name: Install quadrants
run: |
set -x
mkdir -p dist
mv *.whl dist/
pip install dist/*.whl
- name: Install test requirements
run: |
pip install --group test
pip install -r requirements_test_xdist.txt
- name: Run CUDA tests with coverage
run: |
bash .github/workflows/scripts_new/linux/4_test_cuda.sh
- name: Upload CUDA coverage data
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-cuda
path: coverage.xml
coverage-comment:
if: github.event_name == 'pull_request' && always()
needs: [build, test-cuda]
runs-on: ubuntu-latest
permissions:
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python check
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Download CPU coverage
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: coverage-cpu
path: coverage-cpu
- name: Download CUDA coverage
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: coverage-cuda
path: coverage-cuda
- name: Generate coverage reports
continue-on-error: true
run: |
COV_XMLS=""
if [ -f coverage-cpu/coverage.xml ]; then
COV_XMLS="coverage-cpu/coverage.xml"
fi
if [ -f coverage-cuda/coverage.xml ]; then
COV_XMLS="$COV_XMLS coverage-cuda/coverage.xml"
fi
if [ -z "$COV_XMLS" ]; then
echo "No coverage XML files found, skipping report"
exit 0
fi
HEAD_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-9)
python tests/coverage_report.py --report-only \
--compare-branch=origin/${{ github.base_ref }} \
--coverage-xml $COV_XMLS \
--commit-hash "$HEAD_SHA" \
--format markdown > coverage-check.md || true
python tests/coverage_report.py --report-only \
--compare-branch=origin/${{ github.base_ref }} \
--coverage-xml $COV_XMLS \
--commit-hash "$HEAD_SHA" \
--format markdown-summary > coverage-comment.md || true
- name: Upload full coverage report
if: always() && hashFiles('coverage-check.md') != ''
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-check.md
- name: Publish coverage check
if: always() && hashFiles('coverage-check.md') != ''
id: publish_check
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
let body = fs.readFileSync('coverage-check.md', 'utf8');
const MAX_TEXT = 65000;
let truncated = false;
if (body.length > MAX_TEXT) {
body = body.substring(0, MAX_TEXT) + '\n\n---\n*Report truncated. Download the full report from the workflow artifacts.*';
truncated = true;
}
const summary = truncated
? 'Per-line coverage annotations (truncated — see artifacts for full report).'
: 'See details below for per-line coverage annotations.';
const check = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.pull_request.head.sha,
name: 'Coverage Report',
status: 'completed',
conclusion: 'success',
output: {
title: 'Diff Coverage Report',
summary: summary,
text: body
}
});
core.setOutput('check-url', check.data.html_url);
- name: Post coverage comment
if: always() && hashFiles('coverage-comment.md') != ''
uses: actions/github-script@v8
env:
REPORT_URL: ${{ steps.publish_check.outputs.check-url }}
with:
script: |
const fs = require('fs');
let body = fs.readFileSync('coverage-comment.md', 'utf8');
const url = process.env.REPORT_URL;
if (url) {
body += `\n\n[Full annotated report](${url})`;
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: body
});