Skip to content

Commit 6918115

Browse files
chore: update the ci pipeline to match other patterns (#1422)
1 parent c8511da commit 6918115

File tree

10 files changed

+121
-137
lines changed

10 files changed

+121
-137
lines changed
Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run all the unit tests
1+
name: Python CI
22

33
on:
44
push:
@@ -9,8 +9,46 @@ on:
99
- cron: "0 0 * * *"
1010
workflow_dispatch:
1111

12+
env:
13+
LATEST_SUPPORTED_PY: "3.14"
14+
1215
jobs:
13-
build:
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
24+
with:
25+
persist-credentials: false
26+
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
27+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
28+
with:
29+
python-version: ${{ env.LATEST_SUPPORTED_PY }}
30+
- name: Run lint 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
41+
with:
42+
persist-credentials: false
43+
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
44+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.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
1452
runs-on: ubuntu-22.04
1553
timeout-minutes: 10
1654
strategy:
@@ -85,10 +123,48 @@ jobs:
85123
report_type: test_results
86124
token: ${{ secrets.CODECOV_TOKEN }}
87125
verbose: true
126+
127+
codecov:
128+
name: Code Coverage
129+
runs-on: ubuntu-latest
130+
timeout-minutes: 10
131+
permissions:
132+
contents: read
133+
env:
134+
BOLT_PYTHON_CODECOV_RUNNING: "1"
135+
steps:
136+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
137+
with:
138+
persist-credentials: false
139+
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
140+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
141+
with:
142+
python-version: ${{ env.LATEST_SUPPORTED_PY }}
143+
- name: Install dependencies
144+
run: |
145+
pip install -U pip
146+
pip install .
147+
pip install -r requirements/adapter.txt
148+
pip install -r requirements/testing.txt
149+
pip install -r requirements/adapter_testing.txt
150+
- name: Run all tests for codecov
151+
run: |
152+
pytest --cov=./slack_bolt/ --cov-report=xml
153+
- name: Upload coverage to Codecov
154+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
155+
with:
156+
fail_ci_if_error: true
157+
report_type: coverage
158+
token: ${{ secrets.CODECOV_TOKEN }}
159+
verbose: true
160+
88161
notifications:
89162
name: Regression notifications
90163
runs-on: ubuntu-latest
91-
needs: build
164+
needs:
165+
- lint
166+
- typecheck
167+
- unittest
92168
if: ${{ !success() && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch' }}
93169
steps:
94170
- name: Send notifications of failing tests

.github/workflows/codecov.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/flake8.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/mypy.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

scripts/format.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
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+
export PIP_REQUIRE_VIRTUALENV=1
9+
pip install -U pip
10+
pip install -U -r requirements/tools.txt
11+
fi
912

1013
black slack_bolt/ tests/

scripts/install_all_and_run_tests.sh

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,20 @@ pip uninstall python-lambda
1616
test_target="$1"
1717

1818
pip install -U -e .
19+
pip install -U -r requirements/testing.txt
20+
pip install -U -r requirements/adapter.txt
21+
pip install -U -r requirements/adapter_testing.txt
22+
pip install -U -r requirements/tools.txt
23+
# To avoid errors due to the old versions of click forced by Chalice
24+
pip install -U pip click
1925

2026
if [[ $test_target != "" ]]
2127
then
22-
pip install -U -r requirements/testing.txt && \
23-
pip install -U -r requirements/adapter.txt && \
24-
pip install -U -r requirements/adapter_testing.txt && \
25-
# To avoid errors due to the old versions of click forced by Chalice
26-
pip install -U pip click && \
27-
black slack_bolt/ tests/ && \
28+
./scripts/format.sh --no-install
2829
pytest $1
2930
else
30-
pip install -U -r requirements/testing.txt && \
31-
pip install -U -r requirements/adapter.txt && \
32-
pip install -U -r requirements/adapter_testing.txt && \
33-
pip install -r requirements/tools.txt && \
34-
# To avoid errors due to the old versions of click forced by Chalice
35-
pip install -U pip click && \
36-
black slack_bolt/ tests/ && \
37-
flake8 slack_bolt/ && flake8 examples/
38-
pytest && \
39-
mypy --config-file pyproject.toml
31+
./scripts/format.sh --no-install
32+
./scripts/lint.sh --no-install
33+
pytest
34+
./scripts/run_mypy.sh --no-install
4035
fi

scripts/lint.sh

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

scripts/run_flake8.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/run_mypy.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
# ./scripts/run_mypy.sh
33

44
script_dir=$(dirname $0)
5-
cd ${script_dir}/.. && \
5+
cd ${script_dir}/..
6+
7+
if [[ "$1" != "--no-install" ]]; then
8+
pip install -U pip
69
pip install -U .
7-
pip install -U -r requirements/async.txt && \
8-
pip install -U -r requirements/adapter.txt && \
9-
pip install -U -r requirements/tools.txt && \
10-
mypy --config-file pyproject.toml
10+
pip install -U -r requirements/async.txt
11+
pip install -U -r requirements/adapter.txt
12+
pip install -U -r requirements/tools.txt
13+
fi
14+
15+
mypy --config-file pyproject.toml

scripts/run_tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ script_dir=`dirname $0`
77
cd ${script_dir}/..
88

99
test_target="$1"
10-
python_version=`python --version | awk '{print $2}'`
10+
11+
./scripts/format.sh --no-install
1112

1213
if [[ $test_target != "" ]]
1314
then
14-
black slack_bolt/ tests/ && \
15-
pytest -vv $1
15+
pytest -vv $1
1616
else
17-
black slack_bolt/ tests/ && pytest
17+
pytest
1818
fi

0 commit comments

Comments
 (0)