-
Notifications
You must be signed in to change notification settings - Fork 50
249 lines (244 loc) · 11.9 KB
/
Copy pathbuild-and-test.yml
File metadata and controls
249 lines (244 loc) · 11.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Build and Test
env:
MG_VERSION: "3.3.0"
POETRY_VERSION: "1.8.2"
VM_MAX_MAP_COUNT: "262144"
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, review_requested, ready_for_review]
workflow_dispatch:
inputs:
run_linux:
description: "Run Linux tests"
required: false
type: boolean
default: true
run_windows:
description: "Run Windows tests"
required: false
type: boolean
default: false
jobs:
build_and_test_ubuntu:
if: ${{ (github.event_name != 'workflow_dispatch' && github.event.pull_request.draft == false) || ( github.event_name == 'workflow_dispatch' && inputs.run_linux == true ) }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip and install packages
run: |
python -m pip install --upgrade pip setuptools wheel
sudo -H pip install networkx numpy scipy
sudo -H pip install poethepoet==0.18.1
- name: Setup poetry
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4.0.0
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install Memgraph
run: |
mkdir /home/runner/memgraph
curl -L https://download.memgraph.com/memgraph/v${{env.MG_VERSION}}/${{ matrix.os }}/memgraph_${{env.MG_VERSION}}-1_amd64.deb --output /home/runner/memgraph/memgraph-community.deb
sudo dpkg -i /home/runner/memgraph/memgraph-community.deb
sudo systemctl stop memgraph
sudo runuser -l memgraph -c '/usr/lib/memgraph/memgraph --bolt-port 7687 --data-directory="/var/lib/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-level=TRACE --also-log-to-stderr=true --log-file=/var/log/memgraph/memgraph-ubuntu-${{ matrix.python-version }}.log' &
- name: Wait for Memgraph to be ready
run: |
echo "Waiting for Memgraph to accept Bolt connections..."
for i in {1..60}; do
if timeout 1 bash -c "echo > /dev/tcp/127.0.0.1/7687" 2>/dev/null; then
echo "Memgraph is ready."
exit 0
fi
echo "Waiting for Memgraph... ($i/60)"
sleep 1
done
echo "Memgraph did not become ready in time."
sudo journalctl -u memgraph --no-pager | tail -50 || true
exit 1
- name: Install Neo4j
run: |
# Using Neo4j 4.4.18 which has cgroupv2 compatibility fixes for Ubuntu 24.04
docker run --name neo4j-test -p 7474:7474 -p 7688:7687 -d -v $HOME/neo4j/data:/data -v $HOME/neo4j/logs:/logs -v $HOME/neo4j/import:/var/lib/neo4j/import -v $HOME/neo4j/plugins:/plugins --env NEO4J_AUTH=neo4j/test neo4j:4.4.18
- name: Wait for Neo4j to be ready
run: |
echo "Waiting for Neo4j to be ready..."
for i in {1..60}; do
# Use cypher-shell inside the container to verify Neo4j is accepting connections
if docker exec neo4j-test cypher-shell -u neo4j -p test "RETURN 1" 2>/dev/null; then
echo "Neo4j is ready and accepting queries!"
break
fi
echo "Waiting for Neo4j... ($i/60)"
sleep 2
done
# Show Neo4j logs for debugging
echo "=== Neo4j logs ==="
docker logs neo4j-test 2>&1 | tail -30 || true
- name: Install More Packages (Python <= 3.12)
if: ${{ matrix.python-version == '3.9' || matrix.python-version == '3.10' || matrix.python-version == '3.11' || matrix.python-version == '3.12' }}
run: |
ps aux | grep memgraph
poetry install -E arrow -E dgl -E docker -E dot
poe install-pyg-cpu
poe install-dgl
poe install-tfgnn
- name: Install More Packages (Python >= 3.13)
if: ${{ matrix.python-version == '3.13' || matrix.python-version == '3.14' }}
run: |
ps aux | grep memgraph
# Keep TensorFlow/TF-GNN stacks off for 3.13+.
poetry install -E docker -E dot -E arrow
- name: Run Tests (Python <= 3.12)
if: ${{ matrix.python-version == '3.9' || matrix.python-version == '3.10' || matrix.python-version == '3.11' || matrix.python-version == '3.12' }}
run: |
export TF_USE_LEGACY_KERAS="1"
poetry run pytest -vvv -m "not slow and not ubuntu and not docker"
- name: Run Tests (Python >= 3.13)
if: ${{ matrix.python-version == '3.13' || matrix.python-version == '3.14' }}
run: |
poetry run pytest -vvv -m "not slow and not ubuntu and not docker and not tfgnn"
- name: Use the Upload Artifact GitHub Action
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: always()
with:
name: memgraph-logs-${{ matrix.os }}-py${{ matrix.python-version }}
path: /var/log/memgraph
overwrite: true
build_and_test_windows:
if: ${{ (github.event_name != 'workflow_dispatch' && github.event.pull_request.draft == false) || ( github.event_name == 'workflow_dispatch' && inputs.run_windows == true ) }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip and install packages
run: |
python -m pip install -U pip
python -m pip install networkx numpy scipy
python -m pip install poethepoet==0.18.1
- name: Set default WSL version to 2
run: wsl --set-default-version 2
- uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # v6.0.0
with:
distribution: Ubuntu-24.04
- name: Update vm.max_map_count
shell: wsl-bash {0} #root shell
run: |
if [ -f /proc/sys/vm/max_map_count ]; then
sudo sysctl -w vm.max_map_count=${{ env.VM_MAX_MAP_COUNT }}
else
echo "Skipping vm.max_map_count update: /proc/sys/vm/max_map_count not available in this WSL environment."
fi
- name: Download, install and run Memgraph under WSL
shell: wsl-bash {0} # root shell
run: |
sudo apt-get update
sudo apt-get -y install python3 python3-pip ipython3
pip3 install networkx numpy scipy --break-system-packages
mkdir /memgraph
curl -L https://download.memgraph.com/memgraph/v${{env.MG_VERSION}}/ubuntu-24.04/memgraph_${{env.MG_VERSION}}-1_amd64.deb --output /memgraph/memgraph-community.deb
dpkg -i /memgraph/memgraph-community.deb
mkdir /mnt/c/memgraph
runuser -l memgraph -c '/usr/lib/memgraph/memgraph --bolt-address 0.0.0.0 --bolt-port 7687 --data-directory="/mnt/c/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-level=TRACE --also-log-to-stderr=true --log-file=/mnt/c/memgraph/memgraph-windows-${{ matrix.python-version }}.log' &
- name: Wait for Memgraph to be ready (WSL)
shell: wsl-bash {0} # root shell
run: |
echo "Waiting for Memgraph to accept Bolt connections..."
for i in {1..60}; do
if timeout 1 bash -c "echo > /dev/tcp/127.0.0.1/7687" 2>/dev/null; then
echo "Memgraph is ready."
exit 0
fi
echo "Waiting for Memgraph... ($i/60)"
sleep 1
done
echo "Memgraph did not become ready in time."
exit 1
- name: Resolve WSL Memgraph host for Windows tests
run: |
$wslIp = (wsl hostname -I).Trim().Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)[0]
if (-not $wslIp) {
throw "Failed to resolve WSL IP address."
}
"MG_HOST=$wslIp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"MG_PORT=7687" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "Resolved MG_HOST=$wslIp"
- name: Wait for Memgraph to be reachable from Windows
run: |
for ($i = 1; $i -le 60; $i++) {
if (Test-NetConnection -ComputerName $env:MG_HOST -Port $env:MG_PORT -InformationLevel Quiet) {
Write-Host "Memgraph reachable at $env:MG_HOST`:$env:MG_PORT"
exit 0
}
Write-Host "Waiting for Memgraph from Windows... ($i/60)"
Start-Sleep -Seconds 1
}
throw "Memgraph not reachable at $env:MG_HOST`:$env:MG_PORT"
- name: Download, install and run Neo4j under WSL
shell: wsl-bash {0} # root shell
run: |
curl -fsSL https://debian.neo4j.com/neotechnology.gpg.key | apt-key add -
add-apt-repository "deb https://debian.neo4j.com stable 4.2"
sudo apt-get -y install neo4j=1:4.2.1
neo4j-admin set-initial-password test
mkdir -p /mnt/c/neo4j/${{ matrix.python-version }}
sed -i 's/#dbms.connector.bolt.listen_address=:7687/dbms.connector.bolt.listen_address=:7688/g' /etc/neo4j/neo4j.conf
sed -i 's/#dbms.connector.bolt.advertised_address=:7687/dbms.connector.bolt.advertised_address=:7688/g' /etc/neo4j/neo4j.conf
sed -i 's/#dbms.default_listen_address=0.0.0.0/dbms.default_listen_address=0.0.0.0/g' /etc/neo4j/neo4j.conf
sed -i 's/dbms.directories.logs=\/var\/log\/neo4j/dbms.directories.logs=\/mnt\/c\/neo4j\/${{ matrix.python-version }}/g' /etc/neo4j/neo4j.conf
cp /etc/neo4j/neo4j.conf /mnt/c/neo4j/${{ matrix.python-version }}/neo4j.conf
sudo service neo4j start
sleep 10 # Wait for Neo4j a bit.
- name: Setup poetry
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4.0.0
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Test project
run: |
$env:MG_HOST = (wsl hostname -I).Trim().Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)[0]
if (-not $env:MG_HOST) {
throw "Failed to resolve WSL IP address before tests."
}
$env:MG_PORT = "7687"
Write-Host "Using Memgraph at $env:MG_HOST`:$env:MG_PORT"
if (-not (Test-NetConnection -ComputerName $env:MG_HOST -Port $env:MG_PORT -InformationLevel Quiet)) {
throw "Memgraph is not reachable from Windows at $env:MG_HOST`:$env:MG_PORT"
}
poetry install -E arrow -E docker -E dot
$env:TF_USE_LEGACY_KERAS = "1"
poetry run pytest -vvv -m "not slow and not ubuntu and not docker and not extras"
- name: Save Memgraph Logs
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: always()
with:
name: memgraph-log
path: C:\memgraph
overwrite: true
- name: Save Neo4j Logs
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: always()
with:
name: neo4j-log
path: C:\neo4j
overwrite: true