Python CI #492
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| env: | |
| LATEST_SUPPORTED_PY: "3.14" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ env.LATEST_SUPPORTED_PY }} | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.LATEST_SUPPORTED_PY }} | |
| - name: Run lint verification | |
| run: ./scripts/lint.sh | |
| typecheck: | |
| name: Typecheck | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ env.LATEST_SUPPORTED_PY }} | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.LATEST_SUPPORTED_PY }} | |
| - name: Run mypy verification | |
| run: ./scripts/run_mypy.sh | |
| unittest: | |
| name: Unit tests | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - "3.7" | |
| - "3.8" | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install synchronous dependencies | |
| run: | | |
| pip install -U pip | |
| pip install . | |
| pip install -r requirements/testing_without_asyncio.txt | |
| - name: Run tests without aiohttp | |
| run: | | |
| pytest tests/slack_bolt/ --junitxml=reports/test_slack_bolt.xml | |
| pytest tests/scenario_tests/ --junitxml=reports/test_scenario.xml | |
| - name: Install adapter dependencies | |
| run: | | |
| pip install -r requirements/adapter.txt | |
| pip install -r requirements/adapter_testing.txt | |
| - name: Run tests for HTTP Mode adapters | |
| run: | | |
| pytest tests/adapter_tests/ \ | |
| --ignore=tests/adapter_tests/socket_mode/ \ | |
| --ignore=tests/adapter_tests/asgi/ \ | |
| --junitxml=reports/test_adapter.xml | |
| - name: Install async dependencies | |
| run: | | |
| pip install -r requirements/async.txt | |
| - name: Run tests for Socket Mode adapters | |
| run: | | |
| # Requires async test dependencies | |
| pytest tests/adapter_tests/socket_mode/ --junitxml=reports/test_adapter_socket_mode.xml | |
| - name: Install all dependencies | |
| run: | | |
| pip install -r requirements/testing.txt | |
| - name: Run tests for HTTP Mode adapters (ASGI) | |
| run: | | |
| # Requires async test dependencies | |
| pytest tests/adapter_tests/asgi/ --junitxml=reports/test_adapter_asgi.xml | |
| - name: Run tests for HTTP Mode adapters (asyncio-based libraries) | |
| run: | | |
| pytest tests/adapter_tests_async/ --junitxml=reports/test_adapter_async.xml | |
| - name: Run asynchronous tests | |
| run: | | |
| pytest tests/slack_bolt_async/ --junitxml=reports/test_slack_bolt_async.xml | |
| pytest tests/scenario_tests_async/ --junitxml=reports/test_scenario_async.xml | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| directory: ./reports/ | |
| fail_ci_if_error: true | |
| flags: ${{ matrix.python-version }} | |
| report_type: test_results | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| codecov: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| env: | |
| BOLT_PYTHON_CODECOV_RUNNING: "1" | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ env.LATEST_SUPPORTED_PY }} | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: ${{ env.LATEST_SUPPORTED_PY }} | |
| - name: Install dependencies | |
| run: | | |
| pip install -U pip | |
| pip install . | |
| pip install -r requirements/adapter.txt | |
| pip install -r requirements/testing.txt | |
| pip install -r requirements/adapter_testing.txt | |
| - name: Run all tests for codecov | |
| run: | | |
| pytest --cov=./slack_bolt/ --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| with: | |
| fail_ci_if_error: true | |
| report_type: coverage | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| notifications: | |
| name: Regression notifications | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| - typecheck | |
| - unittest | |
| if: ${{ !success() && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch' }} | |
| steps: | |
| - name: Send notifications of failing tests | |
| uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 | |
| with: | |
| errors: true | |
| webhook: ${{ secrets.SLACK_REGRESSION_FAILURES_WEBHOOK_URL }} | |
| webhook-type: webhook-trigger | |
| payload: | | |
| action_url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| repository: "${{ github.repository }}" |