outlines

Форк
0
90 строк · 2.3 Кб
1
name: Tests
2

3
on:
4
  pull_request:
5
    branches: [main]
6
  push:
7
    branches: [main]
8

9
jobs:
10
  style:
11
    name: Check the code style
12
    runs-on: ubuntu-latest
13
    steps:
14
    - uses: actions/checkout@v3
15
    - uses: actions/setup-python@v4
16
      with:
17
        python-version: "3.10"
18
    - uses: pre-commit/action@v3.0.0
19

20
  tests:
21
    name: Run the tests
22
    runs-on: ubuntu-latest
23
    strategy:
24
      matrix:
25
        python-version: ["3.8", "3.10"]
26
    steps:
27
    - uses: actions/checkout@v3
28
    - name: Set up Python ${{ matrix.python-version }}
29
      uses: actions/setup-python@v4
30
      with:
31
        python-version: ${{ matrix.python-version }}
32
    - name: Set up test environment
33
      run: |
34
        python -m pip install --upgrade pip
35
        pip install .[test]
36
    - name: Run tests
37
      run: |
38
        pytest --cov=outlines
39
    - name: Upload coverage data
40
      uses: actions/upload-artifact@v3
41
      with:
42
        name: coverage-data
43
        path: .coverage*
44
        if-no-files-found: ignore
45

46
  coverage:
47
    name: Combine & check coverage.
48
    needs: tests
49
    runs-on: ubuntu-latest
50

51
    steps:
52
      - uses: actions/checkout@v3
53
        with:
54
          fetch-depth: 0
55

56
      - uses: actions/setup-python@v4
57
        with:
58
          cache: pip
59
          python-version: "3.11"
60

61
      - name: Set up environment
62
        run: |
63
          pip install --upgrade "coverage[toml]>=5.1" diff-cover
64

65
      - uses: actions/download-artifact@v3
66
        with:
67
          name: coverage-data
68

69
      - name: Fetch master for coverage diff
70
        run: |
71
          git fetch --no-tags --prune origin main
72

73
      - name: Combine coverage & fail if it's <100%.
74
        run: |
75
          # Combine coverage files (not needed now, but maybe later)
76
          # python -m coverage combine
77

78
          # Produce an html report with absolute coverage information
79
          python -m coverage html --skip-covered --skip-empty
80

81
          # Report relative coverage and write to the workflow's summary
82
          python -m coverage xml
83
          diff-cover coverage.xml --markdown-report=coverage.md --fail-under=100 || (cat coverage.md >> $GITHUB_STEP_SUMMARY && exit 1)
84

85
      - name: Upload HTML report if check failed.
86
        uses: actions/upload-artifact@v3
87
        with:
88
          name: html-report
89
          path: htmlcov
90
        if: ${{ failure() }}
91

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

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

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

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