urllib3

Форк
0
174 строки · 6.0 Кб
1
name: CI
2

3
on: [push, pull_request, workflow_dispatch]
4

5
permissions: "read-all"
6

7
defaults:
8
  run:
9
    shell: bash
10

11
jobs:
12
  package:
13
    runs-on: ubuntu-latest
14
    timeout-minutes: 10
15

16
    steps:
17
      - name: "Checkout repository"
18
        uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
19

20
      - name: "Setup Python"
21
        uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
22
        with:
23
          python-version: "3.x"
24
          cache: "pip"
25

26
      - name: "Check packages"
27
        run: |
28
          python -m pip install -U pip setuptools wheel build twine rstcheck
29
          python -m build
30
          rstcheck CHANGES.rst
31
          python -m twine check dist/*
32

33
  test:
34
    strategy:
35
      fail-fast: false
36
      matrix:
37
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
38
        os:
39
          - macos-12
40
          - windows-latest
41
          - ubuntu-22.04
42
        nox-session: ['']
43
        include:
44
          - experimental: false
45
          # integration
46
          # 3.8 and 3.9 have a known issue with large SSL requests that we work around:
47
          # https://github.com/urllib3/urllib3/pull/3181#issuecomment-1794830698
48
          - python-version: "3.8"
49
            os: ubuntu-latest
50
            experimental: false
51
            nox-session: test_integration
52
          - python-version: "3.9"
53
            os: ubuntu-latest
54
            experimental: false
55
            nox-session: test_integration
56
          - python-version: "3.12"
57
            os: ubuntu-latest
58
            experimental: false
59
            nox-session: test_integration
60
          # OpenSSL 1.1.1
61
          - python-version: "3.8"
62
            os: ubuntu-20.04
63
            experimental: false
64
            nox-session: test-3.8
65
          # pypy
66
          - python-version: "pypy-3.8"
67
            os: ubuntu-latest
68
            experimental: false
69
            nox-session: test-pypy3.8
70
          - python-version: "pypy-3.9"
71
            os: ubuntu-latest
72
            experimental: false
73
            nox-session: test-pypy3.9
74
          - python-version: "pypy-3.10"
75
            os: ubuntu-latest
76
            experimental: false
77
            nox-session: test-pypy3.10
78
          - python-version: "3.x"
79
          # brotli
80
            os: ubuntu-latest
81
            experimental: false
82
            nox-session: test_brotlipy
83
          # Test CPython with a broken hostname_checks_common_name (the fix is in 3.9.3)
84
          - python-version: "3.9.2"
85
            os: ubuntu-20.04  # CPython 3.9.2 is not available for ubuntu-22.04.
86
            experimental: false
87
            nox-session: test-3.9
88
          - python-version: "3.11"
89
            os: ubuntu-latest
90
            nox-session: emscripten
91
            experimental: true
92
          - python-version: "3.13"
93
            experimental: true
94
        exclude:
95
          # Ubuntu 22.04 comes with OpenSSL 3.0, so only CPython 3.9+ is compatible with it
96
          # https://github.com/python/cpython/issues/83001
97
          - python-version: "3.8"
98
            os: ubuntu-22.04
99

100
    runs-on: ${{ matrix.os }}
101
    name: ${{ fromJson('{"macos-12":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu","ubuntu-20.04":"Ubuntu 20.04 (OpenSSL 1.1.1)","ubuntu-22.04":"Ubuntu 22.04 (OpenSSL 3.0)"}')[matrix.os] }} ${{ matrix.python-version }} ${{ matrix.nox-session}}
102
    continue-on-error: ${{ matrix.experimental }}
103
    timeout-minutes: 30
104
    steps:
105
      - name: "Checkout repository"
106
        uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
107
        with:
108
          fetch-depth: 0 # Needed to fetch the version from git
109

110
      - name: "Setup Python ${{ matrix.python-version }}"
111
        uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
112
        with:
113
          python-version: ${{ matrix.python-version }}
114
          allow-prereleases: true
115

116
      - name: "Install dependencies"
117
        run: python -m pip install --upgrade pip setuptools nox
118

119
      - name: "Install Chrome"
120
        uses: browser-actions/setup-chrome@db1b524c26f20a8d1a10f7fc385c92387e2d0477 # v1.7.1
121
        if: ${{ matrix.nox-session == 'emscripten' }}
122
      - name: "Install Firefox"
123
        uses: browser-actions/setup-firefox@233224b712fc07910ded8c15fb95a555c86da76f # v1.5.0
124
        if: ${{ matrix.nox-session == 'emscripten' }}
125
      - name: "Run tests"
126
        # If no explicit NOX_SESSION is set, run the default tests for the chosen Python version
127
        run: nox -s ${NOX_SESSION:-test-$PYTHON_VERSION}
128
        env:
129
          PYTHON_VERSION: ${{ matrix.python-version }}
130
          NOX_SESSION: ${{ matrix.nox-session }}
131

132
      - name: "Upload coverage data"
133
        uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
134
        with:
135
          name: coverage-data-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.experimental }}-${{ matrix.nox-session }}
136
          path: ".coverage.*"
137
          if-no-files-found: error
138

139

140
  coverage:
141
    if: always()
142
    runs-on: "ubuntu-latest"
143
    needs: test
144
    steps:
145
      - name: "Checkout repository"
146
        uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
147

148
      - name: "Setup Python"
149
        uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
150
        with:
151
          python-version: "3.x"
152

153
      - name: "Install coverage"
154
        run: "python -m pip install -r dev-requirements.txt"
155

156
      - name: "Download coverage data"
157
        uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
158
        with:
159
          pattern: coverage-data-*
160
          merge-multiple: true
161

162
      - name: "Combine & check coverage"
163
        run: |
164
          python -m build
165
          python -m coverage combine
166
          python -m coverage html --skip-covered --skip-empty
167
          python -m coverage report --ignore-errors --show-missing --fail-under=100
168

169
      - if: ${{ failure() }}
170
        name: "Upload report if check failed"
171
        uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
172
        with:
173
          name: coverage-report
174
          path: htmlcov
175

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

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

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

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