Skip to content

Commit 610ecb7

Browse files
fix: improve CI and helper scripts
1 parent 4601f8a commit 610ecb7

File tree

11 files changed

+93
-40
lines changed

11 files changed

+93
-40
lines changed

.github/workflows/lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
PYTHON_VERSION: "3.14"
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
permissions:
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
22+
with:
23+
persist-credentials: false
24+
- name: Set up Python ${{ env.PYTHON_VERSION }}
25+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
26+
with:
27+
python-version: ${{ env.PYTHON_VERSION }}
28+
- name: Run lint verification
29+
run: ./scripts/lint.sh

.github/workflows/tests.yml

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
21
name: Test
32

43
on:
@@ -11,26 +10,6 @@ on:
1110
workflow_dispatch:
1211

1312
jobs:
14-
typecheck:
15-
name: Typechecks
16-
runs-on: ubuntu-latest
17-
timeout-minutes: 5
18-
strategy:
19-
matrix:
20-
python-version: ["3.14"]
21-
permissions:
22-
contents: read
23-
steps:
24-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
25-
with:
26-
persist-credentials: false
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
- name: Run mypy verification
32-
run: |
33-
./scripts/run_mypy.sh
3413
unittest:
3514
name: Unit tests
3615
runs-on: ubuntu-22.04
@@ -48,6 +27,7 @@ jobs:
4827
- "3.8"
4928
- "3.7"
5029
- "pypy3.10"
30+
- "pypy3.11"
5131
permissions:
5232
contents: read
5333
env:
@@ -67,10 +47,8 @@ jobs:
6747
pip install -U pip
6848
pip install -r requirements/testing.txt
6949
pip install -r requirements/optional.txt
70-
- name: Run validation (black/flake8/pytest)
50+
- name: Run tests
7151
run: |
72-
black --check slack/ slack_sdk/ tests/ integration_tests/
73-
flake8 slack/ slack_sdk/
7452
PYTHONPATH=$PWD:$PYTHONPATH pytest --cov-report=xml --cov=slack_sdk/ --junitxml=reports/test_report.xml tests/
7553
- name: Run tests for SQLAlchemy v1.4 (backward-compatibility)
7654
run: |
@@ -102,7 +80,6 @@ jobs:
10280
name: Regression notifications
10381
runs-on: ubuntu-latest
10482
needs:
105-
- typecheck
10683
- unittest
10784
if: ${{ !success() && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch' }}
10885
steps:

.github/workflows/typecheck.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Typecheck
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
PYTHON_VERSION: "3.14"
12+
13+
jobs:
14+
typecheck:
15+
name: Typecheck
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
permissions:
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
22+
with:
23+
persist-credentials: false
24+
- name: Set up Python ${{ env.PYTHON_VERSION }}
25+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
26+
with:
27+
python-version: ${{ env.PYTHON_VERSION }}
28+
- name: Run mypy verification
29+
run: ./scripts/run_mypy.sh

requirements/testing.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ moto>=4.0.13,<6
1212
# For AsyncSQLAlchemy tests
1313
greenlet<=4
1414
aiosqlite<=1
15-
-r tools.txt

requirements/tools.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# We only need to install mypy with CPython runtimes
2-
# Typechecking using the PyPy runtime is not planned
3-
mypy<=1.19.0; platform_python_implementation == "CPython"
1+
mypy<=1.19.0;
42
# while flake8 5.x have issues with Python 3.12, flake8 6.x requires Python >= 3.8.1,
53
# so 5.x should be kept in order to stay compatible with Python 3.7/3.8
64
flake8>=5.0.4,<8

scripts/format.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
script_dir=`dirname $0`
55
cd ${script_dir}/..
66

7-
pip install -U pip
8-
pip install -U -r requirements/tools.txt
7+
if [[ "$1" != "--no-install" ]]; then
8+
pip install -U pip
9+
pip install -U -r requirements/tools.txt
10+
fi
911

1012
black slack/ slack_sdk/ tests/ integration_tests/

scripts/lint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
#!/bin/bash
3+
# ./scripts/lint.sh
4+
5+
script_dir=`dirname $0`
6+
cd ${script_dir}/..
7+
8+
if [[ "$1" != "--no-install" ]]; then
9+
pip install -U pip
10+
pip install -U -r requirements/tools.txt
11+
fi
12+
13+
black --check slack/ slack_sdk/ tests/ integration_tests/
14+
flake8 slack/ slack_sdk/

scripts/run_integration_tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ cd ${script_dir}/..
1010

1111
pip install -U pip
1212
pip install -U -r requirements/testing.txt \
13-
-U -r requirements/optional.txt
13+
-U -r requirements/optional.txt \
14+
-U -r requirements/tools.txt
1415

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

1819
test_target="${1:-tests/integration_tests/}"
1920
PYTHONPATH=$PWD:$PYTHONPATH pytest $test_target

scripts/run_mypy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cd ${script_dir}/..
88

99
pip install -U pip setuptools wheel
1010
pip install -U -r requirements/testing.txt \
11-
-U -r requirements/optional.txt
11+
-U -r requirements/optional.txt \
12+
-U -r requirements/tools.txt
1213

1314
mypy --config-file pyproject.toml

scripts/run_unit_tests.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ cd ${script_dir}/..
1010

1111
pip install -U pip
1212
pip install -U -r requirements/testing.txt \
13-
-U -r requirements/optional.txt
13+
-U -r requirements/optional.txt \
14+
-U -r requirements/tools.txt
1415

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

19+
echo "Running tests ..."
1820
test_target="${1:-tests/}"
1921
PYTHONPATH=$PWD:$PYTHONPATH pytest $test_target

0 commit comments

Comments
 (0)