tighter version specification; try to make git shut up. #52
Workflow file for this run
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
### | |
# Initially copied from | |
# https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml | |
# And later based on the version I (jamadden) updated at | |
# gevent/gevent, and then at zodb/relstorage | |
# | |
# Original comment follows. | |
### | |
### | |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
### | |
### | |
# Important notes on GitHub actions: | |
# | |
# - We only get 2,000 free minutes a month (private repos) | |
# - We only get 500MB of artifact storage | |
# - Cache storage is limited to 7 days and 5GB. | |
# - macOS minutes are 10x as expensive as Linux minutes | |
# - windows minutes are twice as expensive. | |
# | |
# So keep those workflows light. | |
# | |
# In December 2020, github only supports x86/64. If we wanted to test | |
# on other architectures, we can use docker emulation, but there's no | |
# native support. | |
# | |
# Another major downside: You can't just re-run the job for one part | |
# of the matrix. So if there's a transient test failure that hit, say, 3.8, | |
# to get a clean run every version of Python runs again. That's bad. | |
# https://github.community/t/ability-to-rerun-just-a-single-job-in-a-workflow/17234/65 | |
name: tests | |
# Triggers the workflow on push or pull request events | |
on: [push, pull_request] | |
# Limiting to particular branches might be helpful to conserve minutes. | |
#on: | |
# push: | |
# branches: [ $default-branch ] | |
# pull_request: | |
# branches: [ $default-branch ] | |
env: | |
# Weirdly, this has to be a top-level key, not ``defaults.env`` | |
PYTHONHASHSEED: 8675309 | |
PYTHONUNBUFFERED: 1 | |
PYTHONDONTWRITEBYTECODE: 1 | |
# PYTHONDEVMODE leads to crashes in pylibmc. | |
# See https://github.com/lericson/pylibmc/issues/254 | |
# - PYTHONDEVMODE=1 | |
PYTHONFAULTHANDLER: 1 | |
PIP_UPGRADE_STRATEGY: eager | |
# Don't get warnings about Python 2 support being deprecated. We | |
# know. The env var works for pip 20. | |
PIP_NO_PYTHON_VERSION_WARNING: 1 | |
PIP_NO_WARN_SCRIPT_LOCATION: 1 | |
# Disable some warnings produced by libev especially and also some Cython generated code. | |
# These are shared between GCC and clang so it must be a minimal set. | |
# TODO: Figure out how to set env vars per platform without resorting to inline scripting. | |
CFLAGS: -O3 -pipe | |
CXXFLAGS: -O3 -pipe | |
# Uploading built wheels for releases. | |
# TWINE_PASSWORD is encrypted and stored directly in the | |
# travis repo settings. | |
TWINE_USERNAME: __token__ | |
### | |
# caching | |
# This is where we'd set up ccache, but this compiles so fast its not worth it. | |
### | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: [pypy-3.10, 3.7, 3.8, 3.9, '3.10', '3.11', "3.12", "3.13.0-beta.1"] | |
os: [ubuntu-latest, macos-latest] | |
exclude: | |
- os: macos-latest | |
python-version: pypy-3.10 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: setup.py | |
- name: Install Build Dependencies | |
run: | | |
pip install -U pip | |
pip install -U setuptools wheel twine | |
pip install -U 'cython>=3.0b3' | |
pip install -U coverage | |
- name: Install perfmetrics (non-Mac) | |
if: ${{ ! startsWith(runner.os, 'Mac') }} | |
run: | | |
python setup.py bdist_wheel | |
python -m pip install -U -e ".[test,docs]" | |
env: | |
# Ensure we test with assertions enabled. | |
# As opposed to the manylinux builds, which we distribute and | |
# thus only use O3 (because Ofast enables fast-math, which has | |
# process-wide effects), we test with Ofast here, because we | |
# expect that some people will compile it themselves with that setting. | |
CPPFLAGS: "-Ofast -UNDEBUG" | |
- name: Install perfmetrics (Mac) | |
if: startsWith(runner.os, 'Mac') | |
run: | | |
python setup.py bdist_wheel | |
python -m pip install -U -e ".[test,docs]" | |
env: | |
# Unlike the above, we are actually distributing these | |
# wheels, so they need to be built for production use. | |
CPPFLAGS: "-O3" | |
# Build for both architectures | |
ARCHFLAGS: "-arch x86_64 -arch arm64" | |
- name: Check perfmetrics build | |
run: | | |
ls -l dist | |
twine check dist/* | |
- name: Upload perfmetrics wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: perfmetrics-${{ runner.os }}-${{ matrix.python-version }}.whl | |
path: dist/*whl | |
- name: Run tests and report coverage | |
run: | | |
coverage run -p -m zope.testrunner --path=src --package perfmetrics -v --color | |
PURE_PYTHON=1 coverage run -p -m zope.testrunner --path=src --package perfmetrics -v --color | |
coverage combine | |
coverage report -i | |
- name: Publish package to PyPI (mac) | |
# We cannot 'uses: pypa/[email protected]' because | |
# that's apparently a container action, and those don't run on | |
# the Mac. | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && startsWith(runner.os, 'Mac') | |
env: | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
run: | | |
twine upload --skip-existing dist/* | |
- name: lint | |
if: matrix.python-version == '3.11' && startsWith(runner.os, 'Linux') | |
# At this writing, PyLint 2.17/astroid 2.15 won't work on 3.12 | |
run: | | |
pip install -U pylint | |
python -m pylint --limit-inference-results=1 --rcfile=.pylintrc perfmetrics -f parseable -r n | |
manylinux: | |
runs-on: ubuntu-latest | |
# We use a regular Python matrix entry to share as much code as possible. | |
strategy: | |
matrix: | |
python-version: [3.11] | |
image: | |
- manylinux2010_x86_64 | |
- manylinux2014_aarch64 | |
- manylinux2014_ppc64le | |
- manylinux2014_s390x | |
- manylinux2014_x86_64 | |
- musllinux_1_1_x86_64 | |
- musllinux_1_1_aarch64 | |
name: ${{ matrix.image }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Build and test perfmetrics | |
env: | |
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }} | |
run: bash ./scripts/releases/make-manylinux | |
- name: Store perfmetrics wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
path: wheelhouse/*whl | |
name: ${{ matrix.image }}_wheels.zip | |
- name: Publish package to PyPI | |
uses: pypa/[email protected] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
with: | |
user: __token__ | |
password: ${{ secrets.TWINE_PASSWORD }} | |
skip_existing: true | |
packages_dir: wheelhouse/ |