psutil

Форк
0
153 строки · 4.3 Кб
1
# Runs CI tests and generates wheels on the following platforms:
2
#
3
# * Linux (py2 and py3)
4
# * macOS (py2 and py3)
5
# * Windows (py3, py2 is done by appveyor)
6
#
7
# Useful URLs:
8
# * https://github.com/pypa/cibuildwheel
9
# * https://github.com/actions/checkout
10
# * https://github.com/actions/setup-python
11
# * https://github.com/actions/upload-artifact
12

13
on: [push, pull_request]
14
name: build
15
concurrency:
16
  group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
17
  cancel-in-progress: true
18
jobs:
19
  # Linux + macOS + Windows Python 3
20
  py3:
21
    name: "py3-${{ matrix.os }}-${{ matrix.arch }}"
22
    runs-on: ${{ matrix.os }}
23
    timeout-minutes: 30
24
    strategy:
25
      fail-fast: false
26
      matrix:
27
        include:
28
        - {os: ubuntu-latest, arch: x86_64}
29
        - {os: ubuntu-latest, arch: i686}
30
        - {os: ubuntu-latest, arch: aarch64}
31
        - {os: macos-12, arch: x86_64}
32
        - {os: macos-14, arch: arm64}
33
        - {os: windows-2019, arch: AMD64}
34
        - {os: windows-2019, arch: x86}
35
    steps:
36
    - uses: actions/checkout@v4
37

38
    # see https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
39
    - name: "Install python 3.8 universal2 on macOS arm64"
40
      if: runner.os == 'macOS' && runner.arch == 'ARM64'
41
      uses: actions/setup-python@v5
42
      env:
43
          PIP_DISABLE_PIP_VERSION_CHECK: 1
44
      with:
45
        python-version: 3.8
46

47
    - uses: actions/setup-python@v5
48
      with:
49
        python-version: 3.11
50

51
    - name: Set up QEMU
52
      uses: docker/setup-qemu-action@v3
53
      if: matrix.arch == 'aarch64'
54

55
    - name: Create wheels + run tests
56
      uses: pypa/cibuildwheel@v2.19.2
57
      env:
58
        CIBW_ARCHS: "${{ matrix.arch }}"
59
        CIBW_PRERELEASE_PYTHONS: True
60

61
    - name: Upload wheels
62
      uses: actions/upload-artifact@v4
63
      with:
64
        name: wheels-py3-${{ matrix.os }}-${{ matrix.arch }}
65
        path: wheelhouse
66

67
    - name: Generate .tar.gz
68
      if: matrix.os == 'ubuntu-latest'
69
      run: |
70
        make generate-manifest
71
        python setup.py sdist
72
        mv dist/psutil*.tar.gz wheelhouse/
73

74
  # Linux + macOS + Python 2
75
  py2:
76
    name: py2-${{ matrix.os }}
77
    runs-on: ${{ matrix.os }}
78
    timeout-minutes: 20
79
    strategy:
80
      fail-fast: false
81
      matrix:
82
        os: [ubuntu-latest, macos-12]
83
    env:
84
      CIBW_TEST_COMMAND:
85
        PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py &&
86
        PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py
87
      CIBW_TEST_EXTRAS: test
88
      CIBW_BUILD: 'cp27-*'
89

90
    steps:
91
    - uses: actions/checkout@v4
92
    - uses: actions/setup-python@v5
93
      with:
94
        python-version: 3.9
95

96
    - name: Create wheels + run tests
97
      uses: pypa/cibuildwheel@v1.12.0
98

99
    - name: Upload wheels
100
      uses: actions/upload-artifact@v4
101
      with:
102
        name: wheels-py2-${{ matrix.os }}
103
        path: wheelhouse
104

105
    - name: Generate .tar.gz
106
      if: matrix.os == 'ubuntu-latest'
107
      run: |
108
        make generate-manifest
109
        python setup.py sdist
110
        mv dist/psutil*.tar.gz wheelhouse/
111

112
  # Run linters
113
  linters:
114
    runs-on: ubuntu-latest
115
    steps:
116
    - uses: actions/checkout@v4
117
    - uses: actions/setup-python@v5
118
      with:
119
        python-version: 3.x
120
    - name: 'Run linters'
121
      run: |
122
        python3 -m pip install ruff==0.4.4 black rstcheck toml-sort sphinx
123
        make lint-all
124

125
  # upload weels as a single artefact
126
  upload-wheels:
127
    needs: [py2, py3]
128
    runs-on: ubuntu-latest
129
    steps:
130
      - uses: actions/upload-artifact/merge@v4
131
        with:
132
          name: wheels
133
          pattern: wheels-*
134
          separate-directories: false
135
          delete-merged: true
136

137
  # Check sanity of .tar.gz + wheel files
138
  check-dist:
139
    needs: [upload-wheels]
140
    runs-on: ubuntu-latest
141
    steps:
142
      - uses: actions/checkout@v4
143
      - uses: actions/setup-python@v5
144
        with:
145
          python-version: 3.x
146
      - uses: actions/download-artifact@v4
147
        with:
148
          name: wheels
149
          path: wheelhouse
150
      - run: |
151
          python scripts/internal/print_hashes.py wheelhouse/
152
          pipx run twine check --strict wheelhouse/*
153
          pipx run abi3audit --verbose --strict wheelhouse/*-abi3-*.whl
154

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

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

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

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