mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-23 06:52:42 -05:00
167 lines
5.1 KiB
YAML
167 lines
5.1 KiB
YAML
# Copyright 2023 BentoML Team. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
name: ci
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- 'bazel/**'
|
|
- 'typings/**'
|
|
- '*.md'
|
|
- 'changelog.d/**'
|
|
- 'assets/**'
|
|
pull_request:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- 'bazel/**'
|
|
- 'typings/**'
|
|
- '*.md'
|
|
- 'changelog.d/**'
|
|
- 'assets/**'
|
|
env:
|
|
LINES: 120
|
|
COLUMNS: 120
|
|
OPENLLM_DO_NOT_TRACK: True
|
|
PYTHONUNBUFFERED: '1'
|
|
STABLE_PYTHON_VERSION: '3.11'
|
|
HATCH_VERBOSE: 2
|
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
|
|
defaults:
|
|
run:
|
|
shell: bash --noprofile --norc -exo pipefail {0}
|
|
jobs:
|
|
quality:
|
|
runs-on: ubuntu-latest
|
|
name: code-quality
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup CI
|
|
uses: ./.github/actions/setup-repo
|
|
with:
|
|
python-version: ${{ env.STABLE_PYTHON_VERSION }}
|
|
- name: Install OpenLLM
|
|
run: pip install -e .
|
|
- uses: pre-commit/action@v3.0.0
|
|
with:
|
|
extra_args: --all-files --verbose
|
|
tests:
|
|
runs-on: ${{ matrix.os }}
|
|
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
python-version: ['3.8', '3.11']
|
|
exclude:
|
|
- os: 'windows-latest'
|
|
name: tests (${{ matrix.python-version }}.${{ matrix.os }})
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup CI
|
|
uses: ./.github/actions/setup-repo
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Run tests
|
|
run: hatch run tests:python
|
|
- name: Disambiguate coverage filename
|
|
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
|
|
- name: Upload coverage data
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage-data
|
|
path: .coverage.*
|
|
coverage:
|
|
name: report-coverage
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- tests
|
|
if: github.event_name == 'pull_request'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup CI
|
|
uses: ./.github/actions/setup-repo
|
|
with:
|
|
python-version: ${{ env.STABLE_PYTHON_VERSION }}
|
|
- name: Download coverage data
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: coverage-data
|
|
- name: Combine coverage data
|
|
run: hatch run coverage:combine
|
|
- name: Export coverage reports
|
|
run: |
|
|
hatch run coverage:report-xml
|
|
hatch run coverage:report-uncovered-html
|
|
- name: Upload uncovered HTML report
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: uncovered-html-report
|
|
path: htmlcov
|
|
- name: Generate coverage summary
|
|
run: hatch run coverage:generate-summary
|
|
- name: Write coverage summary report
|
|
if: github.event_name == 'pull_request'
|
|
run: hatch run coverage:write-summary-report
|
|
- 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
|
|
cli-benchmark:
|
|
name: Check for CLI responsiveness
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
HYPERFINE_VERSION: '1.12.0'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install hyperfine
|
|
run: |
|
|
wget https://github.com/sharkdp/hyperfine/releases/download/v${HYPERFINE_VERSION}/hyperfine_${HYPERFINE_VERSION}_amd64.deb
|
|
sudo dpkg -i hyperfine_${HYPERFINE_VERSION}_amd64.deb
|
|
- name: Setup CI
|
|
uses: ./.github/actions/setup-repo
|
|
with:
|
|
python-version: ${{ env.STABLE_PYTHON_VERSION }}
|
|
- name: Install self
|
|
run: pip install .
|
|
- name: Speed
|
|
run: hyperfine -m 100 --warmup 10 openllm
|
|
evergreen: # https://github.com/marketplace/actions/alls-green#why
|
|
if: always()
|
|
needs:
|
|
- coverage
|
|
- tests
|
|
- quality
|
|
- cli-benchmark
|
|
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: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: true
|