Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

env:
PYTHON_VERSION: "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.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run lint verification
run: ./scripts/lint.sh
27 changes: 2 additions & 25 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test

on:
Expand All @@ -11,26 +10,6 @@ on:
workflow_dispatch:

jobs:
typecheck:
name: Typechecks
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 }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Run mypy verification
run: |
./scripts/run_mypy.sh
unittest:
name: Unit tests
runs-on: ubuntu-22.04
Expand All @@ -48,6 +27,7 @@ jobs:
- "3.8"
- "3.7"
- "pypy3.10"
- "pypy3.11"
permissions:
contents: read
env:
Expand All @@ -67,10 +47,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 Down Expand Up @@ -102,7 +80,6 @@ jobs:
name: Regression notifications
runs-on: ubuntu-latest
needs:
- typecheck
- unittest
if: ${{ !success() && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch' }}
steps:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Typecheck

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

env:
PYTHON_VERSION: "3.14"

jobs:
typecheck:
name: Typecheck
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.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run mypy verification
run: ./scripts/run_mypy.sh
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
6 changes: 4 additions & 2 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
script_dir=`dirname $0`
cd ${script_dir}/..

pip install -U pip
pip install -U -r requirements/tools.txt
if [[ "$1" != "--no-install" ]]; then
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