-
Notifications
You must be signed in to change notification settings - Fork 28
158 lines (134 loc) · 4.94 KB
/
test.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
name: Build and Test
env:
PY_VERSION: "3.9"
CORE_COUNT: "8"
MAGE_CONTAINER: "mage"
MEMGRAPH_PORT: 7687
NEO4J_PORT: 7688
NEO4J_CONTAINER: "neo4j_test"
OFFICIAL: "true"
on: [pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: True
env:
MEMGRAPH_VERSION: 2.12.1
strategy:
matrix:
architecture: ["amd64", "arm64"]
target: ["prod", "dev"]
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Download memgraph binaries
run: |
if [ "${{ env.OFFICIAL }}" = "true" ]; then
curl -L "https://download.memgraph.com/memgraph/v${MEMGRAPH_VERSION}/debian-11/memgraph_${MEMGRAPH_VERSION}-1_amd64.deb" > memgraph-amd64.deb
curl -L "https://download.memgraph.com/memgraph/v${MEMGRAPH_VERSION}/debian-11-aarch64/memgraph_${MEMGRAPH_VERSION}-1_arm64.deb" > memgraph-arm64.deb
else
sudo apt update && sudo apt install -y ca-certificates wget git
wget -q https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/memgraph-unofficial/memgraph_${MEMGRAPH_VERSION}-1_amd64.deb -O memgraph-amd64.deb
wget -q https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/memgraph-unofficial/memgraph_${MEMGRAPH_VERSION}-1_arm64.deb -O memgraph-arm64.deb
fi
- name: Disk status before cleaning
run: |
df -h
docker buildx du
- name : Docker system prune
run : |
docker buildx prune --all -f
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /opt/hostedtoolcache/go
sudo rm -rf /opt/hostedtoolcache
- name: Disk status after cleaning
run: |
df -h
docker buildx du
- name: Rust library tests
if: matrix.target == 'dev'
run: |
cd rust/rsmgp-sys
cargo fmt -- --check
cargo test
- name: Build and run Memgraph MAGE:${{ matrix.target }}
run: |
DOCKER_BUILDKIT=1 docker buildx build \
--tag memgraph-mage:${{ matrix.target }} \
--target ${{ matrix.target }} \
--platform linux/${{ matrix.architecture }} \
--file Dockerfile.release \
--load .
docker run -d -p ${{ env.MEMGRAPH_PORT }}:7687 --name ${{ env.MAGE_CONTAINER }} memgraph-mage:${{ matrix.target }} --telemetry-enabled=False
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get all current images
run: |
docker images
- name: Set up C++
run: |
sudo apt update
sudo apt install -y build-essential cmake
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PY_VERSION }}
- name: Install Python test dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./python/tests/requirements.txt
- name: Build C++ modules
run: |
mkdir -p cpp/build
cd cpp/build
cmake ..
make -j${{ env.CORE_COUNT }}
- name: C++ Modules unit tests
if: matrix.target == 'dev'
run: |
cd cpp/build
ctest -j${{ env.CORE_COUNT }}
- name: Python modules unit tests
if: matrix.target == 'dev'
env:
PYTHONPATH: "$PWD/python"
run: |
docker exec -i -u root ${{ env.MAGE_CONTAINER }} bash -c "cd /mage/python/ && python3 -m pytest ."
- name: Run End-to-end tests
if: matrix.architecture != 'arm64'
env:
PYTHONPATH: "$PWD/e2e"
run: |
cd e2e
docker exec -i -u root ${{ env.MAGE_CONTAINER }} bash -c "cd /mage/e2e/ && python3 -m pytest . -k 'not cugraph'"
- name: Run End-to-end correctness tests
if: matrix.architecture != 'arm64'
env:
PYTHONPATH: "$PWD/e2e"
run: |
docker run --rm \
--name ${{ env.NEO4J_CONTAINER}} \
-p 7474:7474 -p ${{ env.NEO4J_PORT }}:7687 \
--rm \
-d \
-v $HOME/neo4j/plugins:/plugins \
--env NEO4J_AUTH=none \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_import_file_use__neo4j__config=true \
-e NEO4JLABS_PLUGINS=\["apoc"\] neo4j:5.10.0
sleep 5
python3 test_e2e_correctness.py --memgraph-port ${{ env.MEMGRAPH_PORT }} --neo4j-port ${{ env.NEO4J_PORT }}
docker stop ${{ env.NEO4J_CONTAINER}}