Skip to content

CI

CI #179

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 0 * * 1/2'
env:
LINES: 120
COLUMNS: 120
BENTOML_DO_NOT_TRACK: True
PYTEST_PLUGINS: bentoml.testing.pytest.plugin
SETUPTOOLS_USE_DISTUTILS: stdlib
BENTOML_BUNDLE_LOCAL_BUILD: True
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
codestyle_check:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all tags and branches
- name: Setup CI
uses: ./.github/actions/setup-repo
- name: Install dependencies
run: pip install black isort ruff
- name: Install pyright
run: npm install -g npm@^7 pyright
- name: Format check
run: |
black --check tests *.py
isort --check .
- name: Lint check
run: ruff check tests *.py
- name: Type check
if: ${{ github.event_name == 'pull_request' }}
run: git diff --name-only --diff-filter=AM "origin/$GITHUB_BASE_REF" -z -- '*.py{,i}' | xargs -0 --no-run-if-empty pyright
service-unit-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
name: python${{ matrix.python-version }}_unit_tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 50
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all tags and branches
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
python-version: ${{ matrix.python-version }}
- name: Run unit tests
run: pytest tests/unit_test.py
service-e2e-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
name: python${{ matrix.python-version }}_e2e_tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 50
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all tags and branches
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
python-version: ${{ matrix.python-version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set up Docker Buildx
if: ${{ matrix.os == 'ubuntu-latest' }}
id: buildx
uses: docker/setup-buildx-action@v2
- name: Run e2e tests
run: pytest tests/e2e_test.py