Skip to content

Commit feacd50

Browse files
committed
ci: add layered integration workflows and optional DM tests
1 parent 2baf5e2 commit feacd50

2 files changed

Lines changed: 171 additions & 0 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,38 @@ jobs:
6161
/tmp/test_venv/bin/pip install dist_fixed/*.whl
6262
/tmp/test_venv/bin/python -c "import dmPython; print('dmPython version:', dmPython.version)"
6363
64+
- name: Build extension for optional integration tests
65+
if: ${{ secrets.DM_TEST_HOST != '' && secrets.DM_TEST_PORT != '' && secrets.DM_TEST_USER != '' && secrets.DM_TEST_PASSWORD != '' }}
66+
run: DMPYTHON_SKIP_GO_BUILD=1 python setup.py build_ext --inplace
67+
68+
- name: Run optional DM integration tests
69+
if: ${{ secrets.DM_TEST_HOST != '' && secrets.DM_TEST_PORT != '' && secrets.DM_TEST_USER != '' && secrets.DM_TEST_PASSWORD != '' }}
70+
env:
71+
DYLD_LIBRARY_PATH: ${{ github.workspace }}/dpi_bridge
72+
DM_TEST_HOST: ${{ secrets.DM_TEST_HOST }}
73+
DM_TEST_PORT: ${{ secrets.DM_TEST_PORT }}
74+
DM_TEST_USER: ${{ secrets.DM_TEST_USER }}
75+
DM_TEST_PASSWORD: ${{ secrets.DM_TEST_PASSWORD }}
76+
DM_TEST_BOUNDARY_SIZES: ${{ secrets.DM_TEST_BOUNDARY_SIZES }}
77+
DM_TEST_STRESS_ROWS: ${{ secrets.DM_TEST_STRESS_ROWS }}
78+
DM_TEST_STRESS_WORKERS: ${{ secrets.DM_TEST_STRESS_WORKERS }}
79+
DM_TEST_CHURN_LOOPS: ${{ secrets.DM_TEST_CHURN_LOOPS }}
80+
DM_TEST_GC_LOOPS: ${{ secrets.DM_TEST_GC_LOOPS }}
81+
run: |
82+
python -m pip install pytest pytest-timeout pytest-cov
83+
python -m pytest -q -m requires_dm tests --cov=. --cov-report=term-missing --cov-report=xml:coverage.xml
84+
85+
- name: Upload optional integration coverage
86+
if: ${{ secrets.DM_TEST_HOST != '' && secrets.DM_TEST_PORT != '' && secrets.DM_TEST_USER != '' && secrets.DM_TEST_PASSWORD != '' }}
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: coverage-wheel-py${{ matrix.python-version }}
90+
path: coverage.xml
91+
92+
- name: Skip optional integration tests (missing DM secrets)
93+
if: ${{ secrets.DM_TEST_HOST == '' || secrets.DM_TEST_PORT == '' || secrets.DM_TEST_USER == '' || secrets.DM_TEST_PASSWORD == '' }}
94+
run: echo "Skipping requires_dm tests: DM_TEST_HOST/PORT/USER/PASSWORD secrets not fully configured."
95+
6496
- uses: actions/upload-artifact@v4
6597
with:
6698
name: wheel-arm64-py${{ matrix.python-version }}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Integration Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "0 18 * * *"
9+
10+
jobs:
11+
pr-lightweight:
12+
if: github.event_name == 'pull_request'
13+
runs-on: macos-14
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-go@v5
18+
with:
19+
go-version: "1.21"
20+
cache-dependency-path: dpi_bridge/go.sum
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.10"
25+
26+
- name: Check DM secrets availability
27+
id: dm_ready
28+
run: |
29+
if [ -n "${{ secrets.DM_TEST_HOST }}" ] && [ -n "${{ secrets.DM_TEST_PORT }}" ] && [ -n "${{ secrets.DM_TEST_USER }}" ] && [ -n "${{ secrets.DM_TEST_PASSWORD }}" ]; then
30+
echo "available=true" >> "$GITHUB_OUTPUT"
31+
else
32+
echo "available=false" >> "$GITHUB_OUTPUT"
33+
fi
34+
35+
- name: Decode DPI headers
36+
if: steps.dm_ready.outputs.available == 'true'
37+
env:
38+
DPI_HEADERS_TAR_B64: ${{ secrets.DPI_HEADERS_TAR_B64 }}
39+
run: |
40+
mkdir -p dpi_include
41+
echo "$DPI_HEADERS_TAR_B64" | base64 -d | tar xzf - -C dpi_include/
42+
43+
- name: Build Go bridge library
44+
if: steps.dm_ready.outputs.available == 'true'
45+
run: |
46+
cd dpi_bridge && go build -buildmode=c-shared -o libdmdpi.dylib .
47+
install_name_tool -id @rpath/libdmdpi.dylib libdmdpi.dylib
48+
49+
- name: Build extension and run P0/P1
50+
if: steps.dm_ready.outputs.available == 'true'
51+
env:
52+
DYLD_LIBRARY_PATH: ${{ github.workspace }}/dpi_bridge
53+
DM_TEST_HOST: ${{ secrets.DM_TEST_HOST }}
54+
DM_TEST_PORT: ${{ secrets.DM_TEST_PORT }}
55+
DM_TEST_USER: ${{ secrets.DM_TEST_USER }}
56+
DM_TEST_PASSWORD: ${{ secrets.DM_TEST_PASSWORD }}
57+
DM_TEST_BOUNDARY_SIZES: ${{ secrets.DM_TEST_BOUNDARY_SIZES }}
58+
run: |
59+
python -m pip install pytest pytest-timeout pytest-cov
60+
python setup.py build_ext --inplace
61+
python -m pytest -q tests/integration -m "p0_stability or p1_contract" --cov=. --cov-report=term-missing --cov-report=xml:coverage.xml
62+
63+
- name: Upload coverage report (PR)
64+
if: steps.dm_ready.outputs.available == 'true'
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: coverage-pr
68+
path: coverage.xml
69+
70+
- name: Skip lightweight integration tests
71+
if: steps.dm_ready.outputs.available != 'true'
72+
run: echo "Skipping PR integration tests: DM secrets are not configured."
73+
74+
full-regression:
75+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
76+
runs-on: macos-14
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- uses: actions/setup-go@v5
81+
with:
82+
go-version: "1.21"
83+
cache-dependency-path: dpi_bridge/go.sum
84+
85+
- uses: actions/setup-python@v5
86+
with:
87+
python-version: "3.10"
88+
89+
- name: Check DM secrets availability
90+
id: dm_ready
91+
run: |
92+
if [ -n "${{ secrets.DM_TEST_HOST }}" ] && [ -n "${{ secrets.DM_TEST_PORT }}" ] && [ -n "${{ secrets.DM_TEST_USER }}" ] && [ -n "${{ secrets.DM_TEST_PASSWORD }}" ]; then
93+
echo "available=true" >> "$GITHUB_OUTPUT"
94+
else
95+
echo "available=false" >> "$GITHUB_OUTPUT"
96+
fi
97+
98+
- name: Decode DPI headers
99+
if: steps.dm_ready.outputs.available == 'true'
100+
env:
101+
DPI_HEADERS_TAR_B64: ${{ secrets.DPI_HEADERS_TAR_B64 }}
102+
run: |
103+
mkdir -p dpi_include
104+
echo "$DPI_HEADERS_TAR_B64" | base64 -d | tar xzf - -C dpi_include/
105+
106+
- name: Build Go bridge library
107+
if: steps.dm_ready.outputs.available == 'true'
108+
run: |
109+
cd dpi_bridge && go build -buildmode=c-shared -o libdmdpi.dylib .
110+
install_name_tool -id @rpath/libdmdpi.dylib libdmdpi.dylib
111+
112+
- name: Build extension and run P0/P1/P2
113+
if: steps.dm_ready.outputs.available == 'true'
114+
env:
115+
DYLD_LIBRARY_PATH: ${{ github.workspace }}/dpi_bridge
116+
DM_TEST_HOST: ${{ secrets.DM_TEST_HOST }}
117+
DM_TEST_PORT: ${{ secrets.DM_TEST_PORT }}
118+
DM_TEST_USER: ${{ secrets.DM_TEST_USER }}
119+
DM_TEST_PASSWORD: ${{ secrets.DM_TEST_PASSWORD }}
120+
DM_TEST_BOUNDARY_SIZES: ${{ secrets.DM_TEST_BOUNDARY_SIZES }}
121+
DM_TEST_STRESS_ROWS: ${{ secrets.DM_TEST_STRESS_ROWS }}
122+
DM_TEST_STRESS_WORKERS: ${{ secrets.DM_TEST_STRESS_WORKERS }}
123+
DM_TEST_CHURN_LOOPS: ${{ secrets.DM_TEST_CHURN_LOOPS }}
124+
DM_TEST_GC_LOOPS: ${{ secrets.DM_TEST_GC_LOOPS }}
125+
run: |
126+
python -m pip install pytest pytest-timeout pytest-cov
127+
python setup.py build_ext --inplace
128+
python -m pytest -q tests/integration -m "p0_stability or p1_contract or p2_scale" --cov=. --cov-report=term-missing --cov-report=xml:coverage.xml
129+
130+
- name: Upload coverage report (full)
131+
if: steps.dm_ready.outputs.available == 'true'
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: coverage-full
135+
path: coverage.xml
136+
137+
- name: Skip full integration tests
138+
if: steps.dm_ready.outputs.available != 'true'
139+
run: echo "Skipping full integration tests: DM secrets are not configured."

0 commit comments

Comments
 (0)