|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + PIP_DISABLE_PIP_VERSION_CHECK: true |
| 12 | + PYTEST_ADDOPTS: "-vv" |
| 13 | + # Set TERM to some commonly used default |
| 14 | + # (not provided/setup by GitHub Actions by default). |
| 15 | + TERM: xterm-256color |
| 16 | + |
| 17 | +jobs: |
| 18 | + tests: |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + include: |
| 25 | + # Linux |
| 26 | + - tox_env: "py39-coverage" |
| 27 | + python: "3.9" |
| 28 | + os: ubuntu-20.04 |
| 29 | + - tox_env: "py38-coverage" |
| 30 | + python: "3.8" |
| 31 | + os: ubuntu-20.04 |
| 32 | + - tox_env: "py37-coverage" |
| 33 | + python: "3.7" |
| 34 | + os: ubuntu-20.04 |
| 35 | + - tox_env: "py36-coverage" |
| 36 | + python: "3.6" |
| 37 | + os: ubuntu-20.04 |
| 38 | + - tox_env: "py35-coverage" |
| 39 | + python: "3.5" |
| 40 | + os: ubuntu-20.04 |
| 41 | + |
| 42 | + - tox_env: "py27-coverage" |
| 43 | + python: "2.7" |
| 44 | + os: ubuntu-20.04 |
| 45 | + |
| 46 | + - tox_env: "pypy3-coverage" |
| 47 | + python: "pypy-3.7" |
| 48 | + os: ubuntu-20.04 |
| 49 | + - tox_env: "pypy-coverage" |
| 50 | + python: "pypy-2.7" |
| 51 | + os: ubuntu-20.04 |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + with: |
| 56 | + fetch-depth: 0 |
| 57 | + - name: Set up Python ${{ matrix.python }} |
| 58 | + uses: actions/setup-python@v2 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python }} |
| 61 | + |
| 62 | + # Caching. |
| 63 | + - name: set PY_CACHE_KEY |
| 64 | + run: echo "PY_CACHE_KEY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV |
| 65 | + - name: Cache .tox |
| 66 | + uses: actions/cache@v1 |
| 67 | + with: |
| 68 | + path: ${{ github.workspace }}/.tox/${{ matrix.tox_env }} |
| 69 | + key: "tox|${{ matrix.os }}|${{ matrix.tox_env }}|${{ env.PY_CACHE_KEY }}|${{ hashFiles('tox.ini', 'setup.*') }}" |
| 70 | + |
| 71 | + - name: (Initial) version information/pinning |
| 72 | + run: | |
| 73 | + set -x |
| 74 | + python -m site |
| 75 | + python -m pip --version |
| 76 | + python -m pip list |
| 77 | + if [[ "${{ matrix.python }}" == "3.4" ]]; then |
| 78 | + # Install latest available pip. |
| 79 | + # 7.1.2 (installed) is too old to not install too new packages, |
| 80 | + # including pip itself. 19.2 dropped support for Python 3.4. |
| 81 | + python -m pip install -U pip==19.1.1 |
| 82 | + fi |
| 83 | + python -m pip install -U setuptools==42.0.2 |
| 84 | + python -m pip install -U virtualenv==20.4.3 |
| 85 | +
|
| 86 | + - name: Install tox |
| 87 | + run: python -m pip install git+https://github.com/blueyed/tox@master |
| 88 | + |
| 89 | + - name: Version information |
| 90 | + run: python -m pip list |
| 91 | + |
| 92 | + - name: Setup tox environment |
| 93 | + id: setup-tox |
| 94 | + run: python -m tox --notest -v --durations -e ${{ matrix.tox_env }} |
| 95 | + |
| 96 | + - name: Test |
| 97 | + env: |
| 98 | + COLUMNS: "90" # better alignment (working around https://github.com/blueyed/pytest/issues/491). |
| 99 | + PY_COLORS: "1" |
| 100 | + # UTF-8 mode for Windows (https://docs.python.org/3/using/windows.html#utf-8-mode). |
| 101 | + PYTHONUTF8: "1" |
| 102 | + TOX_TESTENV_PASSENV: "PYTHONUTF8" |
| 103 | + run: python -m tox -v --durations -e ${{ matrix.tox_env }} |
| 104 | + |
| 105 | + - name: Report coverage |
| 106 | + if: always() && (steps.setup-tox.outcome == 'success' && contains(matrix.tox_env, '-coverage')) |
| 107 | + uses: codecov/codecov-action@v1 |
| 108 | + with: |
| 109 | + files: ./coverage.xml |
| 110 | + flags: ${{ runner.os }} |
| 111 | + name: ${{ matrix.tox_env }} |
| 112 | + fail_ci_if_error: true |
0 commit comments