|
1 | 1 | name: CI
|
| 2 | +concurrency: |
| 3 | + group: ${{ github.head_ref || github.sha }} |
| 4 | + cancel-in-progress: true |
2 | 5 |
|
3 | 6 | on:
|
4 |
| - push: |
| 7 | + pull_request: |
5 | 8 | workflow_dispatch:
|
| 9 | + inputs: |
| 10 | + test_linux: |
| 11 | + type: boolean |
| 12 | + default: true |
| 13 | + description: "Run Linux Build and Test" |
| 14 | + test_windows: |
| 15 | + type: boolean |
| 16 | + default: true |
| 17 | + description: "Run Windows Build and Test" |
| 18 | + test_macintosh: |
| 19 | + type: boolean |
| 20 | + default: true |
| 21 | + description: "Run Mac OS Build" |
| 22 | + build_source_dist: |
| 23 | + type: boolean |
| 24 | + default: true |
| 25 | + description: "Build Source Distribution" |
| 26 | + upload_artifacts: |
| 27 | + type: boolean |
| 28 | + default: true |
| 29 | + description: "Upload Artifacts" |
| 30 | + |
6 | 31 | schedule:
|
7 |
| - - cron: "0 1 * * *" |
8 |
| - |
| 32 | + - cron: "0 0 * * 0" |
9 | 33 |
|
10 | 34 | jobs:
|
11 |
| - build_and_test_ubuntu: |
12 |
| - strategy: |
13 |
| - matrix: |
14 |
| - include: |
15 |
| - - {platform: 'ubuntu-20.04', python_version: '3.8', mgversion: '2.0.1'} |
16 |
| - - {platform: 'ubuntu-20.04', python_version: '3.8', mgversion: '2.5.2'} |
17 |
| - - {platform: 'ubuntu-20.04', python_version: '3.8', mgversion: '2.10.1'} |
18 |
| - - {platform: 'ubuntu-22.04', python_version: '3.10', mgversion: '2.5.2'} |
19 |
| - - {platform: 'ubuntu-22.04', python_version: '3.10', mgversion: '2.10.1'} |
20 |
| - runs-on: ${{ matrix.platform }} |
21 |
| - steps: |
22 |
| - - name: Cache Memgraph community installer |
23 |
| - id: cache-memgraph-community |
24 |
| - uses: actions/cache@v1 |
25 |
| - with: |
26 |
| - path: ~/memgraph |
27 |
| - key: cache-memgraph-v${{ matrix.mgversion }}-${{ matrix.platform }}-community-installer-v3 |
28 |
| - - name: Download Memgraph |
29 |
| - if: steps.cache-memgraph-community.outputs.cache-hit != 'true' |
30 |
| - run: | |
31 |
| - mkdir ~/memgraph |
32 |
| - MEMGRAPH_PACKAGE_NAME="memgraph_${{ matrix.mgversion }}-1_amd64.deb" |
33 |
| - curl -L https://download.memgraph.com/memgraph/v${{ matrix.mgversion }}/${{ matrix.platform }}/${MEMGRAPH_PACKAGE_NAME} > ~/memgraph/memgraph.deb |
34 |
| - - name: Install system dependencies |
35 |
| - run: | |
36 |
| - sudo apt install -y libpython${{ matrix.python_version }} python3-pip python3-setuptools |
37 |
| - sudo pip3 install --upgrade networkx pytest pyopenssl sphinx |
38 |
| - sudo ln -s /dev/null /etc/systemd/system/memgraph.service # Prevents Memgraph from starting. |
39 |
| - sudo dpkg -i ~/memgraph/memgraph.deb |
40 |
| - - uses: actions/checkout@v2 |
41 |
| - with: |
42 |
| - submodules: true |
43 |
| - - name: Build source distribution |
44 |
| - run: python3 setup.py sdist |
45 |
| - - name: Install pymgclient with dynamic OpenSSL for Memgraph 1.3.0 |
46 |
| - if: matrix.mgversion == '1.3.0' |
47 |
| - run: python3 -m pip install --global-option=build_ext --global-option="--static-openssl=false" ./dist/pymgclient-* |
48 |
| - - name: Install pymgclient |
49 |
| - if: matrix.mgversion != '1.3.0' |
50 |
| - run: python3 -m pip install ./dist/pymgclient-* |
51 |
| - - name: Import mgclient to validate installation |
52 |
| - run: python3 -c "import mgclient" |
53 |
| - - name: Run tests |
54 |
| - run: | |
55 |
| - MEMGRAPH_PORT=10000 |
56 |
| - if [[ "${{ matrix.mgversion }}" != 1* ]]; then |
57 |
| - python3 -m pytest -v |
58 |
| - else |
59 |
| - python3 -m pytest -v -m "not temporal" |
60 |
| - fi |
61 |
| - - name: Build docs |
62 |
| - run: | |
63 |
| - cd docs |
64 |
| - make html |
65 |
| - - name: Save source distribution package |
66 |
| - uses: actions/upload-artifact@v2 |
67 |
| - with: |
68 |
| - name: pymgclient |
69 |
| - path: dist/ |
| 35 | + weekly_build: |
| 36 | + if: ${{ github.event_name == 'schedule' }} |
| 37 | + name: Weekly Build |
| 38 | + uses: "./.github/workflows/reusable_buildtest.yml" |
| 39 | + with: |
| 40 | + test_linux: true |
| 41 | + test_windows: true |
| 42 | + test_macintosh: true |
| 43 | + build_source_dist: false |
| 44 | + upload_artifacts: false |
| 45 | + secrets: inherit |
70 | 46 |
|
71 |
| - build_and_test_windows: |
72 |
| - runs-on: windows-2019 |
73 |
| - strategy: |
74 |
| - matrix: |
75 |
| - arch: |
76 |
| - - { mingw: "64", msys: x86_64, python: "x64" } |
77 |
| - python_version: |
78 |
| - - '3.7' |
79 |
| - - '3.10' |
80 |
| - env: |
81 |
| - # TODO(gitbuda): Fix "The file cannot be accessed by the system... rocksdb_durability" |
82 |
| - MG_VERSION: 2.8.0 |
83 |
| - steps: |
84 |
| - - uses: actions/checkout@v2 |
85 |
| - with: |
86 |
| - submodules: true |
87 |
| - - name: Setup python |
88 |
| - |
89 |
| - with: |
90 |
| - python-version: ${{ matrix.python_version }} |
91 |
| - architecture: ${{ matrix.arch.python }} |
92 |
| - - uses: msys2/setup-msys2@v2 |
93 |
| - with: |
94 |
| - msystem: MINGW${{ matrix.arch.mingw }} |
95 |
| - update: true |
96 |
| - release: false |
97 |
| - install: git mingw-w64-${{ matrix.arch.msys }}-toolchain mingw-w64-${{ matrix.arch.msys }}-cmake mingw-w64-${{ matrix.arch.msys }}-openssl |
98 |
| - - name: Add mingw${{ matrix.arch.mingw }} to PATH |
99 |
| - run: | |
100 |
| - # First make sure python would resolve to the windows native python, not mingw one |
101 |
| - echo "C:\msys64\mingw${{ matrix.arch.mingw }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 |
102 |
| - echo "${{ env.pythonLocation }}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 |
103 |
| - - name: Print OpenSSL version |
104 |
| - shell: msys2 {0} |
105 |
| - run: | |
106 |
| - openssl version -a |
107 |
| - - uses: Vampire/setup-wsl@v1 |
108 |
| - with: |
109 |
| - distribution: Ubuntu-20.04 |
110 |
| - - name: Download, install and run Memgraph under WSL |
111 |
| - shell: wsl-bash {0} # root shell |
112 |
| - run: | |
113 |
| - mkdir ~/memgraph |
114 |
| - 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 |
115 |
| - dpkg -i ~/memgraph/memgraph.deb |
116 |
| - 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" |
117 |
| - 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='' & |
118 |
| - sleep 1 # Wait for Memgraph a bit. |
119 |
| - - run: python -m pip install -U pip wheel setuptools pytest pyopenssl |
120 |
| - - name: Build pymgclient |
121 |
| - run: python setup.py bdist_wheel |
122 |
| - - name: Install pymgclient |
123 |
| - run: python -m pip install --verbose -f dist --no-index pymgclient |
124 |
| - env: |
125 |
| - VERBOSE: 1 |
126 |
| - - name: Run tests |
127 |
| - run: | |
128 |
| - python3 -m pytest -v |
129 |
| - env: |
130 |
| - MEMGRAPH_HOST: "localhost" |
131 |
| - MEMGRAPH_STARTED_WITH_SSL: |
132 |
| - - name: Save wheel package |
133 |
| - uses: actions/upload-artifact@v2 |
134 |
| - with: |
135 |
| - name: pymgclient-win${{ matrix.arch.mingw }}-${{ matrix.python_version }} |
136 |
| - path: dist/ |
| 47 | + pr_test: |
| 48 | + if: ${{ github.event_name == 'pull_request' }} |
| 49 | + name: Pull Request Tests |
| 50 | + uses: "./.github/workflows/reusable_buildtest.yml" |
| 51 | + with: |
| 52 | + test_linux: true |
| 53 | + test_windows: true |
| 54 | + test_macintosh: true |
| 55 | + build_source_dist: true |
| 56 | + upload_artifacts: false |
| 57 | + secrets: inherit |
137 | 58 |
|
138 |
| - build_macos: |
139 |
| - strategy: |
140 |
| - fail-fast: false |
141 |
| - matrix: |
142 |
| - platform: [macos-13, macos-12, macos-11] |
143 |
| - python_version: |
144 |
| - - '3.8' |
145 |
| - - '3.10' |
146 |
| - include: |
147 |
| - - {platform: [macOS-12.1, ARM64, self-hosted], python_version: '3.10'} |
148 |
| - - {platform: [macOS-12.1, ARM64, self-hosted], python_version: '3.8'} |
149 |
| - runs-on: ${{ matrix.platform }} |
150 |
| - steps: |
151 |
| - - uses: actions/checkout@v2 |
152 |
| - with: |
153 |
| - submodules: true |
154 |
| - - name: Install python and OpenSSL |
155 |
| - run: | |
156 |
| - brew install python@${{ matrix.python_version }} [email protected] |
157 |
| - brew link --force --overwrite [email protected] |
158 |
| - openssl version -a |
159 |
| - - name: Manage OpenSSL 3 on ARM machines |
160 |
| - if: ${{ contains(matrix.platform, 'ARM64') }} |
161 |
| - run: | |
162 |
| - brew install openssl@3 |
163 |
| - brew link --force --overwrite openssl@3 |
164 |
| - openssl version -a |
165 |
| - - name: Make used python version default |
166 |
| - run: | |
167 |
| - brew unlink python@3 && brew link --force python@${{ matrix.python_version }} |
168 |
| - python${{ matrix.python_version }} --version |
169 |
| - - name: Install pytest and pyopenssl |
170 |
| - run: python${{ matrix.python_version }} -m pip install pyopenssl pytest |
171 |
| - - name: Build pymgclient |
172 |
| - run: python${{ matrix.python_version }} setup.py bdist_wheel |
173 |
| - - name: Install pymgclient |
174 |
| - run: python${{ matrix.python_version }} -m pip install -f dist --no-index pymgclient |
175 |
| - - name: Import mgclient to validate installation |
176 |
| - run: python${{ matrix.python_version }} -c "import mgclient" |
177 |
| - - name: Save artifact name on x86 machines |
178 |
| - if: ${{ !contains(matrix.platform, 'ARM64') }} |
179 |
| - run: echo "OS_TYPE=${{ matrix.platform }}" >> $GITHUB_ENV |
180 |
| - - name: Save artifact name on ARM64 machines |
181 |
| - if: ${{ contains(matrix.platform, 'ARM64') }} |
182 |
| - # Convert macOS-11.6-ARM64 to macos-11.6-arm64 to be consistent with full lowercase naming |
183 |
| - run: echo OS_TYPE=`echo "${{ matrix.platform[0] }}-${{ matrix.platform[1] }}" | tr "[:upper:]" "[:lower:]"` >> $GITHUB_ENV |
184 |
| - - name: Save wheel package |
185 |
| - uses: actions/upload-artifact@v2 |
186 |
| - with: |
187 |
| - name: pymgclient-${{ env.OS_TYPE }}-${{ matrix.python_version }} |
188 |
| - path: dist/ |
| 59 | + manual_test: |
| 60 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 61 | + name: Manual Test |
| 62 | + uses: "./.github/workflows/reusable_buildtest.yml" |
| 63 | + with: |
| 64 | + test_linux: ${{ inputs.test_linux }} |
| 65 | + test_windows: ${{ inputs.test_windows }} |
| 66 | + test_macintosh: ${{ inputs.test_macintosh }} |
| 67 | + build_source_dist: ${{ inputs.build_source_dist }} |
| 68 | + upload_artifacts: ${{ inputs.upload_artifacts }} |
| 69 | + secrets: inherit |
0 commit comments