|
8 | 8 | test-bigquery-magics: |
9 | 9 | runs-on: ubuntu-latest |
10 | 10 | steps: |
11 | | - - name: Checkout spanner-graph-notebook |
| 11 | + # Step 1: Checkout local PR of spanner-graph-notebook |
| 12 | + - name: Checkout spanner-graph-notebook (Repo A) |
12 | 13 | uses: actions/checkout@v4 |
13 | 14 |
|
14 | 15 | - name: Set up Python |
15 | 16 | uses: actions/setup-python@v5 |
16 | 17 | with: |
17 | 18 | python-version: '3.11' |
18 | 19 |
|
19 | | - - name: Install build dependencies |
20 | | - run: python -m pip install build |
21 | | - |
22 | | - - name: Build spanner-graph-notebook |
23 | | - run: python -m build |
24 | | - |
25 | | - - name: Checkout python-bigquery-magics |
| 20 | + # Step 2: Checkout python-bigquery-magics |
| 21 | + - name: Checkout python-bigquery-magics (Repo B) |
26 | 22 | uses: actions/checkout@v4 |
27 | 23 | with: |
28 | 24 | repository: googleapis/python-bigquery-magics |
29 | 25 | path: python-bigquery-magics |
30 | 26 |
|
31 | | - - name: Diagnose Test Environment |
| 27 | + - name: Install and test |
32 | 28 | run: | |
33 | 29 | set -e |
34 | | - echo "--- Preparing Environment ---" |
35 | 30 | python -m venv venv |
36 | 31 | . venv/bin/activate |
37 | | - pip install pytest |
38 | | - |
39 | | - echo "--- Installing Dependencies from Local Builds ---" |
40 | | - # Using the two-step install process |
41 | | - pip install dist/*.whl |
42 | | - pip install ./python-bigquery-magics |
43 | | - pip install google-cloud-testutils |
44 | | - |
45 | | - # --- DIAGNOSTICS START --- |
46 | | - echo "--- DIAGNOSTICS ---" |
47 | | - |
48 | | - echo "[Step 1] Checking executable paths..." |
49 | | - which python |
50 | | - which pip |
51 | | - |
52 | | - echo "\n[Step 2] Listing all installed packages..." |
53 | | - pip freeze |
54 | | - |
55 | | - echo "\n[Step 3] Checking content of site-packages..." |
56 | | - ls -lR venv/lib/python3.11/site-packages/ | grep "spanner" || echo "spanner-graph-notebook not found in site-packages" |
57 | | - |
58 | | - echo "\n[Step 4] Checking Python's import path..." |
59 | | - python -c "import sys; from pprint import pprint; pprint(sys.path)" |
60 | | - |
61 | | - echo "\n[Step 5] Attempting a direct import..." |
62 | | - python -c "from spanner_graphs import graph_visualization" && echo "==> Direct import of graph_visualization SUCCEEDED" || echo "==> Direct import of graph_visualization FAILED" |
63 | | - python -c "import spanner_graphs" && echo "==> Direct import of spanner_graphs SUCCEEDED" || echo "==> Direct import of spanner_graphs FAILED" |
64 | | - |
65 | | - # --- DIAGNOSTICS END --- |
66 | | - |
67 | | - echo "\n--- Running Tests ---" |
68 | | - cd python-bigquery-magics |
69 | | - pytest -v tests/unit/test_graph_server.py tests/unit/bigquery/test_bigquery.py |
| 32 | + |
| 33 | + # Steps 3, 4, 5: Install test dependencies (pytest, etc.) |
| 34 | + # We also include portpicker, which was in your original file and is |
| 35 | + # likely required by the tests. |
| 36 | + pip install pytest google-cloud-testutils google-cloud-bigquery-storage portpicker |
| 37 | + |
| 38 | + # Step 1 (continued): Install spanner-graph-notebook in editable mode |
| 39 | + # The '.' refers to the root directory, where Repo A was checked out. |
| 40 | + pip install -e . |
| 41 | + |
| 42 | + # Step 2 (continued): Install python-bigquery-magics in editable mode |
| 43 | + # This installs from the 'python-bigquery-magics' subdirectory. |
| 44 | + # pip will see that spanner-graph-notebook is already installed. |
| 45 | + pip install -e ./python-bigquery-magics |
| 46 | + |
| 47 | + # Prepend the required import to the test files |
| 48 | + echo "import spanner_graphs.graph_visualization as graph_visualization" | cat - python-bigquery-magics/tests/unit/test_graph_server.py > temp && mv temp python-bigquery-magics/tests/unit/test_graph_server.py |
| 49 | + echo "import spanner_graphs.graph_visualization as graph_visualization" | cat - python-bigquery-magics/tests/unit/bigquery/test_bigquery.py > temp && mv temp python-bigquery-magics/tests/unit/bigquery/test_bigquery.py |
| 50 | + |
| 51 | + # Step 6: Run the tests |
| 52 | + pytest -v python-bigquery-magics/tests/unit/test_graph_server.py python-bigquery-magics/tests/unit/bigquery/test_bigquery.py |
0 commit comments