forked from Nayjest/lm-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (55 loc) · 1.74 KB
/
tests.yml
File metadata and controls
61 lines (55 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry
poetry install
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
- name: Test with pytest
if: matrix.python-version != '3.13'
env:
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pytest
- name: Test with pytest +coverage
if: matrix.python-version == '3.13'
env:
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pytest --cov=lm_proxy --cov-report=xml
- name: Generate coverage badge
if: matrix.python-version == '3.13' && (github.event_name == 'push' || github.event_name == 'pull_request')
uses: tj-actions/coverage-badge-py@v2
with:
output: 'coverage.svg'
- name: Commit coverage badge
if: matrix.python-version == '3.13' && (github.event_name == 'push' || github.event_name == 'pull_request')
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch origin
git checkout ${{ github.head_ref || github.ref_name }} --
git add coverage.svg
git commit -m "Update coverage badge [skip ci]" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}