# 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: 20 strategy: fail-fast: false matrix: include: - { os: ubuntu-latest, arch: x86_64 } - { os: ubuntu-latest, arch: i686 } - { os: ubuntu-24.04-arm, arch: aarch64 } - { os: macos-13, arch: x86_64 } - { os: macos-14, arch: arm64 } - { os: windows-2025, arch: AMD64 } - { os: windows-2025, arch: x86 } - { os: windows-11-arm, arch: ARM64 } steps: - uses: actions/checkout@v5 # Only install Python 3.8 on macOS ARM64 for universal2 support - name: "Install Python 3.8 on macOS ARM64" if: runner.os == 'macOS' && runner.arch == 'ARM64' uses: actions/setup-python@v5 with: python-version: 3.8 - uses: actions/setup-python@v5 with: python-version: 3.11 - name: Build wheels + run tests uses: pypa/cibuildwheel@v2.23.3 env: CIBW_ARCHS: "${{ matrix.arch }}" CIBW_ENABLE: "${{ startsWith(github.ref, 'refs/tags/') && '' || 'cpython-prerelease' }}" - name: Upload wheels uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.os }}-${{ matrix.arch }} path: wheelhouse - name: Generate source distribution (.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@v5 - uses: LizardByte/actions/actions/setup_python@master with: python-version: 2.7 - run: python scripts/internal/test_python2_setup_py.py linters: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: 3.x - name: "Run linters" run: | make lint-ci # 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@v5 - 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