Skip to content

CI

CI #216

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 0 * * 1/2'
env:
LINES: 120
COLUMNS: 120
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
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 }}_tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
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 tests
run: pytest tests -vvv