|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: master |
| 6 | + pull_request: |
| 7 | + branches: master |
| 8 | + schedule: |
| 9 | + # * is a special character in YAML so you have to quote this string |
| 10 | + - cron: '0 3 * * 6' |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + reason: |
| 14 | + description: 'Reason' |
| 15 | + required: false |
| 16 | + default: 'Manual trigger' |
| 17 | + |
| 18 | +jobs: |
| 19 | + Tests: |
| 20 | + runs-on: ubuntu-20.04 |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + python-version: [3.6, 3.7, 3.8, 3.9] |
| 24 | + requirements-level: [min, pypi] |
| 25 | + cache-service: [redis] |
| 26 | + db-service: [postgresql9, postgresql11, mysql5, mysql8] |
| 27 | + mq-service: [rabbitmq, redis] |
| 28 | + search-service: [elasticsearch6, elasticsearch7] |
| 29 | + |
| 30 | + exclude: |
| 31 | + # Add combinations to this list that should be excluded from the final |
| 32 | + # build. Doing this will help keeping the number of jobs down. |
| 33 | + # E.g. removing 3.8 - min combination will avoid 8 jobs to be submited |
| 34 | + # [3.8] * [min] * [postgresql9, postgresql11, mysql5, mysql8] * [elasticsearch6, elasticsearch7] |
| 35 | + - python-version: 3.7 |
| 36 | + requirements-level: min |
| 37 | + |
| 38 | + - python-version: 3.8 |
| 39 | + requirements-level: min |
| 40 | + |
| 41 | + - python-version: 3.9 |
| 42 | + requirements-level: min |
| 43 | + |
| 44 | + - db-service: postgresql11 |
| 45 | + python-version: 3.6 |
| 46 | + |
| 47 | + - db-service: mysql8 |
| 48 | + python-version: 3.6 |
| 49 | + |
| 50 | + - search-service: elasticsearch7 |
| 51 | + python-version: 3.6 |
| 52 | + |
| 53 | + - search-service: elasticsearch6 |
| 54 | + db-service: postgresql11 |
| 55 | + |
| 56 | + - search-service: elasticsearch6 |
| 57 | + db-service: mysql8 |
| 58 | + |
| 59 | + - search-service: elasticsearch7 |
| 60 | + db-service: postgresql9 |
| 61 | + |
| 62 | + - search-service: elasticsearch7 |
| 63 | + db-service: mysql5 |
| 64 | + |
| 65 | + include: |
| 66 | + - db-service: postgresql9 |
| 67 | + DB_EXTRAS: "postgresql" |
| 68 | + |
| 69 | + - db-service: postgresql11 |
| 70 | + DB_EXTRAS: "postgresql" |
| 71 | + |
| 72 | + - db-service: mysql5 |
| 73 | + DB_EXTRAS: "mysql" |
| 74 | + |
| 75 | + - db-service: mysql8 |
| 76 | + DB_EXTRAS: "mysql" |
| 77 | + |
| 78 | + - search-service: elasticsearch6 |
| 79 | + SEARCH_EXTRAS: "elasticsearch6" |
| 80 | + |
| 81 | + - search-service: elasticsearch7 |
| 82 | + SEARCH_EXTRAS: "elasticsearch7" |
| 83 | + |
| 84 | + env: |
| 85 | + CACHE: ${{ matrix.cache-service }} |
| 86 | + DB: ${{ matrix.db-service }} |
| 87 | + MQ: ${{ matrix.mq-service }} |
| 88 | + SEARCH: ${{ matrix.search-service }} |
| 89 | + EXTRAS: all,${{ matrix.DB_EXTRAS }},${{matrix.SEARCH_EXTRAS}} |
| 90 | + |
| 91 | + steps: |
| 92 | + - name: Checkout |
| 93 | + uses: actions/checkout@v2 |
| 94 | + |
| 95 | + - name: Set up Python ${{ matrix.python-version }} |
| 96 | + uses: actions/setup-python@v2 |
| 97 | + with: |
| 98 | + python-version: ${{ matrix.python-version }} |
| 99 | + |
| 100 | + - name: Generate dependencies |
| 101 | + run: | |
| 102 | + python -m pip install --upgrade pip setuptools py wheel requirements-builder |
| 103 | + requirements-builder -e "$EXTRAS" --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt |
| 104 | +
|
| 105 | + - name: Cache pip |
| 106 | + uses: actions/cache@v2 |
| 107 | + with: |
| 108 | + path: ~/.cache/pip |
| 109 | + key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }} |
| 110 | + |
| 111 | + - name: Install dependencies |
| 112 | + run: | |
| 113 | + pip install -r .${{matrix.requirements-level}}-${{ matrix.python-version }}-requirements.txt |
| 114 | + pip install ".[$EXTRAS]" |
| 115 | + pip freeze |
| 116 | + docker --version |
| 117 | + docker-compose --version |
| 118 | +
|
| 119 | + - name: Run tests |
| 120 | + run: | |
| 121 | + ./run-tests.sh |
0 commit comments