name: tests on: [push, pull_request] env: PYTHONHASHSEED: 1042466059 ZOPE_INTERFACE_STRICT_IRO: 1 PYTHONUNBUFFERED: 1 PYTHONDONTWRITEBYTECODE: 1 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 # Uploading built wheels for releases. # TWINE_PASSWORD is encrypted and stored directly in the # repo settings. TWINE_USERNAME: __token__ jobs: test: runs-on: ${{ matrix.os }} strategy: matrix: python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10"] os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Pip cache uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('setup.*') }} restore-keys: | ${{ runner.os }}-pip- - name: Install dependencies run: | python -m pip install -U pip setuptools wheel python -m pip install -U twine python -m pip install -q -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"' - name: Install greenlet 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: Check greenlet build run: | ls -l dist twine check dist/* - name: Store greenlet wheel uses: actions/upload-artifact@v2 with: name: greenlet-${{ runner.os }}-${{ matrix.python-version }}.whl path: dist/*whl - name: Test run: | python -c 'import faulthandler; assert faulthandler.is_enabled()' python -c 'import greenlet._greenlet as G; assert G.GREENLET_USE_STANDARD_THREADING' python -m unittest discover -v greenlet.tests - name: Doctest run: | sphinx-build -b doctest -d docs/_build/doctrees2 docs docs/_build/doctest2 - name: Publish package to PyPI (mac) # We cannot 'uses: pypa/gh-action-pypi-publish@v1.4.1' 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/* test_non_standard_thread: runs-on: ${{ matrix.os }} strategy: matrix: python-version: [2.7, 3.5, "3.10"] os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Pip cache uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-ns-${{ hashFiles('setup.*') }} restore-keys: | ${{ runner.os }}-pip-ns- - name: Install dependencies run: | python -m pip install -U pip setuptools wheel python -m pip install -U twine python -m pip install -q -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"' - name: Install greenlet env: CPPFLAGS: "-DG_USE_STANDARD_THREADING=0 -UNDEBUG -Ofast" run: | python setup.py bdist_wheel python -m pip install -U -v -e ".[test,docs]" - name: Test run: | python -c 'import faulthandler; assert faulthandler.is_enabled()' python -c 'import greenlet._greenlet as G; assert not G.GREENLET_USE_STANDARD_THREADING' python -m unittest discover -v greenlet.tests CodeQL: runs-on: ubuntu-latest permissions: # required for all workflows security-events: write steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: "3.10" - name: Pip cache uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-ql-${{ hashFiles('setup.*') }} restore-keys: | ${{ runner.os }}-pip-ql- - name: Install dependencies run: | python -m pip install -U pip python -m pip install -U setuptools wheel # Set the `CODEQL-PYTHON` environment variable to the Python executable # that includes the dependencies echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: languages: python, cpp # Override the default behavior so that the action doesn't attempt # to auto-install Python dependencies setup-python-dependencies: false - name: Install greenlet run: | python setup.py build # - name: Autobuild # uses: github/codeql-action/autobuild@v1 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 manylinux: runs-on: ubuntu-latest # We use a regular Python matrix entry to share as much code as possible. strategy: matrix: python-version: [3.9] image: - manylinux2010_x86_64 - manylinux2014_aarch64 - manylinux2014_ppc64le - manylinux2014_x86_64 - musllinux_1_1_x86_64 name: ${{ matrix.image }} steps: - name: checkout uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Enable emulation run: | docker run --rm --privileged hypriot/qemu-register # This one was seen in pyca/bcrypt. What's the difference? # (Other than this one not working.) #run: | # docker run --rm --privileged multiarch/qemu-user-static:register --reset - name: Build and test greenlet if: matrix.image == 'manylinux2010_x86_64' # An alternate way to do this is to run the container directly with a uses: # and then the script runs inside it. That may work better with caching. # See https://github.com/pyca/bcrypt/blob/f6b5ee2eda76d077c531362ac65e16f045cf1f29/.github/workflows/wheel-builder.yml # The 2010 image is the last one that comes with Python 2.7, # and only up through the tag 2021-02-06-3d322a5 env: DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}:2021-02-06-3d322a5 run: bash ./make-manylinux - name: Build and test greenlet (other) if: matrix.image != 'manylinux2010_x86_64' env: DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }} run: bash ./make-manylinux - name: Store greenlet wheels uses: actions/upload-artifact@v2 with: path: wheelhouse/*whl name: ${{ matrix.image }}_wheels.zip - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.4.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') with: user: __token__ password: ${{ secrets.TWINE_PASSWORD }} skip_existing: true packages_dir: wheelhouse/