Athena API / Client Library - Basics #15
Workflow file for this run
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
| name: Build and Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Ensure no differences in generated code | |
| run: | | |
| source .venv/bin/activate | |
| GENERATED_DIR="src/athena_client/generated" | |
| BACKUP_DIR="src/athena_client/generated_backup" | |
| cp -r $GENERATED_DIR $BACKUP_DIR | |
| ./scripts/compile_proto.sh | |
| # Fix imports in generated files | |
| if [[ -f "$GENERATED_DIR/athena/athena_pb2_grpc.py" && -f "$GENERATED_DIR/athena/athena_pb2.py" ]]; then | |
| sed -i "$GENERATED_DIR/athena/athena_pb2_grpc.py" -e 's/^from athena /from athena_client.generated.athena /' | |
| sed -i "$GENERATED_DIR/athena/athena_pb2.py" -e 's/^from athena /from athena_client.generated.athena /' | |
| else | |
| echo "Error: Expected files not found in $GENERATED_DIR/athena" | |
| exit 1 | |
| fi | |
| diff -r $GENERATED_DIR $BACKUP_DIR || (echo "Generated code differs. Please commit the changes after running compile_proto.sh." && exit 1) | |
| rm -rf $BACKUP_DIR | |
| - name: Run linter | |
| run: | | |
| uv run ruff check | |
| - name: Check code formatting with ruff | |
| run: | | |
| uv run ruff format --check | |
| - name: Run type checking | |
| run: | | |
| uv run pyright | |
| - name: Run tests | |
| run: | | |
| uv run pytest | |
| - name: Build package | |
| run: | | |
| uv build |