-
Notifications
You must be signed in to change notification settings - Fork 13
130 lines (122 loc) · 3.92 KB
/
test-python.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
name: Python Tests
on:
push:
branches: ["main"]
pull_request:
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./bindings/python
shell: bash -eux {0}
jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage=manual
build:
# supercharge/mongodb-github-action requires containers so we don't test other platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [3.8, 3.9, "3.10", "3.11"]
fail-fast: false
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/setup.cfg'
- name: Set up env
run: |
echo "LIBBSON_INSTALL_DIR=$PWD/libbson" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$PWD/libbson/lib" >> $GITHUB_ENV
- name: Start MongoDB on Linux
if: ${{ startsWith(runner.os, 'Linux') }}
uses: supercharge/[email protected]
with:
mongodb-version: 4.4
mongodb-replica-set: test-rs
- name: Start MongoDB on MacOS
if: ${{ startsWith(runner.os, 'macOS') }}
run: |
mkdir data
mongod --fork --dbpath=$(pwd)/data --logpath=$PWD/mongo.log
# Install pkg-config
brew install pkg-config
- name: Start MongoDB on Windows
if: ${{ startsWith(runner.os, 'Windows') }}
shell: powershell
run: |
mkdir data
mongod --remove
mongod --install --dbpath=$(pwd)/data --logpath=$PWD/mongo.log
net start MongoDB
- name: Install libbson
run: |
pip install packaging # needed for mongo-c-driver-1.24.4/build/calc_release_version.py
./build-libbson.sh
- name: Install Python dependencies
run: |
python -m pip install -U pip
- name: Install pymongoarrow
run: |
# Install the library with no deps
python -m pip install -v -e "."
- name: Ensure imports with no test deps
run: |
python -c "from pymongoarrow.monkey import patch_all; patch_all()"
- name: Install the test dependencies
run: |
python -m pip install -v -e ".[test]"
- name: Run the tests
run: |
PYTHONWARNINGS=error python -m pytest -s -vv
- name: Check the manifest
run: |
pip install check-manifest
check-manifest -v
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('bindings/python/docs/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: mongo_arrow_documentation
environment-file: bindings/python/docs/environment.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install lib
shell: bash -l {0}
run: |
pip install .
- name: Build docs with warnings
shell: bash -l {0}
run: |
pushd docs
make html SPHINXOPTS="-W"
- name: Run linkcheck
shell: bash -l {0}
run: |
pushd docs
make linkcheck