|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + Linting: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v2 |
| 11 | + - name: Set up Python 3.8 |
| 12 | + uses: actions/setup-python@v1 |
| 13 | + with: |
| 14 | + python-version: 3.8 |
| 15 | + - name: Linting |
| 16 | + run: | |
| 17 | + pip install pre-commit |
| 18 | + pre-commit run --all-files |
| 19 | + Linux: |
| 20 | + needs: Linting |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + - name: Set up Python ${{ matrix.python-version }} |
| 29 | + uses: actions/setup-python@v1 |
| 30 | + with: |
| 31 | + python-version: ${{ matrix.python-version }} |
| 32 | + - name: Get full python version |
| 33 | + id: full-python-version |
| 34 | + run: | |
| 35 | + echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") |
| 36 | + - name: Install and set up Poetry |
| 37 | + run: | |
| 38 | + curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py |
| 39 | + python get-poetry.py --preview -y |
| 40 | + source $HOME/.poetry/env |
| 41 | + poetry config virtualenvs.in-project true |
| 42 | + - name: Set up cache |
| 43 | + uses: actions/cache@v1 |
| 44 | + with: |
| 45 | + path: .venv |
| 46 | + key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
| 47 | + - name: Install dependencies |
| 48 | + run: | |
| 49 | + source $HOME/.poetry/env |
| 50 | + poetry install |
| 51 | + - name: Test |
| 52 | + run: | |
| 53 | + source $HOME/.poetry/env |
| 54 | + poetry run pytest -q tests |
| 55 | + poetry install |
| 56 | +
|
| 57 | + MacOS: |
| 58 | + needs: Linting |
| 59 | + runs-on: macos-latest |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] |
| 63 | + |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + - name: Set up Python ${{ matrix.python-version }} |
| 67 | + uses: actions/setup-python@v1 |
| 68 | + with: |
| 69 | + python-version: ${{ matrix.python-version }} |
| 70 | + - name: Get full python version |
| 71 | + id: full-python-version |
| 72 | + run: | |
| 73 | + echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") |
| 74 | + - name: Install and set up Poetry |
| 75 | + run: | |
| 76 | + curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py |
| 77 | + python get-poetry.py --preview -y |
| 78 | + source $HOME/.poetry/env |
| 79 | + poetry config virtualenvs.in-project true |
| 80 | + - name: Set up cache |
| 81 | + uses: actions/cache@v1 |
| 82 | + with: |
| 83 | + path: .venv |
| 84 | + key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
| 85 | + - name: Install dependencies |
| 86 | + run: | |
| 87 | + source $HOME/.poetry/env |
| 88 | + poetry install |
| 89 | + - name: Test |
| 90 | + run: | |
| 91 | + source $HOME/.poetry/env |
| 92 | + poetry run pytest -q tests |
| 93 | + Windows: |
| 94 | + needs: Linting |
| 95 | + runs-on: windows-latest |
| 96 | + strategy: |
| 97 | + matrix: |
| 98 | + python-version: [2.7, 3.5, 3.6, 3.7, 3.8] |
| 99 | + |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v2 |
| 102 | + - name: Set up Python ${{ matrix.python-version }} |
| 103 | + uses: actions/setup-python@v1 |
| 104 | + with: |
| 105 | + python-version: ${{ matrix.python-version }} |
| 106 | + - name: Get full python version |
| 107 | + id: full-python-version |
| 108 | + shell: bash |
| 109 | + run: | |
| 110 | + echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") |
| 111 | + - name: Install and setup Poetry |
| 112 | + run: | |
| 113 | + Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py |
| 114 | + python get-poetry.py --preview -y |
| 115 | + $env:Path += ";$env:Userprofile\.poetry\bin" |
| 116 | + poetry config virtualenvs.in-project true |
| 117 | + - name: Set up cache |
| 118 | + uses: actions/cache@v1 |
| 119 | + with: |
| 120 | + path: .venv |
| 121 | + key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
| 122 | + - name: Install dependencies |
| 123 | + run: | |
| 124 | + $env:Path += ";$env:Userprofile\.poetry\bin" |
| 125 | + poetry install |
| 126 | + - name: Test |
| 127 | + run: | |
| 128 | + $env:Path += ";$env:Userprofile\.poetry\bin" |
| 129 | + poetry run pytest -q tests |
0 commit comments