This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
Merge branch 'giampaolo-master' #170
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: | |
pull_request: | |
push: | |
branches: master | |
release: | |
types: [released, prereleased] | |
workflow_dispatch: # allows running workflow manually from the Actions tab | |
permissions: | |
contents: write | |
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: | |
tag: | |
# additionally create a release for every commit to master | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: ncipollo/release-action@v1 | |
with: | |
commit: ${{ github.sha }} | |
tag: ${{ github.run_id }} | |
generateReleaseNotes: true | |
# Linux + macOS + Windows CPython 3.6+ | |
py3: | |
name: py3, ${{ matrix.os }}, ${{ matrix.archs }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: macos-13, archs: "x86_64"} | |
- {os: macos-14, archs: "arm64"} | |
- {os: ubuntu-latest, archs: "x86_64 i686"} | |
- {os: ubuntu-latest, archs: "aarch64"} | |
- {os: windows-2019, archs: "AMD64 x86"} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
if: matrix.archs == 'aarch64' | |
- name: Create wheels + run tests | |
uses: pypa/[email protected] | |
with: | |
config-file: "./cibuildwheel.toml" | |
env: | |
CIBW_ARCHS: ${{ matrix.archs }} | |
CIBW_PRERELEASE_PYTHONS: True | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: wheelhouse | |
- uses: softprops/action-gh-release@v1 | |
# additionally create a release for every commit to master | |
if: github.event_name == 'release' || github.event_name == 'push' | |
with: | |
files: wheelhouse/*.whl | |
tag_name: ${{ github.event_name == 'release' && github.ref || github.run_id }} | |
- name: Generate .tar.gz | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
pip install -U wheel | |
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@v4 | |
with: | |
python-version: 3.9 | |
- name: Create wheels + run tests | |
uses: pypa/[email protected] | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: wheelhouse | |
- uses: softprops/action-gh-release@v1 | |
# additionally create a release for every commit to master | |
if: github.event_name == 'release' || github.event_name == 'push' | |
with: | |
files: wheelhouse/*.whl | |
tag_name: ${{ github.event_name == 'release' && github.ref || github.run_id }} | |
- name: Generate .tar.gz | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
pip install -U wheel | |
make generate-manifest | |
python setup.py sdist | |
mv dist/psutil*.tar.gz wheelhouse/ | |
gh-pages: | |
# only run when action-gh-release ran | |
if: github.event_name == 'release' || github.event_name == 'push' | |
needs: [py3, py2] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v4 | |
- name: Write index.html | |
run: | | |
mkdir ./public | |
pip install dominate requests | |
curl -sSL https://gist.github.com/ddelange/e4fb438f2f724413f45c4bece46aacfa/raw/release_assets_pip_find_links.py | python - > ./public/index.html | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
# Run linters | |
linters: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: 'Run linters' | |
run: | | |
python3 -m pip install ruff==0.3.4 black rstcheck toml-sort sphinx | |
make lint-all | |
# Check sanity of .tar.gz + wheel files | |
check-dist: | |
needs: [py2, py3] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- uses: actions/download-artifact@v3 | |
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 |