-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
132 lines (120 loc) · 3.82 KB
/
build.yml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Runs CI tests and generates wheels on the following platforms:
# * Linux
# * macOS
# * Windows
#
# Useful URLs:
# * https://github.com/pypa/cibuildwheel
# * https://github.com/actions/checkout
# * https://github.com/actions/setup-python
# * https://github.com/actions/upload-artifact
on: [push, pull_request]
name: build
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
cancel-in-progress: true
jobs:
# Run tests on Linux, macOS, Windows
tests:
name: "tests, ${{ matrix.os }}, ${{ matrix.arch }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, arch: x86_64}
- {os: ubuntu-latest, arch: i686}
- {os: ubuntu-latest, arch: aarch64}
- {os: macos-13, arch: x86_64}
- {os: macos-14, arch: arm64}
- {os: windows-2019, arch: AMD64}
- {os: windows-2019, arch: x86}
steps:
- uses: actions/checkout@v4
# see https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
- name: "Install python 3.8 universal2 on macOS arm64"
if: runner.os == 'macOS' && runner.arch == 'ARM64'
uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: 3.8
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: matrix.arch == 'aarch64'
- name: Create wheels + run tests
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_ENABLE: "cpython-prerelease"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND:
make -C {project} PYTHON="env python" PSUTIL_SCRIPTS_DIR="{project}/scripts" install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse
- name: Generate .tar.gz
if: matrix.os == 'ubuntu-latest'
run: |
make generate-manifest
python setup.py sdist
mv dist/psutil*.tar.gz wheelhouse/
# Test python 2.7 fallback installation message produced by setup.py
py2-fallback:
name: py2.7 setup.py check
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: LizardByte/setup-python-action@master
with:
python-version: '2.7'
- run: python scripts/internal/test_python2_setup_py.py
# Run linters
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: 'Run linters'
run: |
python3 -m pip install ruff black rstcheck toml-sort sphinx
make lint-all
# Produce wheels as artifacts.
upload-wheels:
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact/merge@v4
with:
name: wheels
pattern: wheels-*
separate-directories: false
delete-merged: true
# Check sanity of .tar.gz + wheel files
check-dist:
needs: [upload-wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/download-artifact@v4
with:
name: wheels
path: wheelhouse
- run: |
python scripts/internal/print_hashes.py wheelhouse/
pipx run twine check --strict wheelhouse/*
pipx run abi3audit --verbose --strict wheelhouse/*-abi3-*.whl