Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions .github/workflows/tests.yml → .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test
name: Python CI

on:
push:
Expand All @@ -10,27 +9,44 @@ on:
- 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@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
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: Typechecks
name: Typecheck
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python-version: ["3.14"]
permissions:
contents: read
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ env.LATEST_SUPPORTED_PY }}
- name: Run mypy verification
run: |
./scripts/run_mypy.sh
run: ./scripts/run_mypy.sh

unittest:
name: Unit tests
runs-on: ubuntu-22.04
Expand All @@ -48,6 +64,7 @@ jobs:
- "3.8"
- "3.7"
- "pypy3.10"
- "pypy3.11"
permissions:
contents: read
env:
Expand All @@ -67,10 +84,8 @@ jobs:
pip install -U pip
pip install -r requirements/testing.txt
pip install -r requirements/optional.txt
- name: Run validation (black/flake8/pytest)
- name: Run tests
run: |
black --check slack/ slack_sdk/ tests/ integration_tests/
flake8 slack/ slack_sdk/
PYTHONPATH=$PWD:$PYTHONPATH pytest --cov-report=xml --cov=slack_sdk/ --junitxml=reports/test_report.xml tests/
- name: Run tests for SQLAlchemy v1.4 (backward-compatibility)
run: |
Expand All @@ -89,7 +104,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload test coverage to Codecov (only with latest supported version)
if: startsWith(matrix.python-version, '3.14')
if: startsWith(matrix.python-version, env.LATEST_SUPPORTED_PY)
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
fail_ci_if_error: true
Expand All @@ -98,10 +113,12 @@ jobs:
report_type: coverage
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

notifications:
name: Regression notifications
runs-on: ubuntu-latest
needs:
- lint
- typecheck
- unittest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 thought: Keeping all of these workflows within this file might be nice for checking regressions for typechecks, lints, and unittests together?

🐍 ramble: Unsure of a best approach, but sharing an environment variable with the latest python version for the first of those checks might be useful if that seems like it'd be best!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 💯 I've moved the jobs in the same file

if: ${{ !success() && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch' }}
Expand Down
1 change: 0 additions & 1 deletion requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ moto>=4.0.13,<6
# For AsyncSQLAlchemy tests
greenlet<=4
aiosqlite<=1
-r tools.txt
4 changes: 1 addition & 3 deletions requirements/tools.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# We only need to install mypy with CPython runtimes
# Typechecking using the PyPy runtime is not planned
mypy<=1.19.0; platform_python_implementation == "CPython"
mypy<=1.19.0;
# while flake8 5.x have issues with Python 3.12, flake8 6.x requires Python >= 3.8.1,
# so 5.x should be kept in order to stay compatible with Python 3.7/3.8
flake8>=5.0.4,<8
Expand Down
7 changes: 5 additions & 2 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
script_dir=`dirname $0`
cd ${script_dir}/..

pip install -U pip
pip install -U -r requirements/tools.txt
if [[ "$1" != "--no-install" ]]; then
export PIP_REQUIRE_VIRTUALENV=1
pip install -U pip
pip install -U -r requirements/tools.txt
fi

black slack/ slack_sdk/ tests/ integration_tests/
14 changes: 14 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

#!/bin/bash
# ./scripts/lint.sh

script_dir=`dirname $0`
cd ${script_dir}/..

if [[ "$1" != "--no-install" ]]; then
pip install -U pip
pip install -U -r requirements/tools.txt
fi

black --check slack/ slack_sdk/ tests/ integration_tests/
flake8 slack/ slack_sdk/
5 changes: 3 additions & 2 deletions scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ cd ${script_dir}/..

pip install -U pip
pip install -U -r requirements/testing.txt \
-U -r requirements/optional.txt
-U -r requirements/optional.txt \
-U -r requirements/tools.txt

echo "Generating code ..." && python scripts/codegen.py --path .
echo "Running black (code formatter) ..." && black slack_sdk/
echo "Running black (code formatter) ..." && ./scripts/format.sh --no-install

test_target="${1:-tests/integration_tests/}"
PYTHONPATH=$PWD:$PYTHONPATH pytest $test_target
3 changes: 2 additions & 1 deletion scripts/run_mypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cd ${script_dir}/..

pip install -U pip setuptools wheel
pip install -U -r requirements/testing.txt \
-U -r requirements/optional.txt
-U -r requirements/optional.txt \
-U -r requirements/tools.txt

mypy --config-file pyproject.toml
6 changes: 4 additions & 2 deletions scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ cd ${script_dir}/..

pip install -U pip
pip install -U -r requirements/testing.txt \
-U -r requirements/optional.txt
-U -r requirements/optional.txt \
-U -r requirements/tools.txt

echo "Generating code ..." && python scripts/codegen.py --path .
echo "Running black (code formatter) ..." && black slack_sdk/
echo "Running black (code formatter) ..." && ./scripts/format.sh --no-install

echo "Running tests ..."
test_target="${1:-tests/}"
PYTHONPATH=$PWD:$PYTHONPATH pytest $test_target
9 changes: 5 additions & 4 deletions scripts/run_validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ script_dir=`dirname $0`
cd ${script_dir}/..

pip install -U -r requirements/testing.txt \
-U -r requirements/optional.txt
-U -r requirements/optional.txt \
-U -r requirements/tools.txt

echo "Generating code ..." && python scripts/codegen.py --path .
echo "Running black (code formatter) ..." && black slack_sdk/
echo "Running black (code formatter) ..." && ./scripts/format.sh --no-install

black --check slack/ slack_sdk/ tests/ integration_tests/
flake8 slack/ slack_sdk/
echo "Running linting checks ..." && ./scripts/lint.sh --no-install

echo "Running tests with coverage reporting ..."
test_target="${1:-tests/}"
PYTHONPATH=$PWD:$PYTHONPATH pytest --cov-report=xml --cov=slack_sdk/ $test_target