openllm

Форк
0
146 строк · 5.4 Кб
1
name: Continuous Integration
2
on:
3
  workflow_call:
4
  push:
5
    branches: [main]
6
    paths-ignore:
7
      - 'docs/**'
8
      - 'bazel/**'
9
      - 'typings/**'
10
      - '*.md'
11
      - 'changelog.d/**'
12
      - 'assets/**'
13
  pull_request:
14
    branches: [main]
15
    paths-ignore:
16
      - 'docs/**'
17
      - 'bazel/**'
18
      - 'typings/**'
19
      - '*.md'
20
      - 'changelog.d/**'
21
      - 'assets/**'
22
env:
23
  LINES: 120
24
  COLUMNS: 120
25
  OPENLLM_DO_NOT_TRACK: True
26
  PYTHONUNBUFFERED: '1'
27
  HATCH_VERBOSE: 2
28
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
29
defaults:
30
  run:
31
    shell: bash --noprofile --norc -exo pipefail {0}
32
jobs:
33
  tests:
34
    runs-on: ${{ matrix.os }}
35
    if: ${{ github.event_name == 'pull_request' || github.event_name == 'push'|| github.event_name == 'workflow_call' }}
36
    strategy:
37
      fail-fast: false
38
      matrix:
39
        os: [ubuntu-latest, macos-latest, windows-latest]
40
        python-version: ['3.8', '3.11']
41
        exclude:
42
          - os: 'windows-latest'
43
    name: tests (${{ matrix.python-version }}.${{ matrix.os }})
44
    steps:
45
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
46
        with:
47
          fetch-depth: 0
48
          ref: ${{ github.event.pull_request.head.sha }}
49
      - uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
50
        with:
51
          bentoml-version: 'main'
52
          python-version: ${{ matrix.python-version }}
53
      - name: Run tests
54
        run: hatch run tests:python
55
      - name: Disambiguate coverage filename
56
        run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
57
      - name: Upload coverage data
58
        uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # ratchet:actions/upload-artifact@v3
59
        with:
60
          name: coverage-data
61
          path: .coverage.*
62
  coverage:
63
    name: report-coverage
64
    runs-on: ubuntu-latest
65
    if: false
66
    needs: tests
67
    steps:
68
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
69
        with:
70
          fetch-depth: 0
71
          ref: ${{ github.event.pull_request.head.sha }}
72
      - uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
73
        with:
74
          bentoml-version: 'main'
75
          python-version-file: .python-version-default
76
      - name: Download coverage data
77
        uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
78
        with:
79
          name: coverage-data
80
      - name: Combine coverage data
81
        run: hatch run coverage:combine
82
      - name: Export coverage reports
83
        run: |
84
          hatch run coverage:report-xml openllm-python
85
          hatch run coverage:report-uncovered-html openllm-python
86
      - name: Upload uncovered HTML report
87
        uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # ratchet:actions/upload-artifact@v3
88
        with:
89
          name: uncovered-html-report
90
          path: htmlcov
91
      - name: Generate coverage summary
92
        run: hatch run coverage:generate-summary
93
      - name: Write coverage summary report
94
        if: github.event_name == 'pull_request'
95
        run: hatch run coverage:write-summary-report
96
      - name: Update coverage pull request comment
97
        if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
98
        uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd # ratchet:marocchino/sticky-pull-request-comment@v2
99
        with:
100
          path: coverage-report.md
101
  cli-benchmark:
102
    name: Check for CLI responsiveness
103
    runs-on: ubuntu-latest
104
    env:
105
      HYPERFINE_VERSION: '1.12.0'
106
    steps:
107
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1
108
        with:
109
          fetch-depth: 0
110
      - name: Install hyperfine
111
        run: |
112
          wget https://github.com/sharkdp/hyperfine/releases/download/v${HYPERFINE_VERSION}/hyperfine_${HYPERFINE_VERSION}_amd64.deb
113
          sudo dpkg -i hyperfine_${HYPERFINE_VERSION}_amd64.deb
114
      - uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1
115
        with:
116
          bentoml-version: 'main'
117
          python-version-file: .python-version-default
118
      - name: Install self
119
        run: bash local.sh
120
      - name: Speed
121
        run: hyperfine -m 100 --warmup 10 openllm
122
  brew-dry-run:
123
    name: Running dry-run tests for brew
124
    runs-on: macos-latest
125
    steps:
126
      - name: Install tap and dry-run
127
        run: |
128
          brew tap bentoml/openllm https://github.com/bentoml/openllm
129
          brew install openllm
130
          openllm --help
131
          openllm models --show-available
132
  evergreen: # https://github.com/marketplace/actions/alls-green#why
133
    if: always()
134
    needs:
135
      - tests
136
      - cli-benchmark
137
      - brew-dry-run
138
    runs-on: ubuntu-latest
139
    steps:
140
      - name: Decide whether the needed jobs succeeded or failed
141
        uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # ratchet:re-actors/alls-green@release/v1
142
        with:
143
          jobs: ${{ toJSON(needs) }}
144
concurrency:
145
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
146
  cancel-in-progress: true
147

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.