CI #648
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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 }} [email protected] | |
brew link --force --overwrite [email protected] | |
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/ |