|
| 1 | +name: "Lint / Unit tests / Cover / Mypy" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + run-lint-mypy: |
| 12 | + name: lint-mypy |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Setup Python |
| 21 | + uses: actions/setup-python@v2 |
| 22 | + with: |
| 23 | + python-version: "3.10" |
| 24 | + |
| 25 | + - name: Install nox |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade setuptools pip wheel |
| 28 | + python -m pip install nox |
| 29 | +
|
| 30 | + - name: Run lint |
| 31 | + run: | |
| 32 | + nox -s lint |
| 33 | +
|
| 34 | + - name: Run lint_setup_py |
| 35 | + run: | |
| 36 | + nox -s lint_setup_py |
| 37 | +
|
| 38 | + - name: Run mypy |
| 39 | + run: | |
| 40 | + nox -s mypy |
| 41 | +
|
| 42 | + run-unittests: |
| 43 | + name: unit${{ matrix.option }}-${{ matrix.python }} |
| 44 | + runs-on: ubuntu-latest |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + option: ["", "_grpc_gcp", "_wo_grpc"] |
| 48 | + python: |
| 49 | + - "3.6" |
| 50 | + - "3.7" |
| 51 | + - "3.8" |
| 52 | + - "3.9" |
| 53 | + - "3.10" |
| 54 | + exclude: |
| 55 | + - option: "_wo_grpc" |
| 56 | + python: 3.7 |
| 57 | + - option: "_wo_grpc" |
| 58 | + python: 3.8 |
| 59 | + - option: "_wo_grpc" |
| 60 | + python: 3.9 |
| 61 | + |
| 62 | + steps: |
| 63 | + |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v2 |
| 66 | + |
| 67 | + - name: Setup Python |
| 68 | + uses: actions/setup-python@v2 |
| 69 | + with: |
| 70 | + python-version: ${{ matrix.python }} |
| 71 | + |
| 72 | + - name: Install nox |
| 73 | + run: | |
| 74 | + python -m pip install --upgrade setuptools pip wheel |
| 75 | + python -m pip install nox |
| 76 | +
|
| 77 | + - name: Run unit tests |
| 78 | + env: |
| 79 | + COVERAGE_FILE: .coverage${{ matrix.option }}-${{matrix.python }} |
| 80 | + run: | |
| 81 | + nox -s unit${{ matrix.option }}-${{ matrix.python }} |
| 82 | +
|
| 83 | + - name: Upload coverage results |
| 84 | + uses: actions/upload-artifact@v2 |
| 85 | + with: |
| 86 | + name: coverage-artifacts |
| 87 | + path: .coverage${{ matrix.option }}-${{ matrix.python }} |
| 88 | + |
| 89 | + report-coverage: |
| 90 | + name: cover |
| 91 | + runs-on: ubuntu-latest |
| 92 | + needs: |
| 93 | + - run-unittests |
| 94 | + |
| 95 | + steps: |
| 96 | + |
| 97 | + - name: Checkout |
| 98 | + uses: actions/checkout@v2 |
| 99 | + |
| 100 | + - name: Setup Python |
| 101 | + uses: actions/setup-python@v2 |
| 102 | + with: |
| 103 | + python-version: "3.10" |
| 104 | + |
| 105 | + - name: Install coverage |
| 106 | + run: | |
| 107 | + python -m pip install --upgrade setuptools pip wheel |
| 108 | + python -m pip install coverage |
| 109 | +
|
| 110 | + - name: Download coverage results |
| 111 | + uses: actions/download-artifact@v2 |
| 112 | + with: |
| 113 | + name: coverage-artifacts |
| 114 | + path: .coverage-results/ |
| 115 | + |
| 116 | + - name: Report coverage results |
| 117 | + run: | |
| 118 | + coverage combine .coverage-results/.coverage* |
| 119 | + coverage report --show-missing --fail-under=100 |
0 commit comments