-
Notifications
You must be signed in to change notification settings - Fork 1.2k
170 lines (162 loc) · 5.18 KB
/
github-actions.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
name: MongoengineCI
on:
# All PR
pull_request:
# master branch merge
push:
branches:
- master
# Manual trigger from Action page
workflow_dispatch:
# release tags
create:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+*'
env:
MONGODB_3_6: 3.6.23
MONGODB_4_0: 4.0.28
MONGODB_4_4: 4.4
MONGODB_5_0: "5.0"
MONGODB_6_0: "6.0"
MONGODB_7_0: "7.0"
PYMONGO_3_11: 3.11
PYMONGO_3_12: 3.12
PYMONGO_3_13: 3.13
PYMONGO_4_0: 4.0
PYMONGO_4_3: 4.3.3
PYMONGO_4_4: 4.4.1
PYMONGO_4_6: 4.6.2
PYMONGO_4_7: 4.7.3
PYMONGO_4_8: 4.8.0
PYMONGO_4_9: 4.9
MAIN_PYTHON_VERSION: 3.9
MONGOSH: 2.2.15 # Needed for MongoDB 6.0+
jobs:
linting:
# Run pre-commit (https://pre-commit.com/)
# which runs pre-configured linter & autoformatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
check-latest: true
- run: bash .github/workflows/install_ci_python_dep.sh
- run: pre-commit run -a
test:
# Test suite run against recent python versions
# and against a few combination of MongoDB and pymongo
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9, pypy3.10]
MONGODB: [$MONGODB_4_0]
PYMONGO: [$PYMONGO_3_11]
include:
- python-version: 3.8
MONGODB: $MONGODB_3_6
PYMONGO: $PYMONGO_3_12
- python-version: 3.9
MONGODB: $MONGODB_4_4
PYMONGO: $PYMONGO_3_13
- python-version: "3.10"
MONGODB: $MONGODB_4_4
PYMONGO: $PYMONGO_4_0
- python-version: "3.11"
MONGODB: $MONGODB_5_0
PYMONGO: $PYMONGO_4_3
- python-version: "3.11"
MONGODB: $MONGODB_6_0
PYMONGO: $PYMONGO_4_4
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_6
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_7
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_8
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_9
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: install mongo and ci dependencies
run: |
bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }}
bash .github/workflows/install_mongosh.sh ${{ matrix.MONGODB }} ${{ env.MONGOSH }}
bash .github/workflows/install_ci_python_dep.sh
bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }}
- name: tox dry-run (to pre-install venv)
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "-k=test_ci_placeholder"
- name: Run test suite
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "--cov=mongoengine"
- name: Send coverage to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }}
run: coveralls
build_doc_dryrun:
# ensures that readthedocs can be built continuously
# to avoid that it breaks when new releases are being created
# The way RTD works is that it builds the doc on its side
# builds are visible at https://readthedocs.org/projects/mongoengine-odm/builds/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.9
check-latest: true
- name: install python dep
run: |
pip install -e .
pip install -r docs/requirements.txt
- name: build doc
run: |
cd docs
make html-readthedocs
build-dryrun:
runs-on: ubuntu-latest
needs: [linting, test, build_doc_dryrun]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
check-latest: true
- name: build dummy wheel for test-pypi
run: |
pip install wheel
python setup.py sdist bdist_wheel
build-n-publish:
runs-on: ubuntu-latest
needs: [linting, test, build_doc_dryrun, build-dryrun]
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
check-latest: true
# todo separate build from publish
# https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have
- name: build dummy wheel for test-pypi
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: publish pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_token }}