test subprocesses: sleep() with an interval of 0.1 to make the test p… #1501
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs CI tests and generates wheels on the following platforms: | |
# | |
# * Linux (py2 and py3) | |
# * macOS (py2 and py3) | |
# * Windows (py3, py2 is done by appveyor) | |
# | |
# 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: | |
# Linux + macOS + Windows Python 3 | |
py3: | |
name: py3-${{ matrix.os }}-${{ startsWith(matrix.os, 'ubuntu') && 'all' || matrix.archs }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
archs: "x86_64 i686" | |
- os: macos-12 | |
archs: "x86_64" | |
- os: macos-14 | |
archs: "arm64" | |
- os: windows-2019 | |
archs: "AMD64" | |
- os: windows-2019 | |
archs: "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: Create wheels + run tests | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS: "${{ matrix.archs }}" | |
CIBW_PRERELEASE_PYTHONS: True | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-py3-${{ matrix.os }}-${{ startsWith(matrix.os, 'ubuntu') && 'all' || matrix.archs }} | |
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/ | |
# Linux + macOS + Python 2 | |
py2: | |
name: py2-${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-12] | |
env: | |
CIBW_TEST_COMMAND: | |
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py && | |
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py | |
CIBW_TEST_EXTRAS: test | |
CIBW_BUILD: 'cp27-*' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Create wheels + run tests | |
uses: pypa/[email protected] | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-py2-${{ matrix.os }} | |
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/ | |
# 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==0.4.4 black rstcheck toml-sort sphinx | |
make lint-all | |
# upload weels as a single artefact | |
upload-wheels: | |
needs: [py2, py3] | |
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 |