Skip to content

CI

CI #28

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- 'bazel/**'
- 'typings/**'
pull_request:
paths-ignore:
- 'docs/**'
- 'bazel/**'
- 'typings/**'
schedule:
- cron: '0 0 * * 1/2'
env:
LINES: 120
COLUMNS: 120
BENTOML_DO_NOT_TRACK: True
PYTEST_PLUGINS: bentoml.testing.pytest.plugin
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
jobs:
unit:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.11']
name: unit-tests (python${{ matrix.python-version }}.${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Unit tests
run: nox --session unit-${{ matrix.python-version }}
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.unit.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-unit-data
path: .coverage.*
integrations:
name: framework-integration-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
framework:
- catboost
- detectron
- diffusers
- easyocr
- fastai
- flax
- keras
- lightgbm
- onnx
- picklable_model
- pytorch
- pytorch_lightning
- sklearn
- tensorflow
- torchscript
- transformers
- xgboost
exclude:
- framework: transformers # NOTE: CI runners doesn't have enough space to run all transformers jobs
- framework: detectron # NOTE: tested locally and the latest PyPI are to obsolete.
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: pip
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Run framework integration tests
run: nox --session "framework-integration(framework='${{ matrix.framework }}')"
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.integrations.ubuntu-latest.3.8.${{ matrix.framework }}"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-integrations-data
path: .coverage.*
e2e-monitoring:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.11']
name: monitoring-e2e-tests (python${{ matrix.python-version }}.${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
env:
BENTOML_BUNDLE_LOCAL_BUILD: True
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set up Docker Buildx
if: ${{ matrix.os == 'ubuntu-latest' }}
id: buildx
uses: docker/setup-buildx-action@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Run the monitoring tests
run: nox -s e2e-monitoring-${{ matrix.python-version }}
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.monitoring.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-monitoring-data
path: .coverage.*
e2e-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.11']
suite: ['bento_server_http', 'bento_new_sdk']
name: ${{ matrix.suite }}-e2e-tests (python${{ matrix.python-version }}.${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
env:
BENTOML_BUNDLE_LOCAL_BUILD: True
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set up Docker Buildx
if: ${{ matrix.os == 'ubuntu-latest' }}
id: buildx
uses: docker/setup-buildx-action@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Run ${{ matrix.suite }} tests
run: nox -s "e2e-testing-${{ matrix.python-version }}(suite='${{ matrix.suite }}')"
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.e2e.${{ matrix.os }}.${{ matrix.python-version }}.${{ matrix.suite }}"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-e2e-data
path: .coverage.*
coverage:
name: report-coverage
runs-on: ubuntu-latest
needs:
- e2e-test
- e2e-monitoring
- unit
- integrations
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: pip
python-version: '3.11'
- name: Download e2e coverage
uses: actions/download-artifact@v3
with:
name: coverage-e2e-data
- name: Download monitoring coverage
uses: actions/download-artifact@v3
with:
name: coverage-monitoring-data
- name: Download integrations coverage
uses: actions/download-artifact@v3
with:
name: coverage-integrations-data
- name: Download unit coverage
uses: actions/download-artifact@v3
with:
name: coverage-unit-data
- name: Install dependencies
run: pipx install pdm && pipx install nox
- name: Export coverage reports and generate summary
run: nox -s coverage
- name: Upload uncovered HTML report
uses: actions/upload-artifact@v3
with:
name: uncovered-html-report
path: htmlcov
- name: Update coverage pull request comment
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
uses: marocchino/sticky-pull-request-comment@v2
with:
path: coverage-report.md
evergreen: # https://github.com/marketplace/actions/alls-green#why
if: github.event_name == 'pull_request'
needs:
- coverage
- e2e-test
- e2e-monitoring
- unit
- integrations
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true