Skip to content

Commit 2284fc1

Browse files
Michael D BrownMichael D. Brown
andauthored
Fix / re-org CI (#288)
* renaming system integration tests to something more appropriate * WIP to isolate unit tests from integration tests * WIP * fix typo * fix after merge from main * Merged changes from prior PRs into comp-integration * separated integration tests for components into separate workflow * fixed label * cleanup * put system integration tests back on nightly schedule * Put component integration tests back on for push to main * Disable some tests because target is not publicly available. * appease linter * trying HTTPS instead of SSH * disable test with non-public target. * disable finicky tests * update label for component integration tests. --------- Co-authored-by: Michael D. Brown <michaeldbrown@Michaels-MacBook-Pro-4.local>
1 parent c25b395 commit 2284fc1

7 files changed

Lines changed: 213 additions & 198 deletions

File tree

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: Component Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# Always run full test suite on main branch
8+
pull_request:
9+
10+
schedule:
11+
# Run integration tests daily at 2 AM UTC
12+
- cron: '0 2 * * *'
13+
workflow_dispatch:
14+
inputs:
15+
components:
16+
description: 'Components to test (comma-separated: common,patcher,program-model,seed-gen)'
17+
required: false
18+
default: 'common,patcher,program-model,seed-gen'
19+
type: string
20+
run_integration:
21+
description: 'Run integration tests'
22+
required: false
23+
default: false
24+
type: boolean
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
30+
jobs:
31+
# Integration tests - run on schedule, manual trigger, or labeled PRs
32+
test-integration:
33+
# Run if:
34+
# - Scheduled run
35+
# - Manual dispatch with run_integration=true
36+
# - PR with 'integration-tests' label
37+
if: |
38+
github.event_name == 'push' ||
39+
github.event_name == 'schedule' ||
40+
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_integration == 'true') ||
41+
contains(github.event.pull_request.labels.*.name, 'integration-tests')
42+
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
include:
47+
- component: common
48+
coverage_module: buttercup.common
49+
python: "3.12"
50+
- component: patcher
51+
coverage_module: buttercup.patcher
52+
python: "3.12"
53+
- component: program-model
54+
coverage_module: buttercup.program_model
55+
python: "3.12"
56+
- component: seed-gen
57+
coverage_module: buttercup.seed_gen
58+
python: "3.12"
59+
60+
runs-on: ubuntu-latest
61+
services:
62+
redis:
63+
image: redis
64+
options: >-
65+
--health-cmd "redis-cli ping"
66+
--health-interval 10s
67+
--health-timeout 5s
68+
--health-retries 5
69+
ports:
70+
- 6379:6379
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
with:
75+
persist-credentials: false
76+
submodules: true
77+
78+
- name: Check if component should be tested
79+
id: should_test
80+
if: github.event_name == 'workflow_dispatch'
81+
run: |
82+
components="${{ github.event.inputs.components }}"
83+
if [[ -z "$components" ]] || [[ "$components" == *"${{ matrix.component }}"* ]]; then
84+
echo "test=true" >> $GITHUB_OUTPUT
85+
else
86+
echo "test=false" >> $GITHUB_OUTPUT
87+
fi
88+
89+
- name: Install uv
90+
if: steps.should_test.outputs.test != 'false'
91+
uses: astral-sh/setup-uv@v6
92+
93+
- name: Setup uv cache
94+
if: steps.should_test.outputs.test != 'false'
95+
uses: actions/cache@v4
96+
with:
97+
path: |
98+
~/.cache/uv
99+
~/.local/share/uv
100+
key: ${{ runner.os }}-uv-integration-${{ matrix.component }}-${{ hashFiles(format('{0}/uv.lock', matrix.component)) }}
101+
restore-keys: |
102+
${{ runner.os }}-uv-integration-${{ matrix.component }}-
103+
${{ runner.os }}-uv-
104+
105+
- name: Download Wasm runtime
106+
if: matrix.component == 'seed-gen' && steps.should_test.outputs.test != 'false'
107+
run: wget https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/python%2F3.12.0%2B20231211-040d5a6/python-3.12.0.wasm
108+
working-directory: seed-gen
109+
110+
- name: Install integration test dependencies
111+
if: steps.should_test.outputs.test != 'false'
112+
run: |
113+
sudo apt-get update
114+
sudo apt-get install -y codequery ripgrep
115+
make install-cscope
116+
117+
- name: Prepare environment
118+
if: steps.should_test.outputs.test != 'false'
119+
run: |
120+
export DEBIAN_FRONTEND=noninteractive
121+
sudo apt-get update
122+
sudo mkdir -p /crs_scratch
123+
sudo chmod -R 777 /crs_scratch
124+
125+
- name: Setup ${{ matrix.component }} component
126+
if: steps.should_test.outputs.test != 'false'
127+
run: |
128+
uv sync --all-extras --frozen
129+
uv pip install --isolated pytest-html>=4.1.1 pytest-cov>=6.0.0
130+
working-directory: ${{ matrix.component }}
131+
132+
- name: Run program-model libpng integration test
133+
if: matrix.component == 'program-model' && steps.should_test.outputs.test != 'false'
134+
run: |
135+
uv run --frozen pytest -svv --runintegration tests/c/test_libpng.py \
136+
--junit-xml=integration-test-results.xml \
137+
--html=integration-test-report.html \
138+
--self-contained-html \
139+
--cov=${{ matrix.coverage_module }} \
140+
--cov-report=xml:integration-coverage.xml \
141+
--cov-report=html:integration-htmlcov \
142+
--cov-report=term
143+
env:
144+
PYTHON_WASM_BUILD_PATH: "python-3.12.0.wasm"
145+
working-directory: ${{ matrix.component }}
146+
timeout-minutes: 30
147+
148+
- name: Run integration tests on ${{ matrix.component }}
149+
if: matrix.component != 'program-model' && steps.should_test.outputs.test != 'false'
150+
run: |
151+
uv run --frozen pytest -svv --runintegration \
152+
--junit-xml=integration-test-results.xml \
153+
--html=integration-test-report.html \
154+
--self-contained-html \
155+
--cov=${{ matrix.coverage_module }} \
156+
--cov-report=xml:integration-coverage.xml \
157+
--cov-report=html:integration-htmlcov \
158+
--cov-report=term
159+
env:
160+
PYTHON_WASM_BUILD_PATH: "python-3.12.0.wasm"
161+
working-directory: ${{ matrix.component }}
162+
timeout-minutes: 30
163+
164+
- name: Generate integration test summary
165+
if: always() && steps.should_test.outputs.test != 'false'
166+
run: |
167+
echo "### Integration Test Results: ${{ matrix.component }}" >> $GITHUB_STEP_SUMMARY
168+
echo "" >> $GITHUB_STEP_SUMMARY
169+
if [ -f ${{ matrix.component }}/integration-test-results.xml ]; then
170+
python -c "
171+
import xml.etree.ElementTree as ET
172+
tree = ET.parse('${{ matrix.component }}/integration-test-results.xml')
173+
root = tree.getroot()
174+
tests = root.get('tests', '0')
175+
failures = root.get('failures', '0')
176+
errors = root.get('errors', '0')
177+
skipped = root.get('skipped', '0')
178+
time = root.get('time', '0')
179+
print(f'- **Total Tests**: {tests}')
180+
print(f'- **Passed**: {int(tests) - int(failures) - int(errors) - int(skipped)}')
181+
print(f'- **Failed**: {failures}')
182+
print(f'- **Errors**: {errors}')
183+
print(f'- **Skipped**: {skipped}')
184+
print(f'- **Duration**: {float(time):.2f}s')
185+
" >> $GITHUB_STEP_SUMMARY
186+
else
187+
echo "No integration test results found" >> $GITHUB_STEP_SUMMARY
188+
fi
189+
190+
- name: Upload integration test results
191+
if: always() && steps.should_test.outputs.test != 'false'
192+
uses: actions/upload-artifact@v4
193+
with:
194+
name: integration-test-results-${{ matrix.component }}-py${{ matrix.python }}
195+
path: |
196+
${{ matrix.component }}/integration-test-results.xml
197+
${{ matrix.component }}/integration-test-report.html
198+
${{ matrix.component }}/integration-coverage.xml
199+
${{ matrix.component }}/integration-htmlcov/
200+
retention-days: 30

.github/workflows/integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Minikube Integration Tests
1+
name: System Integration Tests
22

33
on:
44
# Daily schedule - 3 AM UTC
@@ -64,6 +64,7 @@ jobs:
6464
integration:
6565
# Only run on PRs if they have the 'full-integration' label
6666
if: |
67+
github.event_name == 'schedule' ||
6768
github.event_name != 'pull_request' ||
6869
contains(github.event.pull_request.labels.*.name, 'full-integration')
6970
runs-on: gha-ubuntu-8

0 commit comments

Comments
 (0)