-
Notifications
You must be signed in to change notification settings - Fork 4
188 lines (183 loc) · 7.85 KB
/
ci.yml
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
name: CI
on:
push:
workflow_dispatch:
schedule:
- cron: "0 1 * * *"
jobs:
build_and_test_ubuntu:
strategy:
matrix:
include:
- {platform: 'ubuntu-20.04', python_version: '3.8', mgversion: '2.0.1'}
- {platform: 'ubuntu-20.04', python_version: '3.8', mgversion: '2.5.2'}
- {platform: 'ubuntu-20.04', python_version: '3.8', mgversion: '2.10.1'}
- {platform: 'ubuntu-22.04', python_version: '3.10', mgversion: '2.5.2'}
- {platform: 'ubuntu-22.04', python_version: '3.10', mgversion: '2.10.1'}
runs-on: ${{ matrix.platform }}
steps:
- name: Cache Memgraph community installer
id: cache-memgraph-community
uses: actions/cache@v1
with:
path: ~/memgraph
key: cache-memgraph-v${{ matrix.mgversion }}-${{ matrix.platform }}-community-installer-v3
- name: Download Memgraph
if: steps.cache-memgraph-community.outputs.cache-hit != 'true'
run: |
mkdir ~/memgraph
MEMGRAPH_PACKAGE_NAME="memgraph_${{ matrix.mgversion }}-1_amd64.deb"
curl -L https://download.memgraph.com/memgraph/v${{ matrix.mgversion }}/${{ matrix.platform }}/${MEMGRAPH_PACKAGE_NAME} > ~/memgraph/memgraph.deb
- name: Install system dependencies
run: |
sudo apt install -y libpython${{ matrix.python_version }} python3-pip python3-setuptools
sudo pip3 install --upgrade networkx pytest pyopenssl sphinx
sudo ln -s /dev/null /etc/systemd/system/memgraph.service # Prevents Memgraph from starting.
sudo dpkg -i ~/memgraph/memgraph.deb
- uses: actions/checkout@v2
with:
submodules: true
- name: Build source distribution
run: python3 setup.py sdist
- name: Install pymgclient with dynamic OpenSSL for Memgraph 1.3.0
if: matrix.mgversion == '1.3.0'
run: python3 -m pip install --global-option=build_ext --global-option="--static-openssl=false" ./dist/pymgclient-*
- name: Install pymgclient
if: matrix.mgversion != '1.3.0'
run: python3 -m pip install ./dist/pymgclient-*
- name: Import mgclient to validate installation
run: python3 -c "import mgclient"
- name: Run tests
run: |
MEMGRAPH_PORT=10000
if [[ "${{ matrix.mgversion }}" != 1* ]]; then
python3 -m pytest -v
else
python3 -m pytest -v -m "not temporal"
fi
- name: Build docs
run: |
cd docs
make html
- name: Save source distribution package
uses: actions/upload-artifact@v2
with:
name: pymgclient
path: dist/
build_and_test_windows:
runs-on: windows-2019
strategy:
matrix:
arch:
- { mingw: "64", msys: x86_64, python: "x64" }
python_version:
- '3.7'
- '3.10'
env:
# TODO(gitbuda): Fix "The file cannot be accessed by the system... rocksdb_durability"
MG_VERSION: 2.8.0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup python
uses: actions/setup-python@v2.2.2
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.arch.python }}
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW${{ matrix.arch.mingw }}
update: true
release: false
install: git mingw-w64-${{ matrix.arch.msys }}-toolchain mingw-w64-${{ matrix.arch.msys }}-cmake mingw-w64-${{ matrix.arch.msys }}-openssl
- name: Add mingw${{ matrix.arch.mingw }} to PATH
run: |
# First make sure python would resolve to the windows native python, not mingw one
echo "C:\msys64\mingw${{ matrix.arch.mingw }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
echo "${{ env.pythonLocation }}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Print OpenSSL version
shell: msys2 {0}
run: |
openssl version -a
- uses: Vampire/setup-wsl@v1
with:
distribution: Ubuntu-20.04
- name: Download, install and run Memgraph under WSL
shell: wsl-bash {0} # root shell
run: |
mkdir ~/memgraph
curl -L https://download.memgraph.com/memgraph/v${{ env.MG_VERSION }}/ubuntu-20.04/memgraph_${{ env.MG_VERSION }}-1_amd64.deb --output ~/memgraph/memgraph.deb
dpkg -i ~/memgraph/memgraph.deb
openssl req -x509 -newkey rsa:4096 -days 3650 -nodes -keyout key.pem -out cert.pem -subj "/C=GB/ST=London/L=London/O=Testing Corp./CN=PymgclientTest"
nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="cert.pem" --bolt-key-file="key.pem" --data-directory="~/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-file='' &
sleep 1 # Wait for Memgraph a bit.
- run: python -m pip install -U pip wheel setuptools pytest pyopenssl
- name: Build pymgclient
run: python setup.py bdist_wheel
- name: Install pymgclient
run: python -m pip install --verbose -f dist --no-index pymgclient
env:
VERBOSE: 1
- name: Run tests
run: |
python3 -m pytest -v
env:
MEMGRAPH_HOST: "localhost"
MEMGRAPH_STARTED_WITH_SSL:
- name: Save wheel package
uses: actions/upload-artifact@v2
with:
name: pymgclient-win${{ matrix.arch.mingw }}-${{ matrix.python_version }}
path: dist/
build_macos:
strategy:
fail-fast: false
matrix:
platform: [macos-13, macos-12, macos-11]
python_version:
- '3.8'
- '3.10'
include:
- {platform: [macOS-12.1, ARM64, self-hosted], python_version: '3.10'}
- {platform: [macOS-12.1, ARM64, self-hosted], python_version: '3.8'}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install python and OpenSSL
run: |
brew install python@${{ matrix.python_version }} openssl@1.1
brew link --force --overwrite openssl@1.1
openssl version -a
- name: Manage OpenSSL 3 on ARM machines
if: ${{ contains(matrix.platform, 'ARM64') }}
run: |
brew install openssl@3
brew link --force --overwrite openssl@3
openssl version -a
- name: Make used python version default
run: |
brew unlink python@3 && brew link --force python@${{ matrix.python_version }}
python${{ matrix.python_version }} --version
- name: Install pytest and pyopenssl
run: python${{ matrix.python_version }} -m pip install pyopenssl pytest
- name: Build pymgclient
run: python${{ matrix.python_version }} setup.py bdist_wheel
- name: Install pymgclient
run: python${{ matrix.python_version }} -m pip install -f dist --no-index pymgclient
- name: Import mgclient to validate installation
run: python${{ matrix.python_version }} -c "import mgclient"
- name: Save artifact name on x86 machines
if: ${{ !contains(matrix.platform, 'ARM64') }}
run: echo "OS_TYPE=${{ matrix.platform }}" >> $GITHUB_ENV
- name: Save artifact name on ARM64 machines
if: ${{ contains(matrix.platform, 'ARM64') }}
# Convert macOS-11.6-ARM64 to macos-11.6-arm64 to be consistent with full lowercase naming
run: echo OS_TYPE=`echo "${{ matrix.platform[0] }}-${{ matrix.platform[1] }}" | tr "[:upper:]" "[:lower:]"` >> $GITHUB_ENV
- name: Save wheel package
uses: actions/upload-artifact@v2
with:
name: pymgclient-${{ env.OS_TYPE }}-${{ matrix.python_version }}
path: dist/