Skip to content

Commit

Permalink
Merge branch 'main' into feature/exception_middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik authored Aug 20, 2024
2 parents bef0274 + ad6cf23 commit ad696c2
Show file tree
Hide file tree
Showing 293 changed files with 1,464 additions and 932 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ services:

networks:
faststream-network:
name: "${USER}-faststream-network"
name: "${USER}-faststream-network"
2 changes: 1 addition & 1 deletion .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ uv venv .venv

uv pip install -e ".[dev]"

source .venv/bin/activate
source .venv/bin/activate
5 changes: 4 additions & 1 deletion .github/workflows/docs_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
with:
key: ${{ github.ref }}
path: .cache
- run: pip install -e ".[dev]"
- run: |
set -ux
python -m pip install uv
uv pip install --system -e .[dev]
- run: ./scripts/build-docs.sh
- run: echo "VERSION=$(python3 -c 'from importlib.metadata import version; print(".".join(version("faststream").split(".")[:2]))')" >> $GITHUB_ENV
- run: echo "IS_RC=$(python3 -c 'from importlib.metadata import version; print("rc" in version("faststream"))')" >> $GITHUB_ENV
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/docs_update-references.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
# should install with `-e`
run: |
set -ux
python -m pip install uv
uv pip install --system -e ".[dev]"
uv pip install --system -e .[dev]
- name: Run build docs
run: bash scripts/build-docs.sh
- name: Commit
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs_update-release-notes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
python -m pip install uv
uv pip install --system requests
- name: Run update_releases.py script
run: python ./docs/update_releases.py
Expand Down
134 changes: 61 additions & 73 deletions .github/workflows/pr_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,24 @@ concurrency:
cancel-in-progress: true

jobs:
static_analysis:
pre-commit-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install Dependencies and library
shell: bash
run: |
set -ux
python -m pip install uv
uv pip install --system ".[lint]"
- name: Run ruff
shell: bash
run: ruff check

- name: Run mypy
shell: bash
run: mypy

- name: Run bandit
shell: bash
run: bandit -c pyproject.toml -r faststream

- name: Run Semgrep
shell: bash
run: semgrep scan --config auto --error
python-version: |
3.8
3.9
3.10
- name: Set $PY environment variable
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/[email protected]

test-basic:
if: github.event.pull_request.draft == false
Expand All @@ -64,22 +52,22 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: pyproject.toml
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v03
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-uv
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- name: Install Pydantic v1
if: matrix.pydantic-version == 'pydantic-v1'
run: pip install "pydantic>=1.10.0,<2.0.0"
run: uv pip install --system "pydantic>=1.10.0,<2.0.0"
- name: Install Pydantic v2
if: matrix.pydantic-version == 'pydantic-v2'
run: pip install --pre "pydantic>=2.0.0b2,<3.0.0"
run: uv pip install --system --pre "pydantic>=2.0.0b2,<3.0.0"
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -vv -m "(slow and (not nats and not kafka and not confluent and not rabbit and not redis)) or (not nats and not kafka and not confluent and not rabbit and not redis)"
Expand All @@ -102,11 +90,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing] orjson
run: |
python -m pip install uv
uv pip install --system .[optionals,testing] orjson
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -m"(slow and (not nats and not kafka and not confluent and not rabbit and not redis)) or (not nats and not kafka and not confluent and not rabbit and not redis)"
Expand All @@ -129,11 +117,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- name: Test
run: bash scripts/test.sh -m "(slow and (not nats and not kafka and not confluent and not rabbit and not redis)) or (not nats and not kafka and not confluent and not rabbit and not redis)"

Expand All @@ -146,11 +134,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- name: Test
run: bash scripts/test.sh -m "(slow and (not nats and not kafka and not confluent and not rabbit and not redis)) or (not nats and not kafka and not confluent and not rabbit and not redis)"

Expand All @@ -163,11 +151,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[kafka,test-core]
run: |
python -m pip install uv
uv pip install --system .[kafka,test-core]
- name: Test
run: bash scripts/test.sh -m "not kafka" tests/brokers/kafka/test_test_client.py

Expand Down Expand Up @@ -199,11 +187,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -m "(slow and kafka) or kafka"
Expand All @@ -226,11 +214,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[confluent,test-core]
run: |
python -m pip install uv
uv pip install --system .[confluent,test-core]
- name: Test
run: bash scripts/test.sh -m "not confluent" tests/brokers/confluent/test_test_client.py

Expand Down Expand Up @@ -262,11 +250,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -vv -m "(slow and confluent) or confluent"
Expand All @@ -289,11 +277,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[rabbit,test-core]
run: |
python -m pip install uv
uv pip install --system .[rabbit,test-core]
- name: Test
run: bash scripts/test.sh -m "not rabbit" tests/brokers/rabbit/test_test_client.py

Expand All @@ -314,11 +302,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -m "(slow and rabbit) or rabbit"
Expand All @@ -341,11 +329,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[nats,test-core]
run: |
python -m pip install uv
uv pip install --system .[nats,test-core]
- name: Test
run: bash scripts/test.sh -m "not nats" tests/brokers/nats/test_test_client.py

Expand All @@ -366,11 +354,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -m "(slow and nats) or nats"
Expand All @@ -393,11 +381,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[redis,test-core]
run: |
python -m pip install uv
uv pip install --system .[redis,test-core]
- name: Test
run: bash scripts/test.sh -m "not redis" tests/brokers/redis/test_test_client.py

Expand All @@ -418,11 +406,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[optionals,testing]
run: |
python -m pip install uv
uv pip install --system .[optionals,testing]
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh -m "(slow and redis) or redis"
Expand Down Expand Up @@ -453,8 +441,6 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Get coverage files
uses: actions/download-artifact@v4
Expand All @@ -463,7 +449,9 @@ jobs:
path: coverage
merge-multiple: true

- run: pip install coverage[toml]
- run: |
python -m pip install uv
uv pip install --system coverage[toml]
- run: ls -la coverage
- run: coverage combine coverage
Expand All @@ -481,7 +469,7 @@ jobs:
if: github.event.pull_request.draft == false

needs:
- static_analysis
- pre-commit-check
- coverage-combine
- test-macos-latest
- test-windows-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/publish_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
with:
python-version: "3.9"

- run: pip install smokeshow
- run: |
python -m pip install uv
uv pip install --system smokeshow
- uses: dawidd6/action-download-artifact@v6 # nosemgrep
with:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -17,7 +17,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: [--ignore-words=.codespell-whitelist.txt]
Expand Down Expand Up @@ -60,7 +60,7 @@ repos:
verbose: true

- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
Expand Down
Loading

0 comments on commit ad696c2

Please sign in to comment.