|
| 1 | +name: Python CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + schedule: |
| 9 | + - cron: "0 0 * * *" |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +env: |
| 13 | + LATEST_SUPPORTED_PY: "3.14" |
| 14 | + |
| 15 | +jobs: |
| 16 | + lint: |
| 17 | + name: Lint |
| 18 | + runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 5 |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 24 | + with: |
| 25 | + persist-credentials: false |
| 26 | + - name: Set up Python ${{ env.LATEST_SUPPORTED_PY }} |
| 27 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 28 | + with: |
| 29 | + python-version: ${{ env.LATEST_SUPPORTED_PY }} |
| 30 | + - name: Run flake8 verification |
| 31 | + run: ./scripts/lint.sh |
| 32 | + |
| 33 | + typecheck: |
| 34 | + name: Typecheck |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 5 |
| 37 | + permissions: |
| 38 | + contents: read |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 41 | + with: |
| 42 | + persist-credentials: false |
| 43 | + - name: Set up Python ${{ env.LATEST_SUPPORTED_PY }} |
| 44 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 45 | + with: |
| 46 | + python-version: ${{ env.LATEST_SUPPORTED_PY }} |
| 47 | + - name: Run mypy verification |
| 48 | + run: ./scripts/run_mypy.sh |
| 49 | + |
| 50 | + unittest: |
| 51 | + name: Unit tests |
| 52 | + runs-on: ubuntu-24.04 |
| 53 | + timeout-minutes: 10 |
| 54 | + strategy: |
| 55 | + fail-fast: false |
| 56 | + matrix: |
| 57 | + python-version: |
| 58 | + - "3.9" |
| 59 | + - "3.10" |
| 60 | + - "3.11" |
| 61 | + - "3.12" |
| 62 | + - "3.13" |
| 63 | + - "3.14" |
| 64 | + - "pypy3.10" |
| 65 | + permissions: |
| 66 | + contents: read |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 69 | + with: |
| 70 | + persist-credentials: false |
| 71 | + - name: Set up Python ${{ matrix.python-version }} |
| 72 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 73 | + with: |
| 74 | + python-version: ${{ matrix.python-version }} |
| 75 | + - name: Install dependencies |
| 76 | + run: | |
| 77 | + pip install -U pip |
| 78 | + pip install -r requirements.txt |
| 79 | + pip install -r requirements/testing.txt |
| 80 | + - name: Run tests |
| 81 | + run: | |
| 82 | + pytest --junitxml=reports/test.xml |
| 83 | + - name: Upload test results to Codecov |
| 84 | + if: ${{ !cancelled() }} |
| 85 | + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 |
| 86 | + with: |
| 87 | + directory: ./reports/ |
| 88 | + fail_ci_if_error: true |
| 89 | + flags: ${{ matrix.python-version }} |
| 90 | + report_type: test_results |
| 91 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 92 | + verbose: true |
| 93 | + |
| 94 | + codecov: |
| 95 | + name: Code Coverage |
| 96 | + runs-on: ubuntu-latest |
| 97 | + timeout-minutes: 10 |
| 98 | + permissions: |
| 99 | + contents: read |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 102 | + with: |
| 103 | + persist-credentials: false |
| 104 | + - name: Set up Python ${{ env.LATEST_SUPPORTED_PY }} |
| 105 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 106 | + with: |
| 107 | + python-version: ${{ env.LATEST_SUPPORTED_PY }} |
| 108 | + - name: Install dependencies |
| 109 | + run: | |
| 110 | + pip install -U pip |
| 111 | + pip install -r requirements.txt |
| 112 | + pip install -r requirements/testing.txt |
| 113 | + - name: Run all tests for codecov |
| 114 | + run: | |
| 115 | + pytest --cov=./slack_cli_hooks/ --cov-report=xml |
| 116 | + - name: Upload coverage to Codecov |
| 117 | + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 |
| 118 | + with: |
| 119 | + fail_ci_if_error: true |
| 120 | + report_type: coverage |
| 121 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 122 | + verbose: true |
| 123 | + |
| 124 | + health-score: |
| 125 | + name: Health Score |
| 126 | + needs: codecov |
| 127 | + runs-on: ubuntu-latest |
| 128 | + timeout-minutes: 5 |
| 129 | + permissions: |
| 130 | + checks: write |
| 131 | + steps: |
| 132 | + - name: Setup repo |
| 133 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 134 | + with: |
| 135 | + persist-credentials: false |
| 136 | + - name: Report health score |
| 137 | + uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1 |
| 138 | + with: |
| 139 | + codecov_token: ${{ secrets.FILS_CODECOV_API_TOKEN }} |
| 140 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 141 | + extension: py |
| 142 | + include: slack_cli_hooks |
0 commit comments