From 21a8fb025c4a190239700190b6ce714ac37345d8 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 6 Jan 2021 10:01:37 +0400 Subject: [PATCH 1/3] Switch to GitHub Actions --- .appveyor.yml | 30 -------------- .github/workflows/ci.yml | 89 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 33 --------------- ci.sh | 81 ++++++++++++++++++++++++++++++++++++ ci/travis.sh | 63 ---------------------------- 5 files changed, 170 insertions(+), 126 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml create mode 100755 ci.sh delete mode 100755 ci/travis.sh diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 29dd725..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,30 +0,0 @@ -skip_tags: true - -os: Visual Studio 2015 - -environment: - matrix: - - PYTHON: "C:\\Python36" - - PYTHON: "C:\\Python36-x64" - - PYTHON: "C:\\Python37" - - PYTHON: "C:\\Python37-x64" - - PYTHON: "C:\\Python38" - - PYTHON: "C:\\Python38-x64" - -build_script: - - "git --no-pager log -n2" - - "echo %APPVEYOR_REPO_COMMIT%" - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;;%PATH%" - - "python --version" - - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - - "pip install ." - - "pip install -Ur test-requirements.txt" - - "pip install codecov" - -test_script: - - "mkdir empty" - - "cd empty" - # Make sure it's being imported from where we expect - - "python -c \"import os, pytest_trio; print(os.path.dirname(pytest_trio.__file__))\"" - - "python -u -m coverage run --rcfile=../.coveragerc -m pytest -W error -ra -v -s --pyargs pytest_trio" - - "codecov" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..45b317d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,89 @@ +name: CI + +on: + push: + branches-ignore: + - "dependabot/**" + pull_request: + +jobs: + Windows: + name: 'Windows (${{ matrix.python }})' + runs-on: 'windows-latest' + strategy: + fail-fast: false + matrix: + python: ['3.6', '3.7', '3.8', '3.9'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: '${{ matrix.python }}' + - name: Run tests + run: ./ci.sh + shell: bash + env: + # Should match 'name:' up above + JOB_NAME: 'Windows (${{ matrix.python }})' + + Ubuntu: + name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})' + timeout-minutes: 10 + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: + python: ['pypy-3.6', 'pypy-3.7', '3.6', '3.7', '3.8', '3.9', '3.6-dev', '3.7-dev', '3.8-dev', '3.9-dev'] + check_formatting: ['0'] + check_docs: ['0'] + extra_name: [''] + include: + - python: '3.9' + check_formatting: '1' + extra_name: ', check formatting' + - python: '3.9' + check_docs: '1' + extra_name: ', check docs' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v2 + if: "!endsWith(matrix.python, '-dev')" + with: + python-version: '${{ matrix.python }}' + - name: Setup python (dev) + uses: deadsnakes/action@v2.0.2 + if: endsWith(matrix.python, '-dev') + with: + python-version: '${{ matrix.python }}' + - name: Run tests + run: ./ci.sh + env: + CHECK_FORMATTING: '${{ matrix.check_formatting }}' + CHECK_DOCS: '${{ matrix.check_docs }}' + # Should match 'name:' up above + JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})' + + macOS: + name: 'macOS (${{ matrix.python }})' + timeout-minutes: 10 + runs-on: 'macos-latest' + strategy: + fail-fast: false + matrix: + python: ['3.6', '3.7', '3.8', '3.9'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: '${{ matrix.python }}' + - name: Run tests + run: ./ci.sh + env: + # Should match 'name:' up above + JOB_NAME: 'macOS (${{ matrix.python }})' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a52c6ce..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -os: linux -dist: bionic -language: python -python: -- pypy3.6-7.2.0 -- 3.6 -- 3.6-dev -- 3.7 -- 3.7-dev -- 3.8 -- 3.8-dev -- 3.9-dev -jobs: - include: - - os: osx - language: generic - env: MACPYTHON=3.6.8 - - os: osx - language: generic - env: MACPYTHON=3.7.7 - - os: osx - language: generic - env: MACPYTHON=3.8.1 - - os: linux - language: python - python: 3.6 - env: CHECK_DOCS=1 - - os: linux - language: python - python: 3.6 - env: CHECK_FORMATTING=1 -script: -- ci/travis.sh diff --git a/ci.sh b/ci.sh new file mode 100755 index 0000000..ddcd21f --- /dev/null +++ b/ci.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -ex -o pipefail + +# Log some general info about the environment +uname -a +env | sort + +# See https://github.com/python-trio/trio/issues/334 +YAPF_VERSION=0.22.0 + +# Curl's built-in retry system is not very robust; it gives up on lots of +# network errors that we want to retry on. Wget might work better, but it's +# not installed on azure pipelines's windows boxes. So... let's try some good +# old-fashioned brute force. (This is also a convenient place to put options +# we always want, like -f to tell curl to give an error if the server sends an +# error response, and -L to follow redirects.) +function curl-harder() { + for BACKOFF in 0 1 2 4 8 15 15 15 15; do + sleep $BACKOFF + if curl -fL --connect-timeout 5 "$@"; then + return 0 + fi + done + return 1 +} + + +python -m pip install -U pip setuptools wheel +python -m pip --version + +python setup.py sdist --formats=zip +python -m pip install dist/*.zip + +if [ "$CHECK_FORMATTING" = "1" ]; then + pip install yapf==${YAPF_VERSION} + if ! yapf -rpd setup.py pytest_trio; then + cat < Date: Wed, 6 Jan 2021 10:06:43 +0400 Subject: [PATCH 2/3] Pin requirements We don't support pytest 6.2 yet, and want to switch to dependabot in the future. --- test-requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 5c53c25..c8280fc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,3 @@ -pytest >= 6.0.0 # https://github.com/python-trio/pytest-trio/pull/98#issuecomment-678699693 -pytest-cov -hypothesis>=3.64 +pytest==6.1.2 +pytest-cov==2.10.1 +hypothesis==5.47.0 From 78c5362223cce91e6b6ab7a2442fcbbfd39ea67d Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 6 Jan 2021 10:21:25 +0400 Subject: [PATCH 3/3] Stop testing pypy3.7 which isn't supported by Trio yet `warn_on_full_buffer` support was added in PyPy, but it did not get released yet. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45b317d..bf6e8a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['pypy-3.6', 'pypy-3.7', '3.6', '3.7', '3.8', '3.9', '3.6-dev', '3.7-dev', '3.8-dev', '3.9-dev'] + python: ['pypy-3.6', '3.6', '3.7', '3.8', '3.9', '3.6-dev', '3.7-dev', '3.8-dev', '3.9-dev'] check_formatting: ['0'] check_docs: ['0'] extra_name: ['']