|
| 1 | +name: CI - Lint / Tests / Deploy |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + |
| 7 | + lint: |
| 8 | + runs-on: ubuntu-20.04 |
| 9 | + |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + |
| 13 | + - name: Set up Python 3.9 |
| 14 | + uses: actions/setup-python@v2 |
| 15 | + with: |
| 16 | + python-version: 3.9 |
| 17 | + |
| 18 | + - name: Install dependencies |
| 19 | + run: | |
| 20 | + python -m pip install --upgrade pip |
| 21 | + pip install flake8 |
| 22 | +
|
| 23 | + - name: Lint with flake8 |
| 24 | + run: | |
| 25 | + # stop the build if there are Python syntax errors or undefined names |
| 26 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 27 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 28 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 29 | +
|
| 30 | + tests: |
| 31 | + needs: lint |
| 32 | + runs-on: ubuntu-20.04 |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + |
| 40 | + - name: Set up Python ${{ matrix.python-version }} |
| 41 | + uses: actions/setup-python@v2 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + run: | |
| 47 | + python -m pip install --upgrade pip |
| 48 | + pip install flake8 pytest |
| 49 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 50 | +
|
| 51 | + - name: Integrations Test |
| 52 | + run: | |
| 53 | + python test.py |
| 54 | +
|
| 55 | +
|
| 56 | + deploy: |
| 57 | + needs: tests |
| 58 | + runs-on: ubuntu-20.04 |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v2 |
| 62 | + |
| 63 | + - name: Set up Python 3.9 |
| 64 | + uses: actions/setup-python@v2 |
| 65 | + with: |
| 66 | + python-version: 3.9 |
| 67 | + |
| 68 | + - name: deploy into heroku |
| 69 | + uses: akhileshns/[email protected] |
| 70 | + with: |
| 71 | + heroku_api_key: ${{secrets.HEROKO_API_KEY}} |
| 72 | + heroku_app_name: ${{secrets.HEROKO_APP_NAME}} |
| 73 | + heroku_email: ${{secrets.HEROKU_EMAIL}} |
0 commit comments