|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + mysql: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + max-parallel: 5 |
| 11 | + matrix: |
| 12 | + python-version: ['3.6', '3.7', '3.8', '3.9'] |
| 13 | + |
| 14 | + services: |
| 15 | + mariadb: |
| 16 | + image: mariadb:10.3 |
| 17 | + env: |
| 18 | + MYSQL_ROOT_PASSWORD: mysql |
| 19 | + MYSQL_DATABASE: mysql |
| 20 | + options: >- |
| 21 | + --health-cmd "mysqladmin ping" |
| 22 | + --health-interval 10s |
| 23 | + --health-timeout 5s |
| 24 | + --health-retries 5 |
| 25 | + ports: |
| 26 | + - 3306:3306 |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: Set up Python ${{ matrix.python-version }} |
| 32 | + uses: actions/setup-python@v2 |
| 33 | + with: |
| 34 | + python-version: ${{ matrix.python-version }} |
| 35 | + |
| 36 | + - name: Get pip cache dir |
| 37 | + id: pip-cache |
| 38 | + run: | |
| 39 | + echo "::set-output name=dir::$(pip cache dir)" |
| 40 | +
|
| 41 | + - name: Cache |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + path: ${{ steps.pip-cache.outputs.dir }} |
| 45 | + key: |
| 46 | + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ matrix.python-version }}-v1- |
| 49 | +
|
| 50 | + - name: Install enchant (only for docs) |
| 51 | + run: | |
| 52 | + sudo apt-get -qq update |
| 53 | + sudo apt-get -y install enchant |
| 54 | +
|
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + python -m pip install --upgrade pip |
| 58 | + python -m pip install --upgrade tox tox-gh-actions |
| 59 | +
|
| 60 | + - name: Test with tox |
| 61 | + run: tox |
| 62 | + env: |
| 63 | + DB_BACKEND: mysql |
| 64 | + DB_NAME: mysql |
| 65 | + DB_USER: root |
| 66 | + DB_PASSWORD: mysql |
| 67 | + DB_HOST: "127.0.0.1" |
| 68 | + DB_PORT: "3306" |
| 69 | + |
| 70 | + - name: Upload coverage |
| 71 | + uses: codecov/codecov-action@v1 |
| 72 | + with: |
| 73 | + name: Python ${{ matrix.python-version }} |
| 74 | + |
| 75 | + postgres: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + max-parallel: 5 |
| 80 | + matrix: |
| 81 | + python-version: ['3.6', '3.7', '3.8', '3.9'] |
| 82 | + |
| 83 | + services: |
| 84 | + postgres: |
| 85 | + image: 'postgres:9.5' |
| 86 | + env: |
| 87 | + POSTGRES_PASSWORD: postgres |
| 88 | + ports: |
| 89 | + - 5432:5432 |
| 90 | + options: >- |
| 91 | + --health-cmd pg_isready |
| 92 | + --health-interval 10s |
| 93 | + --health-timeout 5s |
| 94 | + --health-retries 5 |
| 95 | +
|
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v2 |
| 98 | + |
| 99 | + - name: Set up Python ${{ matrix.python-version }} |
| 100 | + uses: actions/setup-python@v2 |
| 101 | + with: |
| 102 | + python-version: ${{ matrix.python-version }} |
| 103 | + |
| 104 | + - name: Get pip cache dir |
| 105 | + id: pip-cache |
| 106 | + run: | |
| 107 | + echo "::set-output name=dir::$(pip cache dir)" |
| 108 | +
|
| 109 | + - name: Cache |
| 110 | + uses: actions/cache@v2 |
| 111 | + with: |
| 112 | + path: ${{ steps.pip-cache.outputs.dir }} |
| 113 | + key: |
| 114 | + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }} |
| 115 | + restore-keys: | |
| 116 | + ${{ matrix.python-version }}-v1- |
| 117 | +
|
| 118 | + - name: Install enchant (only for docs) |
| 119 | + run: | |
| 120 | + sudo apt-get -qq update |
| 121 | + sudo apt-get -y install enchant |
| 122 | +
|
| 123 | + - name: Install dependencies |
| 124 | + run: | |
| 125 | + python -m pip install --upgrade pip |
| 126 | + python -m pip install --upgrade tox tox-gh-actions |
| 127 | +
|
| 128 | + - name: Test with tox |
| 129 | + run: tox |
| 130 | + env: |
| 131 | + DB_BACKEND: postgresql |
| 132 | + DB_NAME: postgres |
| 133 | + DB_USER: postgres |
| 134 | + DB_PASSWORD: postgres |
| 135 | + DB_HOST: localhost |
| 136 | + DB_PORT: 5432 |
| 137 | + |
| 138 | + - name: Upload coverage |
| 139 | + uses: codecov/codecov-action@v1 |
| 140 | + with: |
| 141 | + name: Python ${{ matrix.python-version }} |
| 142 | + |
| 143 | + sqlite: |
| 144 | + runs-on: ubuntu-latest |
| 145 | + strategy: |
| 146 | + fail-fast: false |
| 147 | + max-parallel: 5 |
| 148 | + matrix: |
| 149 | + python-version: ['3.6', '3.7', '3.8', '3.9'] |
| 150 | + |
| 151 | + steps: |
| 152 | + - uses: actions/checkout@v2 |
| 153 | + |
| 154 | + - name: Set up Python ${{ matrix.python-version }} |
| 155 | + uses: actions/setup-python@v2 |
| 156 | + with: |
| 157 | + python-version: ${{ matrix.python-version }} |
| 158 | + |
| 159 | + - name: Get pip cache dir |
| 160 | + id: pip-cache |
| 161 | + run: | |
| 162 | + echo "::set-output name=dir::$(pip cache dir)" |
| 163 | +
|
| 164 | + - name: Cache |
| 165 | + uses: actions/cache@v2 |
| 166 | + with: |
| 167 | + path: ${{ steps.pip-cache.outputs.dir }} |
| 168 | + key: |
| 169 | + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }} |
| 170 | + restore-keys: | |
| 171 | + ${{ matrix.python-version }}-v1- |
| 172 | +
|
| 173 | + - name: Install dependencies |
| 174 | + run: | |
| 175 | + python -m pip install --upgrade pip |
| 176 | + python -m pip install --upgrade tox tox-gh-actions |
| 177 | +
|
| 178 | + - name: Test with tox |
| 179 | + run: tox |
| 180 | + env: |
| 181 | + DB_BACKEND: sqlite3 |
| 182 | + DB_NAME: ":memory:" |
| 183 | + |
| 184 | + - name: Upload coverage |
| 185 | + uses: codecov/codecov-action@v1 |
| 186 | + with: |
| 187 | + name: Python ${{ matrix.python-version }} |
| 188 | + |
| 189 | + lint: |
| 190 | + runs-on: ubuntu-latest |
| 191 | + strategy: |
| 192 | + fail-fast: false |
| 193 | + |
| 194 | + steps: |
| 195 | + - uses: actions/checkout@v2 |
| 196 | + |
| 197 | + - name: Set up Python ${{ matrix.python-version }} |
| 198 | + uses: actions/setup-python@v2 |
| 199 | + with: |
| 200 | + python-version: 3.8 |
| 201 | + |
| 202 | + - name: Get pip cache dir |
| 203 | + id: pip-cache |
| 204 | + run: | |
| 205 | + echo "::set-output name=dir::$(pip cache dir)" |
| 206 | +
|
| 207 | + - name: Cache |
| 208 | + uses: actions/cache@v2 |
| 209 | + with: |
| 210 | + path: ${{ steps.pip-cache.outputs.dir }} |
| 211 | + key: |
| 212 | + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }} |
| 213 | + restore-keys: | |
| 214 | + ${{ matrix.python-version }}-v1- |
| 215 | +
|
| 216 | + - name: Install dependencies |
| 217 | + run: | |
| 218 | + python -m pip install --upgrade pip |
| 219 | + python -m pip install --upgrade tox |
| 220 | +
|
| 221 | + - name: Test with tox |
| 222 | + run: tox -e docs,style,readme |
0 commit comments