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