Skip to content

Commit 809632b

Browse files
authored
refactor(ci): migrate back to setuptools, PEP517 compatible (bentoml#2035)
1 parent 32aca72 commit 809632b

31 files changed

+883
-4008
lines changed

.coveragerc

Lines changed: 0 additions & 21 deletions
This file was deleted.

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/ci.yml

Lines changed: 58 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ jobs:
3636
- scripts/ci/config.yml
3737
bentoml:
3838
- *related
39+
- requirements/tests-requirements.txt
3940
- "bentoml/**"
4041
- "tests/**"
4142
- "docker/**"
4243
docs:
4344
- *related
45+
- requirements/docs-requirements.txt
4446
- "docs/**"
4547
4648
codestyle_check:
4749
runs-on: ubuntu-latest
50+
defaults:
51+
run:
52+
shell: bash
4853
needs:
4954
- diff
5055

@@ -64,49 +69,51 @@ jobs:
6469
defaults:
6570
run:
6671
shell: bash
72+
6773
runs-on: ubuntu-latest
6874
needs:
6975
- diff
7076

7177
if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.docs == 'true') || github.event_name == 'push' }}
7278
steps:
7379
- uses: actions/checkout@v2
80+
with:
81+
fetch-depth: 0 # fetch all tags and branches
7482
- name: Setup python
7583
uses: actions/setup-python@v2
7684
with:
7785
python-version: 3.8
78-
- name: Bootstrap poetry
79-
run: |
80-
curl -sSL https://install.python-poetry.org | python -
81-
- name: Update PATH
82-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
8386

84-
- name: Configure poetry
85-
run: poetry config virtualenvs.in-project true
87+
- name: Get pip cache dir
88+
id: cache-dir
89+
run: |
90+
echo ::set-output name=dir::$(pip cache dir)
8691
8792
- name: Cache pip dependencies
8893
uses: actions/cache@v2
8994
id: cache-pip
9095
with:
91-
path: .venv
92-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/pyproject.toml') }}
93-
restore-keys: |
94-
venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-
96+
path: ${{ steps.cache-dir.outputs.dir }}
97+
key: ${{ runner.os }}-docs-${{ hashFiles('requirements/docs-requirements.txt') }}
9598

9699
- name: Ensure cache is healthy
97100
if: steps.cache-pip.outputs.cache-hit == 'true'
98-
run: timeout 10s poetry run pip --version || rm -rf .venv
101+
run: timeout 10s pip --version || rm -rf $CACHE_DIR
102+
env:
103+
CACHE_DIR: ${{ steps.cache-dir.outputs.dir }}
99104

100105
- name: Install dependencies
101106
if: steps.cache-pip.outputs.cache-hit != 'true' || needs.diff.outputs.related == 'true'
102-
run: poetry install -E "model-server docs"
107+
run: |
108+
pip install ".[bento-server]"
109+
pip install -r requirements/docs-requirements.txt
103110
104111
- name: Install libenchant
105112
run: |
106113
sudo apt-get update && sudo apt-get install -y libenchant-dev
107114
108115
- name: Run spellcheck script
109-
run: poetry run sphinx-build -b spelling ./docs/source ./docs/build || exit 1
116+
run: make spellcheck-docs
110117
shell: bash
111118

112119
unit_tests:
@@ -136,59 +143,43 @@ jobs:
136143
python-version: ${{ matrix.python-version }}
137144
architecture: x64
138145

139-
- name: Get full Python version
140-
id: full-python-version
141-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
142-
143-
- name: Bootstrap poetry
146+
- name: Get pip cache dir
147+
id: cache-dir
144148
run: |
145-
curl -sSL https://install.python-poetry.org | python -
146-
147-
- name: Update PATH
148-
if: ${{ matrix.os != 'windows-latest' }}
149-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
150-
151-
# https://github.community/t/github-actions-windows-runtime-linux-container-mode-docker/135874/2
152-
- name: Update Path for Windows and switch to Linux daemon
153-
if: ${{ matrix.os == 'windows-latest' }}
154-
run: |
155-
echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
156-
157-
- name: Configure poetry
158-
run: poetry config virtualenvs.in-project true
149+
echo ::set-output name=dir::$(pip cache dir)
159150
160151
- name: Cache pip dependencies
161152
uses: actions/cache@v2
162153
id: cache-pip
163154
with:
164-
path: .venv
165-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/pyproject.toml') }}
166-
restore-keys: |
167-
venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-
155+
path: ${{ steps.cache-dir.outputs.dir }}
156+
key: ${{ runner.os }}-tests-${{ hashFiles('requirements/tests-requirements.txt') }}
168157

169-
- name: Ensure cache is healthy
170-
if: ${{ matrix.os != 'macos-latest' && steps.cache-pip.outputs.cache-hit == 'true' }}
171-
run: timeout 10s poetry run pip --version || rm -rf .venv
158+
- name: Install coreutils on MacOS
159+
if: ${{ matrix.os == 'macos-latest' }}
160+
run: brew install coreutils
172161

173-
- name: Ensure cache is healthy (MacOS)
174-
if: ${{ matrix.os == 'macos-latest' && steps.cache-pip.outputs.cache-hit == 'true' }}
175-
run: |
176-
brew install coreutils
177-
timeout 10s poetry run pip --version || rm -rf .venv
162+
- name: Ensure cache is healthy
163+
if: steps.cache-pip.outputs.cache-hit == 'true'
164+
run: timeout 10s pip --version || rm -rf $CACHE_DIR
165+
env:
166+
CACHE_DIR: ${{ steps.cache-dir.outputs.dir }}
178167

179168
- name: Install dependencies
180169
if: steps.cache-pip.outputs.cache-hit != 'true' || needs.diff.outputs.related == 'true'
181-
run: poetry install -E "model-server docs"
170+
run: |
171+
pip install ".[bento-server]"
172+
pip install -r requirements/tests-requirements.txt
182173
183174
- name: Run unit tests
184175
if: ${{ matrix.os != 'windows-latest' }}
185-
run: USE_POETRY=true make tests-unit
176+
run: make tests-unit
186177

187-
- name: Run unit tests for Windows
178+
- name: Run unit tests (Windows)
188179
if: ${{ matrix.os == 'windows-latest' }}
189180
run: |
190-
poetry run python -m pip install pydantic
191-
poetry run python -m pytest tests/unit --cov=bentoml --cov-config=.coveragerc --cov-report=xml:"unit.xml"
181+
pip install -U pydantic
182+
pytest tests/unit --cov=bentoml --cov-config=setup.cfg --cov-report=xml:"unit.xml"
192183
193184
- name: Upload test coverage to Codecov
194185
uses: codecov/codecov-action@v2
@@ -230,32 +221,33 @@ jobs:
230221
python-version: ${{ matrix.python-version }}
231222
architecture: x64
232223

233-
- name: Get full Python version
234-
id: full-python-version
235-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
224+
- name: Get pip cache dir
225+
id: cache-dir
226+
run: |
227+
echo ::set-output name=dir::$(pip cache dir)
236228
237229
- name: Cache pip dependencies
238230
uses: actions/cache@v2
239231
id: cache-pip
240232
with:
241-
path: .venv
242-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/pyproject.toml') }}
243-
restore-keys: |
244-
venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-
233+
path: ${{ steps.cache-dir.outputs.dir }}
234+
key: ${{ runner.os }}-tests-${{ hashFiles('requirements/tests-requirements.txt') }}
245235

246-
- name: Ensure cache is healthy
247-
if: ${{ matrix.os != 'macos-latest' && steps.cache-pip.outputs.cache-hit == 'true' }}
248-
run: timeout 10s pip --version || rm -rf .venv
236+
- name: Install coreutils on MacOS
237+
if: ${{ matrix.os == 'macos-latest' }}
238+
run: brew install coreutils
249239

250-
- name: Ensure cache is healthy (MacOS)
251-
if: ${{ matrix.os == 'macos-latest' && steps.cache-pip.outputs.cache-hit == 'true' }}
252-
run: |
253-
brew install coreutils
254-
timeout 10s pip --version || rm -rf .venv
240+
- name: Ensure cache is healthy
241+
if: steps.cache-pip.outputs.cache-hit == 'true'
242+
run: timeout 10s pip --version || rm -rf $CACHE_DIR
243+
env:
244+
CACHE_DIR: ${{ steps.cache-dir.outputs.dir }}
255245

256246
- name: Install dependencies
257247
if: steps.cache-pip.outputs.cache-hit != 'true' || needs.diff.outputs.related == 'true'
258-
run: pip install . pytest pytest-cov pytest-asyncio
248+
run: |
249+
pip install ".[bento-server]"
250+
pip install -r requirements/tests-requirements.txt
259251
260252
- name: Run tests and generate coverage report
261253
run: make tests-general_features

0 commit comments

Comments
 (0)