fix(py): implement SigV4 signing for AWS X-Ray OTLP exporter #3248
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2025 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Python Checks | |
| on: | |
| pull_request: | |
| paths: | |
| - "py/**" | |
| - "genkit-tools/**" | |
| - ".github/workflows/python.yml" | |
| jobs: | |
| python-checks: | |
| name: Lint and Format | |
| runs-on: ubuntu-latest | |
| env: | |
| PATH: ${{ github.workspace }}/go/bin:${{ github.workspace }}/.cargo/bin:${{ github.workspace }}/.local/share/pnpm:${{ github.workspace }}/.local/bin:/usr/local/bin:/usr/bin:/bin | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libffi-dev cmake curl ripgrep libjpeg-dev zlib1g-dev | |
| - name: Set up Go | |
| uses: actions/setup-go@main | |
| with: | |
| go-version: stable | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - uses: pnpm/action-setup@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.x | |
| cache: "pnpm" | |
| - name: Install uv and setup Python version | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: "3.12" | |
| - name: Install Python dependencies | |
| run: | | |
| cd py | |
| uv pip install -e .[dev,test,docs] | |
| uv pip install --group dev | |
| - name: Install type checkers | |
| run: | | |
| cd py | |
| uv pip install pyright pyrefly | |
| - name: Install NPM packages | |
| run: | | |
| npm install -g license-checker | |
| - name: Install Go tools | |
| run: | | |
| go install github.com/google/go-licenses@latest | |
| - name: Generate schema typing | |
| run: ./py/bin/generate_schema_typing --ci | |
| - name: Check lockfile is up to date | |
| run: uv lock --check --directory py | |
| - name: Format check | |
| run: uv run --directory py ruff format --check . | |
| - name: Lint with ruff | |
| run: uv run --directory py ruff check . | |
| - name: Ensure Python test files follow the *_test.py naming convention | |
| run: | | |
| if find py -name "test_*.py" -not -path "*/.*" | grep -q .; then | |
| echo "Error: Found Python test files starting with 'test_'. Please use the '*_test.py' format instead:" | |
| find py -name "test_*.py" -not -path "*/.*" | |
| exit 1 | |
| fi | |
| - name: Type check with Ty | |
| # ty reads environment.root config from py/pyproject.toml | |
| run: uv run --directory py ty check . | |
| - name: Type check with Pyrefly | |
| run: uv run --directory py pyrefly check . | |
| - name: Type check with Pyright | |
| run: uv run --directory py pyright packages/ | |
| - name: Run security scan | |
| run: ./py/bin/run_python_security_checks | |
| - name: Check licenses | |
| run: ./bin/check_license | |
| python-tests: | |
| name: Tests (${{ matrix.test-type }} - ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| test-type: | |
| - "serial" | |
| - "tox" | |
| - "nox" | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libffi-dev cmake curl ripgrep libjpeg-dev zlib1g-dev | |
| - name: Install uv and setup Python version | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Python dependencies | |
| run: | | |
| cd py | |
| uv pip install -e .[dev,test,docs] | |
| - name: Generate schema typing | |
| run: ./py/bin/generate_schema_typing --ci | |
| - name: Run serial tests | |
| if: matrix.test-type == 'serial' | |
| run: uv run --python ${{ matrix.python-version }} --active --isolated --directory py pytest -xvs --log-level=DEBUG . | |
| - name: Run tox tests | |
| if: matrix.test-type == 'tox' | |
| run: | | |
| clean_version=$(echo "${{ matrix.python-version }}" | tr -d '.') | |
| uv run --directory py tox -e "py$clean_version" | |
| - name: Run nox tests | |
| if: matrix.test-type == 'nox' | |
| run: | | |
| uv run --directory py nox -s "tests-${{ matrix.python-version }}" | |
| python-build: | |
| name: Build Distributions | |
| runs-on: ubuntu-latest | |
| needs: [python-checks, python-tests] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: "3.12" | |
| - name: Build distributions | |
| run: ./py/bin/build_dists |